This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes chapter 10 question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "chapter 10 question" Watch "chapter 10 question" New topic
Author

chapter 10 question

Janki Shah
Ranch Hand

Joined: Nov 23, 2011
Posts: 136
If I compile .java file using below line how do I run it?


directory structure for this is, myProject/source/MyClass.java. Here, all .class files are stored in folder name classes. So, all .class file will be stored in myProject/classes/ path. To run this .class file, is there any other way except going in to classes folder to run them? like this c:\myPoject\classes>java MyClass
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

say to the java where your class file stays using -cp after your java command
Janki Shah
Ranch Hand

Joined: Nov 23, 2011
Posts: 136
Thank you Seetharaman.
like this, java -cp classes MyClass
Seetharaman Venkatasamy wrote:say to the java where your class file stays using -cp after your java command
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Janki Shah wrote:Thank you Seetharaman.

hope you got... you are welcome
 
Don't get me started about those stupid light bulbs.
 
subject: chapter 10 question