• Notice regarding image hosts and attachments. See here.

Java gives an error on everything

Soldato
Joined
27 Oct 2005
Posts
13,838
Location
Netherlands
Hello,

Can anyone help me get java working on my pc, I use this bit of code:
Code:
class priem
{
	public static void main(String[] args)
	{
				System.out.println("hello world");
		
	}
}
saved as priem.java
I compile it and it creates the .class.
I type in java priem.
And the command prompt returns this:

Code:
Exception in thread "main" java.lang.NoClassDefFoundError: priem
Caused by: java.lang.ClassNotFoundException: priem
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
Could not find the main class: priem.  Program will exit.



It gives the same error, not being able to find the clas, on any java file, the same bytecode works fine on another pc...
 
Last edited:
Same problem, the problem is not the code, the problem is that it gives that error on things that do work on otehr pc's.
 
Aye that works...

It says this:
Code:
C:\Program Files (x86)\Java\jdk1.6.0_17\bin;C:\Program Files (x86)\Java\jdk1.6.0
_17\lib
 
Ah k, thanks, so I messed up with my classpath ( I did it myself)...
Ty for your help, now to catch up with 3 weeks worth of programming coursework :D.
 
Back
Top Bottom