Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jan 1999 14:46:56 -0500 (EST)
From:      Chuck Robey <chuckr@mat.net>
To:        Todd Mortensen <tmortensen@skylink.net>
Cc:        freebsd-java@FreeBSD.ORG
Subject:   Re: java can't find the classes.  
Message-ID:  <Pine.BSF.4.05.9901141439280.317-100000@picnic.mat.net>
In-Reply-To: <000401be3feb$f454b890$4b2219ce@tmortensen.skylink.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 14 Jan 1999, Todd Mortensen wrote:

> 
> I have been beating my head against the wall with this one.   I have
> installed the jdk from the ports collection of a 2.2.8-stable machine.
> Whenever I try to run any java apps it complains about not being able to
> find a class file of some type.  I have found all the ways of telling it the
> location of the classes.zip file with no luck at all.  Here is a shot of
> what I have set.
> 
> bash-2.02$ which java
> /usr/local/jdk1.1.7/bin/java


Not hard, although maybe not immediately obvious.  First thing, java
regards .zip and .jar files as if they were (in themselves) directories,
so if you want a particular class in something.zip to be found, then the
classpath has to exactly include that something.zip, not just the
directory that something.zip resides in.

Second point is, your code itself has to reside somewhere in the
classpath, and your current directory *isn't* searched by default.
That's the reason that most classpath's begin with ".:" to tell java to
look in your current directory first.  You don't have to use that
method, but your classpath has to include the directory (or zip file, or
jar file) of the code you want to run, AND the classes.zip from the jdk,
AND any other pieces you want to get found.

There's some problem with kaffee being compatible with the Sun jdk, I
don't know what it is, but your CLASSPATH probably ought to be:

.:/usr/local/jdk1.1.7/lib/classes.zip:/usr/home/power/server_classes

Note what I said about zip and jar files being used as if they were
directories, keeping that in mind will simplify things.

> bash-2.02$ echo $CLASSPATH
> /usr/local/jdk1.1.7/lib/classes.zip
> bash-2.02$ cat start
> #!/bin/sh
> java -classpath \
> /usr/local/jdk1.1.7/lib/classes.zip:/usr/home/power/server_classes \
> STServer 10000 9004
> bash-2.02$ ./start
> Unable to initialize threads: cannot find class java/lang/Thread
> 
> I have read that you shouldn't need the $CLASSPATH enviroment set but that
> still give the same result.
> 
> Do I need to unpack the classes.zip file under FreeBSD?

Never do this, NEVER!

> Thanks for any feedback.
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-java" in the body of the message
> 
> 

----------------------------+-----------------------------------------------
Chuck Robey                 | Interests include any kind of voice or data 
chuckr@glue.umd.edu         | communications topic, C programming, and Unix.
213 Lakeside Drive Apt T-1  |
Greenbelt, MD 20770         | I run Journey2 and picnic (FreeBSD-current)
(301) 220-2114              | and jaunt (NetBSD).
----------------------------+-----------------------------------------------





To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9901141439280.317-100000>