• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NoClassDefFoundError

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe this could belong in the beginner forum, but I'm not sure - since it contains sockets and what not.
Anyhow, I am working on a server for a little project I am doing. I made a skeleton of it that sends messages from the client back. Of course, when I get it working I will take that out and add some functionality.
It compiled fine and dandy in Netbeans, but when I try to run it via 'java.exe', I get 'Exception in thread "main" java.lang.NoClassDefFoundError'. I researched it a bit but still couldn't find the problem.
Thus, I'm here asking for help.

Any help is greatly appreciated.
// :: Peyton
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Edit: I just re-read your post and saw that you were not running it through the netbeans IDE, so that changes my answer. Make sure that server1.class is in your classpath (try running it and fully qualifying the location of server1.class, ie "java.exe C:\java stuff\server program\server1".

I tried running it using my IDE and it worked fine. I *just* found out right now that NetBeans runs all programs in a certain directory (netbeans/bin) so perhaps this is messing it up? Check out the post here. Also, you could try running it simply using "java server1" when server1.class is in your java classpath. Good luck.
[ February 08, 2004: Message edited by: Donny Nadolny ]
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Donny --
You can't run a Java class by specifying the full path to the .class file. The argument to "java.exe" is the name of a class -- not a filesystem path.
You probably both should read the JavaRanch guide to CLASSPATHs.
I'm moving this to the Beginner's Forum.
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
i have read ur code, but the problem which u have asked for is not related to the code of the program the problem is with the setting of the environment variables of ur Operating System.
If u are using Windows OS than just include the path of the output directory and the source directory both in the CLASS PATH environment variable of autoexec.bat and than restart ur system.
i hope that it works fine after

~Loveen
~L
 
Peyton McCullough
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, okay. I was thinking that you didn't have to worry about CLASSPATH if you specified a full path. But I guess I was wrong.
Thanks for all the help
 
Ew. You guys are ugly with a capital UG. Here, maybe this tiny ad can help:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic