This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

I somehow hosed my java environment

 
Ranch Hand
Posts: 104
  • 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!
 
Sheriff
Posts: 9099
12
  • 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
  • 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
  • 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!
 
There are 29 Knuts in one Sickle, and 17 Sickles make up a Galleon. 42 tiny ads in a knut:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!