Greetings:
I was wondering, how can i run a .class from a different location?
For example, supose that i have c:\A.class, in MS-DOS supose that im at d:\whatever\whatever\, if i run java c:\A, i get:
Exception int hread "main" java.lang.No ClassDefFoundError c:\A

I`ve also tried using:

java -cp . c:\A
java c:\\A

But i can`t make them to run, i`writing a compiler for java and i want that you can choose any file in any location, not just in the same folder/location of the app.

as long as a class is on the classpath java can find it.
In your scenario your class isn't on the classpath.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.