Please HELP me with installation - java.lang.noclassdeffounderror:

Please Help! For school we need to install JAVA. I installed JDK 5.0 and id did not work. I got exception in thread "main" java.lang.noclassdeffounderror: hello. I was using Texpad to write, compile, and run it. In short I deleted all JAVA 5.0 using My Computer program removal. I installed JAVA 1.4..2_10 and I am still getting that same error. I want the JAVA 1.4..2_10 to be installed and not JAVA.5.0.

My System Variable CLASSPATH still shows C:\Program Files\Java\jre1.5.0_03\lib\ext\QTJava.zip. My System Variable PATH has nothing as far as JAVA in it. MY PATHEXT has JS and JSE amoung other things in it. My System Variable QTJAVA still has Files\Java\jre1.5.0_03\lib\ext\QTJava.zip in it.

Please tell me step-by-step how I can fix this. I never updated these variables before. What do I need to type and where? What do I need to get rid of or change?

PLEASE HELP!

Thanks,

Jim

[920 byte] By [James_Da] at [2007-10-2 7:58:07]
# 1

Have you tried this?

http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html

It has a section which explains the NoClassDefFound error and has a link for updating the Classpath. In your case, you should add .; to the start of the Classpath variable or better yet, change TextPad so it runs java apps using -classpath .

atmguya at 2007-7-16 21:48:55 > top of Java-index,Desktop,Deploying...
# 2

I am going to changes the class paths after work.

I will replace java5.0 reference with c:\j2sdk1.4.2_10\bin to the "classpath" system variable. Then I will try to replace QTJAVA that is still pointing to JAVA5.0 with something pointing to JAVA 1.4.2_10. Do I need to update the system variable "path" as well?

I will attempt using the System Properties window to make these changes. I am not sure how to replace the JAVA 5.0 references but I will try.

For some reason when I deleted JAVA 5.0 the system variables neither got deleted nor updated when I loaded JAVA 1.4.2_10. Anything I need to do with textpad, and if so, how and what?

I will let you know if that fixed it. Anything else I need to do?

Thanks,

Jim

James_Da at 2007-7-16 21:48:55 > top of Java-index,Desktop,Deploying...
# 3

> I am going to changes the class paths after work.

>

> I will replace java5.0 reference with

> c:\j2sdk1.4.2_10\bin to the "classpath" system

> variable. Then I will try to replace QTJAVA that is

> still pointing to JAVA5.0 with something pointing to

> JAVA 1.4.2_10. Do I need to update the system

> variable "path" as well?

>

Do you still have a file named QTJAVA.zip? This is part of QuickTime and has nothing to do with the SDK. I don't know why QuickTime would install itself in the lib/ext directory, but I guess it would go into the 1.4.2 lib/ext directory.

There is NO REASON to put the 1.4.2 bin directory in the Classpath. NONE. You should put your classes and source code somewhere that makes sense, like c:\myjava.

> I will attempt using the System Properties window to

> make these changes. I am not sure how to replace the

> JAVA 5.0 references but I will try.

>

If you have references to the 5.0 stuff in the registry, then they most likely need to be changed to point to the 1.4.2.

atmguya at 2007-7-16 21:48:55 > top of Java-index,Desktop,Deploying...
# 4

I left my System variable classpath --> C:\Program Files\Java\jre1.5.0_03\lib\ext\QTJava.zip I left my QT JAVA --> C:\Program Files\Java\jre1.5.0_03\lib\ext\QTJava.zip I added Path --> ;C:\j2sdk1.4.2_10\bin and then restarted my computer. I added hello file in C:\j2sdk1.4.2_10\bin and tried to compile it under a new name and it would not compile. it gave me the error below. I was able to compile other java program in my other folder in a different directory. I am still getting the same error messages/ Anything else I should try? IS there anyplace or person I can call who would come and fix this? Something is wrong. This should not be giving me this much trouble. All The Java directions on other websites tell me to do different things. I am so confused... please help.

I get this during the compilenow:

javac: invalid flag: C:\j2sdk1.4.2_10\bin\helloa.txt

Usage: javac <options> <source files>

where possible options include:

-gGenerate all debugging info

-g:noneGenerate no debugging info

-g:{lines,vars,source}Generate only some debugging info

-nowarnGenerate no warnings

-verboseOutput messages about what the compiler is doing

-deprecation Output source locations where deprecated APIs are used

-classpath <path> Specify where to find user class files

-sourcepath <path>Specify where to find input source files

-bootclasspath <path>Override location of bootstrap class files

-extdirs <dirs>Override location of installed extensions

-d <directory>Specify where to place generated class files

-encoding <encoding>Specify character encoding used by source files

-source <release> Provide source compatibility with specified release

-target <release> Generate class files for specific VM version

-help Print a synopsis of standard options

Tool completed with exit code 2

Jim

If you can fix this I will give you 14 points. I hope it is enough. I just want this to work for school.

James_Da at 2007-7-16 21:48:55 > top of Java-index,Desktop,Deploying...
# 5

> I get this during the compilenow:

>

> javac: invalid flag: C:\j2sdk1.4.2_10\bin\helloa.txt

Not sure about your other errors, but this one happens when the source code file extension is not .java. Also, it will be easier to get help here if you follow java naming conventions - you class name should be Helloa or HelloA.

So, change the source code so the class name is Helloa, then save it as Helloa.java. This will eliminate the error message above. If you get a different error, then post it.

atmguya at 2007-7-16 21:48:55 > top of Java-index,Desktop,Deploying...
# 6

I will rename Hello program to something else. I deleted everyhintgand I just loaded JAVA 5.0 since it is being refereced in environment varables. I did not get Java websmart in my start menu though. I am going to then try to compile and run the Hello application using the command prompt. If I can I guess it is test pad that is not set up correctly. Otherwise JAVA JVM got corrupted or something. I will delete and try a different JAVA to dowload.

I will give you 7 points now. If you still help me get it going I will tell you to respond to my other posting to get 7 more.

I really need this to work for school! Please continue helping me.

James_Da at 2007-7-16 21:48:55 > top of Java-index,Desktop,Deploying...
# 7
Sure, I will continue to try to help you. However, if I suggest something like changing the extension of a file name and your respond by re-installing J2SDK 5.0, it may take a while. Please be sure to post full, exact error messages.
atmguya at 2007-7-16 21:48:55 > top of Java-index,Desktop,Deploying...
# 8
Also, it would be worthwhile to get javac and java to work without using TextPad. Or, just use TextPad as a text editor to create .java files. Then use the command prompt to compile and run programs.
atmguya at 2007-7-16 21:48:55 > top of Java-index,Desktop,Deploying...
# 9

Exception in thread "main" java.lang.NoClassDefFoundError: Hello.

Using the command prompt:

c:\>PATH=c:\j2wsdk1.4.2_09\bin

I went to the directory and typed javac Hello.java and it compiled. This program works since I ran it before a while ago. IT complied. Then I try to run it using java Hello and it gave the error above. I don't think JAVA installed right on my computer. installing JAVA 5.0 after unstalling Java 1.4.2 there were some files missing. So I unistalled Java 5.0 and reinstalled JAVA 1.4.2. befor I ran my stuff.

I did this all in the command prompt. I do think Java 1.4.2_10 is installing correctly. How can I check that it is? What should I do now? Should I install the JRE too. I thought just downloading J2SDK1.4.2_10 would be good enough? How can I tell what files are missing?

Jim

James_Da at 2007-7-16 21:48:55 > top of Java-index,Desktop,Deploying...
# 10
For JAVA 1.4.2_10 I don't think my classpath is being set correctly. What do you think? Do you know what I need to type exactly in the environment system variable for JAVA 1.4.2_10?Thanks,Jim
James_Da at 2007-7-16 21:48:55 > top of Java-index,Desktop,Deploying...
# 11

> For JAVA 1.4.2_10 I don't think my classpath is being

> set correctly. What do you think? Do you know what I

> need to type exactly in the environment system

> variable for JAVA 1.4.2_10?

>

You are correct that it is a classpath problem. Try using the command line option. If the Hello.class file is in the current directory, use

java -classpath . Hello

Note the space between -classpath and the dot and between the dot and Hello

atmguya at 2007-7-16 21:48:55 > top of Java-index,Desktop,Deploying...
# 12
I found the problem, I did not have the .; in the classpath. If you want the other points go to Java Forums - Java Installation: Please Help Me.Thanks, Jim
James_Da at 2007-7-16 21:48:55 > top of Java-index,Desktop,Deploying...