File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 14114
    
  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: 10268
    
    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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to refer a jar outside executable in desktop application?