Results 1 to 9 of 9
Thread: java.lang.NoClassDefFoundError
- 01-05-2011, 03:43 PM #1
Member
- Join Date
- Nov 2010
- Posts
- 12
- Rep Power
- 0
java.lang.NoClassDefFoundError
I'm trying to run a program using a batch file, but get this the error message in the command line:
"Exception in thread "main" java.lang.NoClassDefFoundError: tcp/TCPServer
Caused by: java.lang.ClassNotFoundException: tcp.TCPServer
at java.net....blah blah
...Could not find the main class: tcp.TCPServer. Program will exit."
I'm working in windows using eclipse, is this something do to with my settings like the class path or something? I'm bamboozled.
Thanks x
- 01-05-2011, 03:48 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,466
- Rep Power
- 16
Do you have a tcp.TCPServer class?
- 01-05-2011, 04:18 PM #3
Member
- Join Date
- Nov 2010
- Posts
- 12
- Rep Power
- 0
Yes. the class is called TCPServer, and it's in a folder called tcp, since that's the name of the package that TCPServer is part of.
- 01-05-2011, 04:39 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,466
- Rep Power
- 16
Where are you running the java command from?
The directory that contains the tcp directory?
- 01-05-2011, 04:58 PM #5
Member
- Join Date
- Nov 2010
- Posts
- 12
- Rep Power
- 0
Yeah that's right. Not the directory where the TCPServer class itself is, one level up from there, where the tcp folder is, and the tcp folder contains the class
- 01-05-2011, 05:11 PM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,466
- Rep Power
- 16
Hmmm.
What happens if you do something like:
java tcp.TCPServer
to run it?
Rather than using the batch file.
I know you'll get other class def problems, but if it gets past the TCPServer then that means there's a problem in how your batch file is working.
- 01-05-2011, 05:28 PM #7
Member
- Join Date
- Nov 2010
- Posts
- 12
- Rep Power
- 0
I get the same error. That's exactly what my batch file contains anyway so it shouldn't make a difference should it?
My batch file contains:
java tcp.TCPServer 7000
pause
- 01-05-2011, 05:34 PM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,466
- Rep Power
- 16
Try it on the command line directly.
I doubt it'll make a difference, it has to be said, but it might rule out the batch file.
Also, are you sure that the tcp directory contains a TCPServer.class?
It might seem a silly question, but I have seen people try to run the java source code before now.
- 01-05-2011, 05:36 PM #9
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
When people rob a bank they get a penalty; when banks rob people they get a bonus.
Similar Threads
-
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/star/lang/XEventLi
By baktha.thalapathy in forum New To JavaReplies: 5Last Post: 06-02-2010, 01:05 PM -
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/star/lang/XEventLi
By baktha.thalapathy in forum Advanced JavaReplies: 3Last Post: 06-01-2010, 03:01 PM -
java.lang.NoClassDefFoundError
By Psyclone in forum NetBeansReplies: 1Last Post: 02-28-2010, 11:03 PM -
java.lang.NoClassDefFoundError
By AndrewM16921 in forum Java AppletsReplies: 3Last Post: 09-29-2009, 06:54 PM -
java.lang.NoClassDefFoundError
By fred in forum Advanced JavaReplies: 3Last Post: 08-01-2007, 05:00 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks