File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes I somehow hosed my java environment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "I somehow hosed my java environment" Watch "I somehow hosed my java environment" New topic

I somehow hosed my java environment

Tom Purl
Ranch Hand

Joined: May 24, 2002
Posts: 104
Whenever I try to run a java program on my computer (RedHat 7.3, JDK 1.3), no matter how basic the program is, I get the following error message:
Here's how I try to run the programs:
java Hello
java -cp . Hello
My java environment used to work when I had RedHat 7.1. I guess upgrading screwed something up. I'm able to compile without any problems (apparently).
The one java program that I am able to run is Jython (not a Jython program, the actual Jython interpreter). The shell script that starts the Jython interpreter has an explicit classpath variable, so I'm thinking that something is wrong with my classpath.
However, I looked in my .bash_profile file and the classpath variable looks pretty good. It doesn't reference any .jar files or directories in my /usr/java directory, but I didn't think that I had to.
Does anyone have any guidance?

Tom Purl<br />SCJP 1.4
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
Have you tried running it without specifing the classpath:
java Hello

Compiling depends on path
Running depends on classpath

I'm thinking that by specifying the "-cp ." that you're blocking the JVM from finding any classes other than those in the current directory. If you run with the default, it should be able to find everything it needs.

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Tom Purl
Ranch Hand

Joined: May 24, 2002
Posts: 104
I mentioned that I had run the program without the classpath switch in my original message.
Tom Purl
Ranch Hand

Joined: May 24, 2002
Posts: 104
I finally figured it out. When I upgraded to red hat 7.3, it replaced my "java" program (from jdk1.3) with kaffe. So when I was typing

I was really typing

Aparently, kaffe doesn't have access to the java.lang package by default -- you have to define it in you classpath.
Thanks to everyone that helped!
I agree. Here's the link:
subject: I somehow hosed my java environment
It's not a secret anymore!