Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to refer a jar outside executable in desktop application?

 
amit malpure
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a desktop java application and want to use some classes outside the executable. How can I do it?

Thanks
Amit
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15284
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

If the application is in an executable jar file (it's a jar file that you double-click to run, or that you can start with the command: java -jar TheProgram.jar), then you have to add the external classes to the classpath in the manifest file of the executable jar.

The tutorial Packaging Programs in JAR Files explains how executable jar files can be created and how to set the classpath in the manifest file.
 
amit malpure
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jesper for the responce.

Let me explain the scenario:

I have java application installed. And the jar is bundlled into an .exe file using some installer tool. Now I want to create a patch for this application.

If I create another jar containing updated files only, how can I refer it in the original code?

Please guide.

Thanks
Amit
 
Maneesh Godbole
Saloon Keeper
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I create another jar containing updated files only, how can I refer it in the original code?

Short answer: As long as the new jar is on the classpath, it should work.

Long answer: It would depend on how the "patch" works. Does it involve code changes to your original classes? Does it involve new classes? If yes, how is the original jar supposed to use the new classes without any changes to the original code? Anything else?
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
amit malpure wrote:I have java application installed. And the jar is bundlled into an .exe file using some installer tool. Now I want to create a patch for this application.


That's a question about the (un-named) installer tool.
 
amit malpure
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

Now I am able to refer a jar outside exe after specifiying proper class path. Now I am working on how to use code from new jar instead of code from old jar inside the exe?

Does it involve code changes to your original classes? Yes.
Does it involve new classes? Yes

Thanks
Amit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic