Creating a jar file to be run on any other machine

前端 未结 3 1638
日久生厌
日久生厌 2021-01-26 00:30

I have to create a jar file wherein i need to add external jar files in the classpath, properties files, in such away as to run it on any other machine.

相关标签:
3条回答
  • 2021-01-26 01:22

    You can make the jar in almost any IDE. I agree with Michael SchmeiBer, be a bit more specific please.

    I use eclipse as my IDE (because you can both use it in windows and Ubuntu Linux) to make a jar (you can define the startup class in the jar).

    I use different methods for starting up of different machines.

    I use nsis to create a nice windows executable (.exe) You can include your own icon.

    In nsis script you actually use the same command you would use in a batch command. nsis has some nice features, like search for a java jre.

    For Linux and Mac I use a .sh file with this command.

    0 讨论(0)
  • 2021-01-26 01:26

    I really recommend you to use a build tool such as Maven for these things:

    http://maven.apache.org/

    How can I create an executable JAR with dependencies using Maven?

    Regards,

    Boskop

    0 讨论(0)
  • 2021-01-26 01:28

    You could either use manifest.mf to define external class path or use script that composes classpath and runs your application.

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