After searching for 2 days I found this solution and this works. It is pretty weird but it works for me.
package javaapplication3;
public class JavaApplication3 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
System.out.println("Hello");
}
}
this is my program i want to run that locates at C:\Java Projects\JavaApplication3\src\javaapplication3
Now open cmd on this location and compile program using this command
javac JavaApplication3.java
After compiling navigate one directory down i.e. C:\Java Projects\JavaApplication3\src
now run following command to execute program
java javaapplication3.JavaApplication3