November 2006 Technical Tip – Java: ClassNotFoundException
According to the Java API, the ClassNotFoundException is:
Thrown when an application
tries to load in a class through its string name using:
but no definition for the class with the specified name could be found.
- The forName method in class Class.
- The findSystemClass method in class ClassLoader.
- The loadClass method in ClassLoader.
The ClassNotFoundException may well be due to using a jar file which uses
a more recent version of the JRE than does your IDE. In this article I will
show you how to upgrade the JRE used by your IDE. Specifically, I will show
you how to upgrade the JRE to version 1.5 in Eclipse running under Linux.
- Download the most recent JRE.
- Go to http://java.sun.com.
- Under Popular Downloads, choose Java SE.
- Choose Java Runtime Environment (JRE) 5.0 Update 8.
- Indicate your acceptance of the license agreement.
- Choose Linux self-extracting file jre-1_5_0_08-linux-i586.bin
- I assume you will save to downloads folder.
- Install the JRE.
- Go to Konsole.
- cd downloads
- sh ./jre-1_5_0_08-linux-i586.bin
- Get past the license agreement, then enter yes.
- Tell Eclipse to use the JRE.
- Start Eclipse
- Choose Windows, Preferences, Java, Installed JREs, Add
- JRE Name: jre1.5.0_08
- JRE Home directory: browse to downloads/jre1.5.0_08
- Click the checkbox indicating the (new) JRE is to be used.
That should do it! And as long as we have your attention, we'd like to
remind you that Caliber Data Training provides Java programming
instruction using Eclipse or WSAD, Linux or Windows. Please give us a call.
Go to the articles index.
Written by Bill Qualls. Copyright © 2006 by Caliber Data Training 800.938.1222