From owner-freebsd-java Thu Jan 14 11:49:14 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA26641 for freebsd-java-outgoing; Thu, 14 Jan 1999 11:49:14 -0800 (PST) (envelope-from owner-freebsd-java@FreeBSD.ORG) Received: from picnic.mat.net (picnic.mat.net [206.246.122.117]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA26620 for ; Thu, 14 Jan 1999 11:49:10 -0800 (PST) (envelope-from chuckr@mat.net) Received: from localhost (chuckr@localhost) by picnic.mat.net (8.9.1/8.8.5) with ESMTP id OAA03437; Thu, 14 Jan 1999 14:46:57 -0500 (EST) Date: Thu, 14 Jan 1999 14:46:56 -0500 (EST) From: Chuck Robey To: Todd Mortensen cc: freebsd-java@FreeBSD.ORG Subject: Re: java can't find the classes. In-Reply-To: <000401be3feb$f454b890$4b2219ce@tmortensen.skylink.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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