How to setup Main class in manifest file in jar produced by NetBeans project

前端 未结 10 1814
我在风中等你
我在风中等你 2020-11-29 10:25

I have the following problem. I have a Java project in my NetBeans IDE 6.8. When I compile it and it produces a .jar file containing everything possible, the META-INF is not

10条回答
  •  Happy的楠姐
    2020-11-29 10:44

    I'm going to make a summary of the proposed solutions and the one that helped me!

    After reading this bug report: bug in the way NetBeans 6.8 creates the jar for a Java Library Project.

    1. Create a manifest.mf file in my project root

    2. Edit manifest.mf. Mine looked something like this:

      Manifest-Version: 1.0
      Ant-Version: Apache Ant 1.7.1
      Created-By: 16.3-b01 (Sun Microsystems Inc.)
      Main-Class: com.example.MainClass
      Class-Path: lib/lib1.jar lib/lib2.jar
      
    3. Open file /nbproject/project.properties

    4. Add line

      manifest.file=manifest.mf

    5. Clean + Build of project

    Now the .jar is successfully build.

    Thank you very much vkraemer

提交回复
热议问题