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

前端 未结 10 1827
我在风中等你
我在风中等你 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条回答
  •  生来不讨喜
    2020-11-29 10:58

    The real problem is how Netbeans JARs its projects. The "Class-Path:" in the Manifest file is unnecessary when actually publishing your program for others to use. If you have an external Library added in Netbeans it acts as a package. I suggest you use a program like WINRAR to view the files within the jar and add your libraries as packages directly into the jar file.

    How the inside of the jar file should look:

    MyProject.jar
    
        Manifest.MF
             Main-Class: mainClassFolder.Mainclass
    
        mainClassFolder
             Mainclass.class
    
        packageFolder
             IamUselessWithoutMain.class
    

提交回复
热议问题