Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2005

Tip: Looking for answers? Try searching our database.

HELP!! problem with java installation

Thread view: 
paul_fraser2005@yahoo.co.uk - 07 May 2005 19:41 GMT
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:\>
Remco de Boer - 07 May 2005 20:02 GMT
> 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
Hal Rosser - 07 May 2005 21:25 GMT
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.
>
[quoted text clipped - 45 lines]
> 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
[quoted text clipped - 19 lines]
>
> C:\>
Tor Iver Wilhelmsen - 08 May 2005 07:43 GMT
> 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.
Dale King - 09 May 2005 02:41 GMT
>>C:\>java hello
>>Exception in thread "main" java.lang.NoClassDefFoundError: hello
>
> 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.
Signature

 Dale King

raven - 08 May 2005 12:59 GMT
first set your environment path variable(in autoexec.bat) to point to
the jdk\bin directory, where jdk is the directory where yout
installed jdk 1.4.2_05. If you can't do it i suggest JCreator(.com),
it's automatically configured to detect java directory.

http://www.DevPlug.com --Connecting Developers
Posted from: http://www.devplug.com/ftopic28131.htm
paul_fraser2005@yahoo.co.uk - 08 May 2005 17:18 GMT
Thankyou everyone.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.