Hello,

This may not be the right forum for this but here goes...I am a student and am taking programming classes( JAVA ). It seems that I can compile my programs but cannot run them. My professor said my path was incorrect and gave me the correct path settings. I edited my path and made it exactly the same as the path he showed me. I still get nothing. I have not installed or uninstalled anything within months..What is funny is last year when I started this it ran and compiled fine. Then it would only run applets..now it runs nothing. The funny thing is my professor told me the way my path was nothing should have compiled or ran..After I change it..nothing runs..I tried changing it back to my old path but it still only compiles andwill not run.
I am using j2sdk1.4.1 on winxp servicepack1. The error reads Exception in thread "main" java.lang.NoClassDefFoundError:
My major problem I have a Final project and know way to test my code please help. :sad: :sad:

Tell me where your java installation is located on your hard drive.
it should be a folder something like j2sdk-xxxxx.

Also tell me if there is a folder called bin within j2sdk-xxxxx. Then tell me if there is a program called java.exe in there.

You can also install netbeans or eclipse. IDEs usually do the right thing.

Hope you can get back on your feet soon!


Ed

Hello again,

Thanks for responding so quicky...

C:\j2sdk1.4.1 is where the folder is....
C:\j2sdk1.4.1\bin lies within the C:\j2sdk1.4.1 folder...

and yes...the java.exe is in the bin folder....


:sad: :sad:

Go to where your program is and

try C:\j2sdk1.4.1\bin\java YourProgram
or C:\j2sdk1.4.1\jre\bin\java YourProgram

Let me know what happens and what error you get when you do this.


Ed

Hello again,

Thanks for responding so quicky...

C:\j2sdk1.4.1 is where the folder is....
C:\j2sdk1.4.1\bin lies within the C:\j2sdk1.4.1 folder...

and yes...the java.exe is in the bin folder....


:sad: :sad:

Hello Ed,

Tried your suggestion, but to no avail...Here is my path...do you see anything that could be worng with it....

C:\j2sdk1.4.1;C:\j2sdk1.4.\bin;C:\j2sdk1.4.\jre;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATITechnologies\ATI Control Panel;C:\Program Files\MicrosoftOffice\OFFICE11\Business Contact Manager\IM;C:\Program Files\MicrosoftSQL Server\80\Tools\Binn\;

Hey Zeeple,

What happens when you type what I said? type the whole path I told you and tell me what error message you see. That's the only way I can help you short of paying you a visit ;)


Ed

Hello Ed,

Tried your suggestion, but to no avail...Here is my path...do you see anything that could be worng with it....

C:\j2sdk1.4.1;C:\j2sdk1.4.\bin;C:\j2sdk1.4.\jre;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATITechnologies\ATI Control Panel;C:\Program Files\MicrosoftOffice\OFFICE11\Business Contact Manager\IM;C:\Program Files\MicrosoftSQL Server\80\Tools\Binn\;

I did exactly what you said and this is the error I get.....

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

Like I said it compiles fine...but it cannot find or will not run the class file...

Now in the directory that you ran java, can you tell me what you have there?

do a 'dir' and show me the file listing. also show me the first few lines of that java file that you're trying to run.

also, did you set JAVA_HOME="C:\j2sdk1.4.1"?

Ed

Hey,

Well you lost me with the set JAVA_HOME="c:\j2sdk1.4.1"...where do you do that?
here is a pic of my file listing.

here is a snipit of code that is good I have seen it work...

public class DateTime2 extends Applet
{
private static Date now;  //Date variable


//Add a main method to enable the applet to run as an application
public static void main(String[] args)
{
Frame f = new Frame();  //Create a new frame object


DateTime2 dateTime = new DateTime2();  //Create an instance of DateTime2


//Add the new instance into the frame
f.setLayout(new BorderLayout());
f.add("Center", dateTime);
f.setSize(200,255);
f.setVisible(true);


//An "anonymous" inner class used to close the window
f.addWindowListener( new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
}
);


dateTime.init();  //Call the applet's init method
}  //End of main

Now this is not the DrawHouse code but this does not work either...Now this code functions as an applet and an application. I got this from another forum to learn how to combine the two. It does work at school but not at my home..again it compiles but does not run.. :?: :?:

Please show me the first few lines of your code. It's important. If you have a package ... statement at the top, it could cause you problems if you don't put it in the right place.

So one file at a time Please show me just the first few lines of DrawHouse.


Ed

ED,

Thanks for your help...I got it working..although I am not sure how....

BRYAN

hey zeeple! this is soni even im suffering with d same prblm its 3 mnths i m trying to run my programs if u get d sol. plz mail me at simple_taurean87@yahoo.co.in
thanx
hop v get d ans as soon as possible

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.