Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'installing jar files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
installing jar files
Authored by: zgrose on May 16, '01 05:35:30PM

java jar files dont get installed. when you run java program that needs to use another jar file to run, you simply include that jar file in the classpath of the program you are executing. for instance, if foo.class imports classes from the bar.jar file, you would start foo from the command line like this:

java -classpath "bar.jar" foo

this assumes that you have the bar.jar file in the same folder as the foo class. since this is OS X, you can also use MRJAppBuilder to create double-clickable .app icons that include all of your jar files. it can even bundle all of your java bits inside the .app so that you can move everything around as one icon.



[ Reply to This | # ]
installing jar files
Authored by: mac_guy on May 17, '01 11:21:41PM

Thank you. Your comments encouraged me to take a fresh look at things, and I realize now I was confusing the jar file and the command to start the app. Saxon works. I'm working throught the classpath complexities, too, as there seem to be several places to store classpath information. I'm not sure I wish to modify the .plist file yet.



[ Reply to This | # ]
installing jar files
Authored by: zgrose on May 19, '01 04:04:05PM

the classpath is actually fairly easy to understand albeit very verbose. :) some people like to maintain a global CLASSPATH variable in their environment, but i don't like that approach since you tend to lose sight of the dependencies between your programs and their libraries.

the approach i like (and i think most java apps take), is to use the -classpath parameter to the java application. the classpaths can get *very* long, but you have precise control over what is going on. for instance, one application can use one XML library and another use a separate XML library without clashes.

my recommendation is to make heavy use of -classpath (or let MRJAppBuilder do it for you) rather than using other means.



[ Reply to This | # ]