LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-08-2010, 09:36 PM   #1
iDavid
LQ Newbie
 
Registered: Jun 2010
Posts: 2

Rep: Reputation: 0
Java error attempting to run a file which exists in the specified location


Hi, I recently set up a Linux VPS and installed JDK 6u20 on it; I tried running a class and here's the result

Code:
[root@pioneer codeusa]# dir
content  Engine.class  io  model  net  npcs  Server.class  test  util  world
[root@pioneer codeusa]# java Server 43594
Exception in thread "main" java.lang.NoClassDefFoundError: Server (wrong name: net/com/c
odeusa/Server)
The file "Server.class" is in the location I specified - why am I still getting the error?
 
Old 06-08-2010, 11:29 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

1. In your source code, you probably declared your class "Server" to be in package "net.com.codeusa"

2. So that means "Server.class" needs to be inside directory "net/com/codeusa":

Here's a good tutorial:
http://www.jarticles.com/package/package_eng.html

'Hope that helps .. PSM
 
Old 06-09-2010, 11:43 PM   #3
iDavid
LQ Newbie
 
Registered: Jun 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks, but, as you can see, the file "Server.class" is in the directory net/com/codeusa/ as is demonstrated by me having it show the contents of the directory at the beginning of the [code] tag:

Code:
[root@pioneer codeusa]# dir
content  Engine.class  io  model  net  npcs  Server.class  test  util  world
 
Old 06-10-2010, 12:48 PM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Sigh...

1. You need your class here:

MY DIRECTORY/net/com/codeusa/Server.class

2. Then you need to execute your code (run "java") from "MY DIRECTORY"

Please read the link; I think it'll help make things much clearer.

Thanx in advance .. PSM
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird error message while attempting to run Eclipse v3gard Slackware 8 05-24-2013 10:40 PM
file exists but can not run it. xface66 Linux - Newbie 7 12-10-2006 12:27 PM
Unrecoverable Error: execv() error attempting to run powah Red Hat 0 09-06-2006 01:15 PM
Attempting to run mplayer returns with libdv.so.4 error Matt.Ramos Linux - Newbie 6 07-19-2005 06:21 PM
SIOCADDRT: File exists SIOCCADDRT: File Exists Failed to bring up eth0. opsraja Linux - Networking 0 01-10-2005 08:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration