Executable Jars - why are they so rigid with classpaths ?  
Author Message
k1205





PostPosted: 2003-11-15 1:39:00 Top

java-programmer, Executable Jars - why are they so rigid with classpaths ? If someone gives me a jar file with a Main in it and some supporting
library jar files, the Manifest.mf will contain information on what
the Main class is and also the location of supporting library jars
RELATIVE to the application jar file. But once I get the jar, I want
to move the supporting jar files to some other convenient directory.
But If I do that, the application jar file will not be able to locate
the supporting classes since the Manifest file has the supporting jar
paths pretty much HARDCODED ! How do I override the hardcode and give
it a different search path so that it can start looking at the new
directory ? This rigidity makes it so painful during times of
distribution. Please help.
 
Dave Glasser





PostPosted: 2003-11-15 9:21:00 Top

java-programmer >> Executable Jars - why are they so rigid with classpaths ? email***@***.com (deegoogle) wrote on 14 Nov 2003 09:38:41 -0800 in
comp.lang.java.programmer:

>If someone gives me a jar file with a Main in it and some supporting
>library jar files, the Manifest.mf will contain information on what
>the Main class is and also the location of supporting library jars
>RELATIVE to the application jar file. But once I get the jar, I want
>to move the supporting jar files to some other convenient directory.
>But If I do that, the application jar file will not be able to locate
>the supporting classes since the Manifest file has the supporting jar
>paths pretty much HARDCODED ! How do I override the hardcode and give
>it a different search path so that it can start looking at the new
>directory ? This rigidity makes it so painful during times of
>distribution. Please help.

Just don't launch the program with the java -jar jarfilename.jar
command. Invoke the main class directly, instead. Then you can use
whatever classpath you want, as long as it contains all of the needed
jars.


--
Check out QueryForm, a free, open source, Java/Swing-based
front end for relational databases.

http://qform.sourceforge.net
 
k1205





PostPosted: 2003-11-18 6:42:00 Top

java-programmer >> Executable Jars - why are they so rigid with classpaths ? How ?
How to you specifically call the main program via the jar file ?
 
 
Andrew Thompson





PostPosted: 2003-11-18 7:12:00 Top

java-programmer >> Executable Jars - why are they so rigid with classpaths ? "deegoogle" <email***@***.com> wrote in message
news:email***@***.com...
> How ?
> How to you specifically call the main program via the jar file ?

Start by specifically reading the tutorial on the manifest *
http://java.sun.com/docs/books/tutorial/jar/basics/manifest.html

* this is assuming you want to 'double click run' a jar
and need to specify the main class. Otherwise, please
clarify your question.


 
 
Dave Glasser





PostPosted: 2003-11-18 8:55:00 Top

java-programmer >> Executable Jars - why are they so rigid with classpaths ? email***@***.com (deegoogle) wrote on 17 Nov 2003 14:42:05 -0800 in
comp.lang.java.programmer:

>How ?
>How to you specifically call the main program via the jar file ?

You don't call it "via" the jar file. You call it (the main() method
that launches the program) the same way you would if your program's
class files were *not* packaged in a jar file. If that's something
you're unfamiliar with, then you need to find a good Java tutorial,
and work through it from the very beginning.


--
Check out QueryForm, a free, open source, Java/Swing-based
front end for relational databases.

http://qform.sourceforge.net