I have created a class file HelloWorld.class which is in "C:\myData" using javac.exe.
At command prompt I am at C:\Program Files\Java\jdk1.8.0_91\bin> since I have my java.exe here.
When I execute java C:\myData\HelloWorld it gives me the following error :
C:\Program Files\Java\jdk1.8.0_91\bin> java C:\myData\HelloWorld
Error: Could not find or load main class C:\myData\HelloWorld
Can some one please assist.
How should I specify the path of my HelloWorld.class file to java.exe. (I wish to resolve this without setting classpath or any environment variables).
Below is my HelloWorld.java code :
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
Regards.