Solved

Java Set up Problem?  ErrorMsg: NoclassDefFoundError

Posted on 2004-09-29
6
366 Views
Last Modified: 2010-03-31
I am trying to set up my laptop for a java course I am taking.  Presumably, all I have to do is download the SDK, and change a few environmental variables, and then I should be able to run my first Hello World program.  

I found that it is not that easy.  I put the SDK on the C: drive.  Then I went to Control Panel, SYSTEM, ADVANCED, ENVIRONMENTAL VARIABLES.  I changed the CLASSPATH to where my classes were, and the PATH so it would look in the bin of the SDK.  Well, I have program that I copied from the book called Address and I know it works on the machines at school.   On my machine, it compiles when I use:
Javac Address.java

But when I try to run it using:

Java Address.class

I get the error message:

Exception in thread "main" java.lang.NoclassDefFoundError Address/class


My instructor said that the problem was in the CLASSPATH variable I was using.  I didn’t think so, but I changed CLASSPATH to ‘c:\j’.   I then put Address.class in the new j folder and got the same result.


One thing I noticed that is strange is that the PATH  “environmental variables for user1“ dialog box displays :

C:\j2sdk1.4.2_05\bin

which is how I set it up.  However, when I go the cmd prompt and type PATH, I get the following:

PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;c:\j2sdk1.4.2_05\bin;C:\JDK1.2.1\BIN;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\
\

When I saw this, I thought, “  Why would duplicate paths be there and  how do I get rid of them?”  That is puzzling enough, but that doesn’t answer the question, “Why won’t my Java programs run?”

Bah! I knew I should have stuck to VB.


Question 1.
Do you have any idea how I can fix the Java problem?

Question 2.
How do I fix the PATH problem?




Thanks for listening.
0
Comment
Question by:wiz2001
  • 2
  • 2
  • 2
6 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 12180326
See the "Installation Instructions" at http://java.sun.com/j2se/1.4.2/install-windows.html
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12180361
0
 
LVL 35

Accepted Solution

by:
TimYates earned 100 total points
ID: 12180451
java Address

not

java Address.class

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12180490
Tim,

you cantch the point ;)
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12180500
*cantch =catch ;-)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12180526
:-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java Timer (static) 9 36
Apps blocked by Java 9 64
Windows 10 IE Certificate Issue 10 42
type mismatch (Object[] to double[] 4 10
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now