Fires of Heaven Guild Message Board  

Go Back   Fires of Heaven Guild Message Board > General forums > Development
User Name
Password
ForumSpy Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 09-04-2006, 08:06 PM   #1 (permalink)
Laerazi
Registered User
 
Laerazi's Avatar
 
Join Date: Nov 2004
Location: Earth
Posts: 1,248
-2 Internets
Newb Java Question

Ok, I have an advanced Java course coming up in college, and I haven't programmed in over a year now and I'm a bit rusty. I'm getting stuck on the actual setup, not the code, which is pretty frustrating. I've only had to do this once before, and since then I believe I reformated...

Anyways, I've installed the latest Java runtime environment and development kit updates, and I'm using TextPad as my means of compiling.

I did a pretty basic program from my book :

Code:
public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java Programming"); } }
It compiles fine and everything, but I'm getting this when I try to run it : "Exception in thread "main" java.lang.NoClassDefFoundError: Welcome"

I looked this error up online and I'm getting some reference to changing classpaths for every program. This is definitely NOT how I remember doing it when I programmed previously and I'm having trouble remembering how to get it to compile/run fine without having to alter classpaths every time I create a new program. Do I need to save my files in a particular location or what? This is going to bug me.
Laerazi is offline   Reply With Quote
Old 09-04-2006, 08:23 PM   #2 (permalink)
Zuuljin
So there's this plane on a treadmill...
 
Zuuljin's Avatar
 
Join Date: Jan 2005
Location: Southern California
Posts: 2,932
+5 Internets
Send a message via AIM to Zuuljin
Looks fine to me.

Stop using textpad and go d/l eclipse at www.eclipse.org

It will do you wonders.
Zuuljin is offline   Reply With Quote
Old 09-04-2006, 08:26 PM   #3 (permalink)
Kallian
CHARLIE DON'T SURF!
 
Kallian's Avatar
 
Join Date: Jul 2004
Posts: 778
+0 Internets
Quote:
Originally Posted by Laerazi
Ok, I have an advanced Java course coming up in college, and I haven't programmed in over a year now and I'm a bit rusty. I'm getting stuck on the actual setup, not the code, which is pretty frustrating. I've only had to do this once before, and since then I believe I reformated...

Anyways, I've installed the latest Java runtime environment and development kit updates, and I'm using TextPad as my means of compiling.

I did a pretty basic program from my book :

Code:
public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java Programming"); } }
It compiles fine and everything, but I'm getting this when I try to run it : "Exception in thread "main" java.lang.NoClassDefFoundError: Welcome"

I looked this error up online and I'm getting some reference to changing classpaths for every program. This is definitely NOT how I remember doing it when I programmed previously and I'm having trouble remembering how to get it to compile/run fine without having to alter classpaths every time I create a new program. Do I need to save my files in a particular location or what? This is going to bug me.
I know you probably know, but make sure you name that particular file "Welcome.java". File name has to be the same as the class name.

Also, you might try this at your command prompt:

C:\whatever\> set CLASSPATH=%CLASSPATH%;.;

As for changing classpaths every program, just go add the ".;" part to CLASSPATH in your Environment Variables (My Computer -> Properties -> Advanced (tab) -> Environment Variables button

As for Eclipse, yep it's fucking awesome. You might want to learn the language before you learn the tool, although the almost real-time error reporting saves time.

Last edited by Kallian : 09-04-2006 at 08:33 PM.
Kallian is offline   Reply With Quote
Old 09-04-2006, 08:34 PM   #4 (permalink)
Zuuljin
So there's this plane on a treadmill...
 
Zuuljin's Avatar
 
Join Date: Jan 2005
Location: Southern California
Posts: 2,932
+5 Internets
Send a message via AIM to Zuuljin
The time clipse will save you with its error checking is more then worth it. Just dont get lazy with the . autofinish. =P
Zuuljin is offline   Reply With Quote
Old 09-04-2006, 08:39 PM   #5 (permalink)
Laerazi
Registered User
 
Laerazi's Avatar
 
Join Date: Nov 2004
Location: Earth
Posts: 1,248
-2 Internets
Don't think Eclipse is allowed: jGRASP, Crimson Editor, jEdit, Lite Edit 1.0, Smart Editor, TextPad, TxtPro, UltraEdit are my options.

Regarding setting the class path, isn't there a way to run it straight from TextPad using "Run Java Application"?
Laerazi is offline   Reply With Quote
Old 09-04-2006, 08:42 PM   #6 (permalink)
Zuuljin
So there's this plane on a treadmill...
 
Zuuljin's Avatar
 
Join Date: Jan 2005
Location: Southern California
Posts: 2,932
+5 Internets
Send a message via AIM to Zuuljin
Haha that sucks. Just use it anyways till you get up on your feet, then switch over lol.

I can understand why your teacher wouldnt want you to use it though. Its like learning to do arithmatic, then when your done, your teacher shows you this cool thing called a calculator. =)
Zuuljin is offline   Reply With Quote
Old 09-04-2006, 08:43 PM   #7 (permalink)
Kallian
CHARLIE DON'T SURF!
 
Kallian's Avatar
 
Join Date: Jul 2004
Posts: 778
+0 Internets
Quote:
Originally Posted by Laerazi
Don't think Eclipse is allowed: jGRASP, Crimson Editor, jEdit, Lite Edit 1.0, Smart Editor, TextPad, TxtPro, UltraEdit are my options.

Regarding setting the class path, isn't there a way to run it straight from TextPad using "Run Java Application"?
I've never used TextPad. I'd try adding "." do the CLASSPATH (the current directory). That might fix it.

Also, if you're programming at home, I don't see why you can't use Eclipse. As long as you send just the .java files (when you turn in homework) and no eclipse files (like .classpath), it's not traceable.

Last edited by Kallian : 09-04-2006 at 08:48 PM.
Kallian is offline   Reply With Quote
Old 09-06-2006, 06:29 PM   #8 (permalink)
Laerazi
Registered User
 
Laerazi's Avatar
 
Join Date: Nov 2004
Location: Earth
Posts: 1,248
-2 Internets
Using JGrasp now, and it compiles/runs fine. Not sure what's up with Textpad, but it does seem strange that it's not working, even after setting the correct path in my system's environment variables.
Laerazi is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
uberguilds network



All times are GMT -7. The time now is 06:22 AM.


Powered by vBulletin® Version 3.6.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0 RC6