• Post Reply Bookmark Topic Watch Topic
  • New Topic

Where to place jar files for deployment?  RSS feed

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys! If you're creating a standalone app. Where should third-party jar files that you used be placed? Using the classpath seems illogical since you usually won't have control over the user's machine. Thanks!
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can place them anywhere you like. The best place is probably to put them in the same directory as the JAR file of your application. you should supply a batch file or shell script with your program that starts it up with the right classpath, that looks something like this:

java -cp MyJar.jar;thirdparty.jar;somethingelse.jar com.mycompany.mypackage.MyMainClass

You could also make your JAR an executable JAR file (see the tutorial for more info), in which case you specify the classpath for your application in the manifest file in the JAR.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!