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

前端 未结 10 1811
我在风中等你
我在风中等你 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 11:00

    Brother you don't need to set class path just follow these simple steps (I use Apache NetBeans)

    Steps:

    1. extract the jar file which you want to add in your project.

    2. only copy those packages (folder) which you need in the project. (do not copy manifest file)

    3. open the main project jar file(dist/file.jar) with WinRAR.

    4. paste that folder or package in the main project jar file.

    5. Those packages work 100% in your project.

    warning: Do not make any changes in the manifest file.

    Another method:

    • In my case lib folder present outside the dist(main jar file) folder.
    • we need to move lib folder in dist folder.then we set class path from manifest.mf file of main jar file.

      Edit the manifest.mf And ADD this type of line

    • Class-Path: lib\foldername\jarfilename.jar lib\foldername\jarfilename.jar

    Warning: lib folder must be inside the dist folder otherwise jar file do not access your lib folder jar files

提交回复
热议问题