Skip to main content

Javac, jar and similar...

1 reply [Last post]
maurylovesjdk
Offline
Joined: 2008-02-06

Hi, this is the first time I'm using Java and I don't understand a little thing. I've two packages, both with name starting with "org.". How can I use both in the application? Have I to use javac -classpath? How?
Sorry if it seems stupid, but really I'm so confused about the use of .jar...
Thanks,
Maurizio

Message was edited by: maurylovesjdk

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
maurylovesjdk
Offline
Joined: 2008-02-06

Solved!

For compile

javac -classpath .:lib/Package1.jar:lib/Package2.jar:etc... MyClass.java
For execution I used a Manifest file with the line
Class-Path: lib/Package1.jar lib/Package2.jar etc...

NOTES: separator using -classpath it's different between Windows users & Linux users. If you're using Windows (...) you have to use " ; " instead of " : "
in the example
javac -classpath .;lib/Package1.jar;lib/Package2.jar:etc

I solved, but maybe it can be helpfull to someone. Hope it helps! :)

Maurizio