Beginner issues: Packages, classpaths and JARs
I'm currently trying to get the hang of packages, classpaths and JAR files.
I have this structure on files:
MyTool.java has: "package mytool" and imports gnu.getopt.*
Getopt.java and its fellow files have: package gnu.getopt
So, what I want to do in the end is to add everything into a "mytool.jar" file.
I try: javac -cp mytool mytool/*.java
Issues no errors, but I feel it in my bones that this is not the way to go, which is also confirmed when trying to run it.
I think I've got the hang of it when creating the actual JARs:
jar cvf mytool.jar mytool/*.class
Say if I have a third party library like: java-getopt-1.0.9.jar
and I want to use it in my project. I add the following import:
But how on earth will the actual building of the project look like?
And finally, how would one specify the class paths when running the app?
What is the proper procedure?
Hope you understood the core problem in my questions. Feeling a bit lost.