This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes -classpath option and jar files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "-classpath option and jar files" Watch "-classpath option and jar files" New topic
Author

-classpath option and jar files

Asha Pathik
Ranch Hand

Joined: Feb 08, 2006
Posts: 143
Hi,

I've a little confussion regarding the combination of package statements and the jar files.

Let suppose we have created a jar file for a particular directory containing many class files as well as directories.

1.Now if the class file contains any package statement then do we have to supply the relative path on the command prompt or not?
2.If the class file is inside a directory then what do we have to do?

Thanks


SCJP 1.5
Murali Mohan
Ranch Hand

Joined: Jan 09, 2006
Posts: 66
When you create a jar file..the classes inside the jar file will be kept in the relative dirs.
e.g. suppose your class contains the following package stmt.

package com.java.yourname;
public class MyClass{}

Then inside the jar file the relative location of the file MyClass.clas should be com/java/youname/MyClass.class
This you can see by openning the jar file in winzip.

Let me know I am wrong.


Thanks,<br />Murali...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: -classpath option and jar files
 
Similar Threads
ANT : trying not to include jar class files
Launching From Command Line
Deploying My project in Jboss server
adding jar or directory to classpath
why include directory in classpath ?