[CLUE-Tech] NoClassDefFoundError

Joseph Thomas greywolf921 at hotmail.com
Fri Jun 13 22:34:00 MDT 2003


yeah I understand what your saying about packages. but in most cases I am 
not using them since most of my programs are single class files or just 2-3 
class files.

Now, I have 3 Linux boxes and 1 Win machine. On all of them I have java sdk 
installed.

My school laptop is the only pc that I am having troubles with, my other 
machines I can create a simple (or slightly complex) java program, in any 
directory I choose, and compile and run it. I can even copy the .java and 
.class files that wont work from my school laptop to ANY place on my other 
computers and run them fine.

now here is the wierd part, all my other machines dont even have a CLASSPATH 
variable set yet. I only usually set than when I use packages, and I have 
not yet.

keep in mind that all my other machines are running fresh Linux RH installs 
with fresh jdk installs.

I think that I "messed" something up on my laptop, I was just hoping someone 
could tell me how to fix it, otherwise I will have to just wipe the HDD and 
install everything fresh (which will probably be my quickest solution)

But Jeffrey, Thanks for your patience and help! I really appreciate it!


----Original Message Follows----
From: Jeffery Cann <fabian at jefferycann.com>
Reply-To: clue-tech at clue.denver.co.us
To: clue-tech at clue.denver.co.us
Subject: Re: [CLUE-Tech] NoClassDefFoundError
Date: Thu, 12 Jun 2003 22:39:02 -0600

On Thursday 12 June 2003 10:07 pm, Joseph Thomas wrote:
 > So do I have to add every directory that I want to store .java files in 
to
 > my classpath?

The java program only reads class files.  So, you only worry about their
location.  Whether you have to add every directory for your .class files
depends on the structure of your code.  This is why packages are important.

If you have a program (test) with two packages (hello), (goodbye):

$HOME/test/
$HOME/test/hello/
$HOME/test/goodbye/

You would only need to add $HOME/test to your classpath.  The compiler
(because of your package declarations in your java code) will find the hello
and goodbye packages.

 >
 > I dont have to do that under windows, all I have to do is type 'java
 > javafile' and it runs as long as I am in the same directory as that file.

I'm not sure, but I suspect that your $CLASSPATH on windows includes the
current directory (.).  If you did this on linux, you would get the same
result and you could then cd to the location where your .class file is to 
run
your program (provided it's not in a package).

You can do this by:

$ export CLASSPATH=.

Jeff

 >
 >
 >
 >
 > ----Original Message Follows----
 > From: Jeffery Cann <fabian at jefferycann.com>
 > Reply-To: clue-tech at clue.denver.co.us
 > To: clue-tech at clue.denver.co.us
 > Subject: Re: [CLUE-Tech] NoClassDefFoundError
 > Date: Thu, 12 Jun 2003 21:36:27 -0600
 >
 > On Thursday 12 June 2003 09:30 pm, Joseph Thomas wrote:
 >  > I did try that. I am not placing it in any package, I am simply 
placing
 >
 > it
 >
 >  > in a directory called 'test'
 >
 > Then cd to that directory or put $HOME/test in your $CLASSPATH.
 >
 > HTH-
 >   Jeff

--
"Keep yourselves far from every form of exaggerated nationalism, racism and
intolerance."
-- Pope John Paul II
_______________________________________________
CLUE-Tech mailing list
Post messages to: CLUE-Tech at clue.denver.co.us
Unsubscribe or manage your options: 
http://clue.denver.co.us/mailman/listinfo/clue-tech

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail




More information about the clue-tech mailing list