File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I somehow hosed my java environment

 
Tom Purl
Ranch Hand
Posts: 104
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
ClassNotFoundException
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?
Thanks!
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tom Purl
Ranch Hand
Posts: 104
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mentioned that I had run the program without the classpath switch in my original message.
 
Tom Purl
Ranch Hand
Posts: 104
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic