HELP!! problem with java installation

  • Thread starter paul_fraser2005
  • Start date
P

paul_fraser2005

I am on windows XP and i can't even run hello world.

I've set up the classpath alright (see below) but when I run a program
it doesn't recognise the classname (see below).

I've tried uninstalling/re-installing java with the same result.

I'm running java 1.4.2_05

C:\>type hello.java
public class hello {

public static void main(String[] args)
{
System.out.println("hello world");
System.out.println("hello world");
System.out.println("hello world");
}

}

C:\>javac hello.java

C:\>java hello
Exception in thread "main" java.lang.NoClassDefFoundError: hello

C:\>ver

Microsoft Windows XP [Version 5.1.2600]

C:\>set
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\Registered User\Application Data
classpath=c:\java
CLIENTNAME=Console
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=DGNV5R0J
ComSpec=C:\WINDOWS\system32\cmd.exe
HOME=C:\jbase4\home
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Registered User
JBCGLOBALDIR=C:\jbase4\4.1
JBCRELEASEDIR=C:\jbase4\4.1
JREDIR=C:\jbase4\4.1\jdk\jre
JRELIB=C:\jbase4\4.1\jdk\jre\bin\classic;C:\jbase4\4.1\jdk\jre\lib
LOGONSERVER=\\DGNV5R0J
NAVROOT=C:\jbase4\4.1\jDP
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Path=C:\jbase4\4.1\MinGW\bin;C:\jbase4\4.1\jDP\bin;C:\jbase4\4.1\bin;C:\jbase4\4
..1\jdk\jre\bin\classic;C:\jbase4\4.1\jdk\jre\lib;C:\jbase4\4.1\config;C:\jbase4\
4.1\jdk\jre\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\Progr
am Files\ATI Technologies\ATI Control Panel;C:\Program
Files\Sonic\MyDVD;C:\Prog
ram Files\Common Files\Adaptec
Shared\System;c:\j2sdk1.4.2_05\bin;c:\qb45;c:\bat
ches
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 2 Stepping 7, GenuineIntel
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0207
ProgramFiles=C:\Program Files
PROMPT=$P$G
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOCUME~1\REGIST~1\LOCALS~1\Temp
TMP=C:\DOCUME~1\REGIST~1\LOCALS~1\Temp
USERDOMAIN=DGNV5R0J
USERNAME=Registered User
USERPROFILE=C:\Documents and Settings\Registered User
windir=C:\WINDOWS

C:\>
 
R

Remco de Boer

I am on windows XP and i can't even run hello world.

I've set up the classpath alright (see below) but when I run a program
it doesn't recognise the classname (see below).

<snip/>

Are you sure your classpath is set correctly? It should point to the
location(s) where your classes can be found, not to the location of the
java installation. Try setting it to c:\ or . (the current directory) in
this case.

Regards,
Remco
 
H

Hal Rosser

Why don't you just download JGrasp. Its a Java editor with 1-click compile
and 1-click run.
When you install it - it will locate the Java fila installation and set
itself to work.
Makes programming a little simpler.

I am on windows XP and i can't even run hello world.

I've set up the classpath alright (see below) but when I run a program
it doesn't recognise the classname (see below).

I've tried uninstalling/re-installing java with the same result.

I'm running java 1.4.2_05

C:\>type hello.java
public class hello {

public static void main(String[] args)
{
System.out.println("hello world");
System.out.println("hello world");
System.out.println("hello world");
}

}

C:\>javac hello.java

C:\>java hello
Exception in thread "main" java.lang.NoClassDefFoundError: hello

C:\>ver

Microsoft Windows XP [Version 5.1.2600]

C:\>set
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\Registered User\Application Data
classpath=c:\java
CLIENTNAME=Console
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=DGNV5R0J
ComSpec=C:\WINDOWS\system32\cmd.exe
HOME=C:\jbase4\home
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Registered User
JBCGLOBALDIR=C:\jbase4\4.1
JBCRELEASEDIR=C:\jbase4\4.1
JREDIR=C:\jbase4\4.1\jdk\jre
JRELIB=C:\jbase4\4.1\jdk\jre\bin\classic;C:\jbase4\4.1\jdk\jre\lib
LOGONSERVER=\\DGNV5R0J
NAVROOT=C:\jbase4\4.1\jDP
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Path=C:\jbase4\4.1\MinGW\bin;C:\jbase4\4.1\jDP\bin;C:\jbase4\4.1\bin;C:\jbas
e4\4..1\jdk\jre\bin\classic;C:\jbase4\4.1\jdk\jre\lib;C:\jbase4\4.1\config;C:\jba
se4\4.1\jdk\jre\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\P
rogr
am Files\ATI Technologies\ATI Control Panel;C:\Program
Files\Sonic\MyDVD;C:\Prog
ram Files\Common Files\Adaptec
Shared\System;c:\j2sdk1.4.2_05\bin;c:\qb45;c:\bat
ches
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 2 Stepping 7, GenuineIntel
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0207
ProgramFiles=C:\Program Files
PROMPT=$P$G
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOCUME~1\REGIST~1\LOCALS~1\Temp
TMP=C:\DOCUME~1\REGIST~1\LOCALS~1\Temp
USERDOMAIN=DGNV5R0J
USERNAME=Registered User
USERPROFILE=C:\Documents and Settings\Registered User
windir=C:\WINDOWS

C:\>
 
T

Tor Iver Wilhelmsen

C:\>java hello
Exception in thread "main" java.lang.NoClassDefFoundError: hello

The current dir is not in the default classpath - use

java -classpath . hello

to run it.
 
D

Dale King

Tor said:
The current dir is not in the default classpath - use

Actually the current directory is in the default classpath. The problem
is that Paul overrode the default with a bogus classpath.

Unless you are using an ancient JVM you almost never want to actually
set the class path.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top