• Post Reply Bookmark Topic Watch Topic
  • New Topic

using a Jar as classpath  RSS feed

 
Nick Widelec
Ranch Hand
Posts: 226
Eclipse IDE Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
This forum is great, happy to have joinded.
I have a question regarding compiling a file which i class dependent with some classes contained in a Jar file.
By putting a directory tree in a -classpath option (ex: javac -cp MyJar.jar MyClass.java ) will all the subdirectory be checked for classes or only the top level class in the directory tree?
Thanks in advance.
 
Ivan Jozsef Balazs
Rancher
Posts: 999
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The subdirectories will be perused according to the package structure.
A class is expected to be found under the subdirectory corresponding to the package of the class.

If you compile the classes with a -d option, and build the jar file starting from that directory, the classes will be put to their right places in the jar file.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!