This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes how to refer a jar outside executable in desktop application? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to refer a jar outside executable in desktop application?" Watch "how to refer a jar outside executable in desktop application?" New topic
Author

how to refer a jar outside executable in desktop application?

amit malpure
Greenhorn

Joined: Jul 26, 2011
Posts: 4
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

Joined: Aug 16, 2005
Posts: 14074
    
  16

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.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
amit malpure
Greenhorn

Joined: Jul 26, 2011
Posts: 4
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

Joined: Jul 26, 2007
Posts: 10170
    
    8

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?

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Jul 26, 2011
Posts: 4
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to refer a jar outside executable in desktop application?
 
Similar Threads
Executable jar file
Question about Installer exe
Java Desktop Applications
To run a swing application in window system
Create setup file of Java Application