LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-04-2004, 02:23 PM   #1
Travis86
Member
 
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399

Rep: Reputation: 31
I've set the CLASSPATH, but I still get a noClassDefFoundError. (Java)


I'm having trouble with my latest Java project. I've compiled other Java programs before, but I'm using packages in my latest program, and I've never done that before.

First, I set the CLASSPATH to ".:.\view\:.\model\" because I've got other classes in the "view" and "model" directories. (I put backslashes in the classpath because I'm using Windows to do this.)

I can compile all of my files, but when I go to run the program, it says 'Exception in thread "main" java.lang.NoClassDefFoundError: pc' (pc is the name of the main class).

Why won't this work?
 
Old 02-04-2004, 03:12 PM   #2
vous
Member
 
Registered: Mar 2003
Location: Macondo
Distribution: Mandrake 9.1, 10.1, SuSE 8.1 pro, 10.1, Red Hat 8.0/9.0
Posts: 380

Rep: Reputation: 30
Dude, I'm confused... You have a CLASSPATH problem in Windows or in Linux? If it is Linux, send us the output of:

$env

and then the location of the files...we'll have you ready in no time.
 
Old 02-04-2004, 04:42 PM   #3
Travis86
Member
 
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399

Original Poster
Rep: Reputation: 31
Um.... You mean it matters? I thought Java was the same on either platform. So, do you think this is a Windows problem or a Java problem?

And what is $env, anyway? I did a bit of searching on Google and I couldn't find anything about it. I would assume it has something to do with the environment, right?
 
Old 02-04-2004, 06:37 PM   #4
oulevon
Member
 
Registered: Feb 2001
Location: Boston, USA
Distribution: Slackware
Posts: 435

Rep: Reputation: 30
type this at the prompt:

echo $CLASSPATH

and then let us know the output, and where you've installed java, and the path to your packages.
 
Old 02-04-2004, 09:06 PM   #5
Travis86
Member
 
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399

Original Poster
Rep: Reputation: 31
The default value of the CLASSPATH is c:\PJAVA, but I've been overwriting it. I never knew that it had a default value until now. All that is in PJAVA is a file called error.log.

Java is installed in "c:\j2sdk1.4.2_02\".

The classes are in:
c:\WINODWS\Desktop\Travis\Java\window thing\ym\
c:\WINODWS\Desktop\Travis\Java\window thing\ym\view\
c:\WINODWS\Desktop\Travis\Java\window thing\ym\model\
 
Old 02-05-2004, 09:33 AM   #6
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
A couple of other pieces of information may be needed.
  • Which directory are you actually in when you try to execute them?
  • What packages are your classes in, and are they in the same directory structure as the package structure?
  • What are you overwriting CLASSPATH to?
  • What parameters are you passing to Java?

Last edited by deiussum; 02-05-2004 at 09:36 AM.
 
Old 02-05-2004, 10:09 AM   #7
Travis86
Member
 
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399

Original Poster
Rep: Reputation: 31
Which directory are you actually in when you try to execute them?
c:\WINODWS\Desktop\Travis\Java\window thing\ym\

What packages are your classes in, and are they in the same directory structure as the package structure?
pc.class (the main one) is in ym. The classes in .\model\ and .\view\ are members of ym.model and ym.view, respectively.

What are you overwriting CLASSPATH to?
".:.\model\:.\view\"

What parameters are you passing to Java?
none

Hope that sheds some light on the issue.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
how to set java classpath on Redhat 9? antony_csf Programming 9 11-26-2004 06:48 AM
How to set CLASSPATH of java in Linux? vanhelsing Programming 1 08-23-2004 07:16 AM
set classpath in linux(slackware9) for java Manjula.S Linux - Software 1 10-16-2003 03:10 AM
set up path,classpath in linux(slaware9) for java Manjula.S Linux - Software 5 10-07-2003 12:38 AM
How to set classpath for java jolly Linux - Software 3 04-22-2003 11:02 PM


All times are GMT -5. The time now is 12:40 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration