I am trying to compile my Java code.
package Test;
public class HelloWorld {
public static void main (String args[]) {
System.out.println("Hello World");
}
}
I am using Jetbrains IntelliJ IDEA 15. I try to run my sample code and this is the error I get.
/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/bin/java Exception in thread "main" java.lang.ClassNotFoundException: HelloWorld at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:188) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)
Process finished with exit code 1
I am not sure what is the problem here. I was trying to search this problem in the internet but the answers I was reading were for running my code through a command line.