How can I create a JAR/exe of a Java project?

后端 未结 3 2017
青春惊慌失措
青春惊慌失措 2020-12-20 00:46

I have developed a project in Java using NetBeans 6.1. I need to add two third party JARs to it and 2 license files in a JDK/JRE/bin location.

Now I want it to distr

相关标签:
3条回答
  • 2020-12-20 01:21

    I need to add 2 third party jar's to it and 2 licence files in a jdk/jre/bin location.

    You should not be adding anything to that directory. Third party JARs and license files that need to go along with your executable JAR belong with your project.

    If your .java files are in a /src directory, create a /lib directory and put the 3rd party JARs and license files into it. Add them to your NetBeans CLASSPATH so your code will compile and run.

    When you're ready to create your executable JAR, make sure you create a META-INF/manifest.mf file that points to your main class and adds these JARs to its classpath.

    If that works, you'll have one more step to deploy. You'll have to ZIP up your executable JAR and the 3rd party libraries so your clients can unpack everything they need to run.

    0 讨论(0)
  • 2020-12-20 01:28

    You can use JSmooth for creating Windows .exe files (user manual is here). Or you can make your deployed JAR file executable by adding some manifest options (tutorial for Eclipse).

    0 讨论(0)
  • 2020-12-20 01:36

    You can also use Tanuki's Java Service Wrapper

    0 讨论(0)
提交回复
热议问题