Skip to main content
gamedev.net
🔒 Locked

[java] NoClassDefFoundError... need some help

Started by draqza Dec 21, 2001 at 9:51 PM 4 replies 250+ views
Original Post
draqza
draqza
I was planning on trying to work some with the Java 1.4 beta 3 over my Christmas break, particularly with Java2d or GL4Java. However, to test my setup I tried writing a short program that should simply display "Hi" on the screen. Yes, I did this all from a command prompt, including entering the code... I don''t have any IDEs on this computer and didn''t need one for this part anyway.
  
C:\j2sdk1.4.0-beta3\bin>copy con Hi.java
public class Hi
{
public static void main(String[] args)
{
System.out.println("Hi.");
}
}
^Z
        1 file(s) copied

C:\j2sdk1.4.0-beta3\bin>javac Hi.java

C:\j2sdk1.4.0-beta3\bin>java Hi
Exception in thread "main" java.lang.NoClassDefFoundError: Hi
  
I wondered if it might have something to do with my path statement, since the Java installer neglected to add Java directories, but then I remembered it behaves the same way on my system at school, which has all the paths set. -- WNDCLASSEX Reality; ... ... Reality.lpfnWndProc=ComputerGames; ... ... RegisterClassEx(&Reality); Unable to register Reality...what''s wrong? --------- Dan Upton http://0to1.org http://www20.brinkster.com/draqza
WNDCLASSEX Reality;......Reality.lpfnWndProc=ComputerGames;......RegisterClassEx(&Reality);Unable to register Reality...what's wrong?---------Dan Uptonhttp://0to1.orghttp://www20.brinkster.com/draqza
mjacobsca
mjacobsca
Your class is fine. Should compile and run fine. I would agree that it is probably a classpath issue. Make sure your JDK and program directories are in your classpath.
WayfarerX
WayfarerX
Yup, classic classpath prob. make sure you add "." to the end of your classpath, mine for example is:
set classpath=C:\java\classpaths\lonnie;.
the ''.'' on the end adds the current directory.
"There is no reason good should not triumph at least as often as evil. The triumph of anything is a matter of organization. If there are such things as angels, I hope that they're organized along the lines of the mafia." -Kurt Vonnegut
c_wraith
c_wraith
quote:
Original post by mjacobsca
Make sure your JDK and program directories are in your classpath.


No, no no... Make sure your classpath environment variable is NOT set. There should be no classpath environment variable, until you know what you''re doing with it. Having a classpath variable set just causes problems like the OP is having.
WayfarerX
WayfarerX
Heh, bet we're confusing the hell out of you. Check here for classpath info: Windows - Solaris & Linux
To clarify, if you're setting your classpath, make sure the "." is there. If you're not setting it, it will default to the current directory.

"So crucify the ego, before it's far too late. To leave behind this place so negative and blind and cynical, and you will come to find that we are all one mind. Capable of all that's imagined and all conceivable."
- Tool
------------------------------


Edited by - wayfarerx on December 21, 2001 12:47:31 AM
"There is no reason good should not triumph at least as often as evil. The triumph of anything is a matter of organization. If there are such things as angels, I hope that they're organized along the lines of the mafia." -Kurt Vonnegut
draqza
draqza
Thanks... think I''ll go with setting the classpath. Now, just to find them... grr, I hate the computer at my parents'' house.

[ off-topic rant ]
Useless dev system... Celeron, shared memory between RAM and video, WinMe. Grr.
[ /rant ]
WNDCLASSEX Reality;......Reality.lpfnWndProc=ComputerGames;......RegisterClassEx(&Reality);Unable to register Reality...what's wrong?---------Dan Uptonhttp://0to1.orghttp://www20.brinkster.com/draqza

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.