So I've been getting this error pretty much on any new installation of IntelliJ on multiple computers.
The code I'm running is a simple hello world system out class.
public class hello {
public static void main(String[] args) {
System.out.printf("HELLO WORLD");
}
}
That's it.
Everytime I run this or anything else I get the error:
Exception in thread "main" java.lang.ClassNotFoundException: hello
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:123)
I've tried:
- Revalidating my cache files
- recompiling the project
- setting the environmental variables to find the jdk and jre installations
- setting the correct source folders
reinstalling jdk on windows and installing on ubuntu
at one stage I had managed to get it running when i used a default java class template on something, it had a import or package statement, but I can't remember what it was, however after adding the import/package statement things had worked.
UPDATE: the package that appears to get it working is "package com.company;", why does this work? what does it do?
Any help would be greatly appreciated. Thanks Guys.