Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jar files inside executable jar file

 
anks garg
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to make an executable jar file which can access jar/properties files packed inside it. but, it doesn't recognize the internal jar/properties files.
It works fine if internal jar/properties files are also available outside main jar file.
The problem is I want someone else also to be able to run main jar file without having the need to have internal jar/properties files on his system.
here is what my manifest looks like :
Manifest-Version: 1.0
Class-Path: classes12.jar log4j-1.2.8.jar servlet.jar db.properties
Created-By: 1.4.0_03 (Sun Microsystems Inc.)
Main-Class: com.once.client.rnt.obtm0003.PostClient
I runs fine if I say
java -jar rnt.jar
but only if jar files are available outside rnt.jar as well.
Any ideas??
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is how the -jar switch is designed to work. The ClassLoader does not recognize nested JARs. Unless you design your own / find one already designed ClassLoader to load the nested JARs, you will have to have the other JARs loacated outside the main JAR file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic