User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 456,605 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,492 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 3965 | Replies: 11
Reply
Join Date: Aug 2004
Location: Louisville Ky
Posts: 15
Reputation: ZEEPLE is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
ZEEPLE ZEEPLE is offline Offline
Newbie Poster

Java Problem with running program

  #1  
Aug 19th, 2004
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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2004
Location: Hanover
Posts: 152
Reputation: cosi is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 1
cosi's Avatar
cosi cosi is offline Offline
Junior Poster

Re: Java Problem with running program

  #2  
Aug 19th, 2004
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
In a world without walls or fences,
What use are Windows and Gates.
Reply With Quote  
Join Date: Aug 2004
Location: Louisville Ky
Posts: 15
Reputation: ZEEPLE is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
ZEEPLE ZEEPLE is offline Offline
Newbie Poster

Re: Java Problem with running program

  #3  
Aug 19th, 2004
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....


Reply With Quote  
Join Date: Aug 2004
Location: Hanover
Posts: 152
Reputation: cosi is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 1
cosi's Avatar
cosi cosi is offline Offline
Junior Poster

Re: Java Problem with running program

  #4  
Aug 19th, 2004
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

Originally Posted by ZEEPLE
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....


In a world without walls or fences,
What use are Windows and Gates.
Reply With Quote  
Join Date: Aug 2004
Location: Louisville Ky
Posts: 15
Reputation: ZEEPLE is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
ZEEPLE ZEEPLE is offline Offline
Newbie Poster

Re: Java Problem with running program

  #5  
Aug 19th, 2004
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\;
Reply With Quote  
Join Date: Aug 2004
Location: Hanover
Posts: 152
Reputation: cosi is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 1
cosi's Avatar
cosi cosi is offline Offline
Junior Poster

Re: Java Problem with running program

  #6  
Aug 20th, 2004
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


Originally Posted by ZEEPLE
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\;
In a world without walls or fences,
What use are Windows and Gates.
Reply With Quote  
Join Date: Aug 2004
Location: Louisville Ky
Posts: 15
Reputation: ZEEPLE is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
ZEEPLE ZEEPLE is offline Offline
Newbie Poster

Re: Java Problem with running program

  #7  
Aug 20th, 2004
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...
Reply With Quote  
Join Date: Aug 2004
Location: Hanover
Posts: 152
Reputation: cosi is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 1
cosi's Avatar
cosi cosi is offline Offline
Junior Poster

Re: Java Problem with running program

  #8  
Aug 20th, 2004
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
In a world without walls or fences,
What use are Windows and Gates.
Reply With Quote  
Join Date: Aug 2004
Location: Louisville Ky
Posts: 15
Reputation: ZEEPLE is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
ZEEPLE ZEEPLE is offline Offline
Newbie Poster

Re: Java Problem with running program

  #9  
Aug 20th, 2004
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..
Attached Images
File Type: jpg dir.jpg (154.9 KB, 2 views)
Reply With Quote  
Join Date: Aug 2004
Location: Hanover
Posts: 152
Reputation: cosi is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 1
cosi's Avatar
cosi cosi is offline Offline
Junior Poster

Re: Java Problem with running program

  #10  
Aug 20th, 2004
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
In a world without walls or fences,
What use are Windows and Gates.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Java Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 7:09 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC