Reputation: 307
Assuming I have the following folder structure:
Which command 'java.exe' I would use to run the class MyClass.class, admitting that I was in folder 'source'?
Upvotes: 0
Views: 126
Reputation: 10342
Whatever command you are using for running MyClass.class in its folder plus navigation to the Myclass.class.
Let's say you are using
java MyClass
to run it from it's directory. Now you have to use
java -cp ../../myproject/classes com.wickedlysmart.MyClass
to run from some other directory
Upvotes: 1
Reputation: 109045
You need to specify the classpath for the classes folder, so you need to do:
java -cp ../classes com.wickedlysmart.MyClass
Or
java -cp <full-path-to>/classes com.wickedlysmart.MyClass
Note: This is assuming that you made an error in your post with the hierarchy with having com
and wickedlysmart
on the same level. If they should be on the same level, remove the com.
from above examples.
Upvotes: 3