This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Package Question

 
Harry Preston
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Layout


Code




Action


Q
Want to compile and run yeaimmad.java...wat do?
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"-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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks much
I try



Wat do?
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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;
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic