aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Package Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Package Question" Watch "Package Question" New topic
Author

Package Question

Harry Preston
Greenhorn

Joined: Jun 01, 2013
Posts: 9
Layout


Code




Action


Q
Want to compile and run yeaimmad.java...wat do?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
"-cp C:\ocjp2" is not correct, it should be "-cp C:\", since "ocjp2" is part of the package hierarchy, and the classpath should contain the root of the package hierarchy.

Also, move up a level into the c:\ directory and run the command from there - then the compiler will find other (possibly uncompiled) classes.
Harry Preston
Greenhorn

Joined: Jun 01, 2013
Posts: 9
Thanks much
I try



Wat do?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
If class "yeaimmad" is in package "mad" -as opposed to package "ocjp2.mad", then it should be in C:\mad, not C:\ocjp2\mad (which is how I understood your directory layout to be). The directory hierarchy needs to be the same as the package hierarchy.
Harry Preston
Greenhorn

Joined: Jun 01, 2013
Posts: 9
Thanks! You helped me solve
But actually my desired directory hierarchy is unchanged
How I fixed issue is change yeaimmad.java package name

package ocjp2.mad;
instead of
package mad;
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Package Question