This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

using a Jar as classpath  RSS feed

 
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.
 
Rancher
Posts: 1016
6
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!