On 9/24/98 11:19 PM, Justin Georgeson said:
>1) I can't seem to run any java programs, as simple as a single call to
>System.out.println ("Hello World!")
> java tells me it can't find the class. I have a directory tree
>in my home directory that starts with cs378 and
> in that a folder called Java, and in that each subdirectory has
>the same name as a class: HelloWorld,
> HttpMirror, HttpClient, whatever. In each of those, I have a
><classname>.java file where the class defined
> also has the same .name as the file/folder I call javac
><classname>.java and get a file <classname>.class. So
> far so good, then I call java <classname> and am told "Can't
>find class HelloWorld." I've checked and
> re-checked my CLASSPATH variable to have the root of my source
>code directory tree included
> (/home/pyros/cs378/Java). One tme I managed to get it to say it
>couldn't find some library file (wish I wrote
> it down). I'm using the jdk1.1.6 package from www.blackdown.org.
>They say you don't need a
> CLASSPATH variable, but I have one anyways, doesn't say you
>can't have one.
You got some kinda wrap problem, too...
In order to run Java code, you need to set the CLASSPATH. Don't worry, it
usually only takes a few weeks to figure it out. (Note to Sun:
Environment variables should not be required to run Java wonder-apps.)
There are a few rules to follow when constructing your classpath:
1) JARs need to go directly on the CLASSPATH. Not the directory that
they're in; the full path to the JAR file.
2) To find classes, the JRE (seemingly) converts the package name of the
class into a partial path and then tries to append that to each entry in
your CLASSPATH. For example, if you're trying to execute a class called
org.foo.Bar, then it's going to look for org/foo/Bar.class in each
directory that's on your CLASSPATH.
3) Entries on the CLASSPATH can't have spaces in them (AFAIK).
If any of that is wrong, just shoot me.
Wesley Felter - [EMAIL PROTECTED] - no home page
Could I have been anyone other than me?
---------------------------------------------------------------------------
Send administrative requests to [EMAIL PROTECTED]