Installing Java Based Application throws "java.lang.NoClassDefFoundError"
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Installing Java Based Application throws "java.lang.NoClassDefFoundError"
I am in the process of installing the Linux Version of my Java Based ALM Configuration Management Tool on my RedHat 4.0 Linux Box. I have confirmed with the Software Vendor that this is a Supported Distro.
I have downloaded and installed JRE 5 from Sun using the file jre-1_5_0_17-linux-i586-rpm within the directory path /usr/java/jre1.5.0_17/bin
Based of the below:
java version "1.5.0_17"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_17-b04)
Java HotSpot(TM) Client VM (build 1.5.0_17-b04, mixed mode, sharing)
looks like the JRE install went fine.
JDK 5.0 is installed in the directory /usr/java/j2sdk-5. I believe the Classes that came with the JDK install are located at /usr/java/j2sdk-5/lib.
I have set the CLASSPATH Variable to /usr/java/j2sdk-5/lib
I have edited my .bash_profile to include the PATH's too the JRE and the PATH too the Classes.
The Display Variable has been setup to the IP of my box.
Now when I get ready to start the install for my application using ./ from the CLI I receive the error displayed below in Stack Trace.
At this point based of the research that I have performed prior to joining this Forum, this error is thrown when the application thats attempting to load is looking for a Class that it cannot find, or cant load.
-- Based of the error below what Class is my App Looking for?
-- Is it possible that my Classes are not stored in /usr/java/j2sdk-5/lib? If this is the case, then where else could the Classes be located?
Anyhelp, that anyone can provide will be more than appreciated.
Invocation of this Java Application has caused an InvocationTargetException. This application will now exit. (LAX)
at java.lang.Class.forName0(Native Method)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsE ronment.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorIm java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc sorImpl.java:25)
This Application has Unexpectedly Quit: Invocation of this Java Application h caused an InvocationTargetException. This application will now exit. (LAX)
Thanks for the tip! When I obtained the app it was in a .zip format. I used unzip to access the installation files. The install file that I am working with is currently within a .bin format. How exactly can I tell if it is bundled as a Jar file? I do see .jar files on my system but they appear to be all related too the JDK.
On another note, your tip actually pushed into direction of looking directly at the Source code of the .bin installation file to see what it was doing exactly. I saw references to a couple of .jar files within the code and I also saw the following text which I believe will prove useful
Can you please help me make sense of the below. Thx!!
To run this script you will need to have the following:
1) a Java VM installed (however, it will handle a lack of Java nicely).
2) a Java-style properties file having the same name as this script
with the suffix .lax. If this script is appended to the self-extractor, it will look for the properties file in the directory specified by $seLaxPath; otherwise, it will look in the same directory that this script is in.
3) a Java program in the file "lax.jar".
The .lax property file must contain at least the following properties:
1) lax.class.path classpath (do not include the environment variable $CLASSPATH )
2) lax.nl.java.launcher.main.class (main class of LaunchAnywhere Executable)
1) I do not really understand what you mean by "create the file". Which one do you mean?
2) The "main" class refers to the source/binary file that starts the application. It contains a method called "public static void main(String  args)" and the name of that file should coincide with the one that you would use to run the program from the command line. LaunchBootStrap sounds reasonable; as for the other ones, just put the in as well and don't worry; as a rule, having unneeded files on your classpath is not as bad as missing the one that is vital.
NOTE: I recommend that you do not install your application inside the JDK/JRE. If the latter is upgraded, your application will be hosed as well. You can make use of the ext mechanism but often it is a lot more convenient to set up a folder somewhere on your system (typically, in /opt) that will hold the application files. In the latter case, you need to put that directory (and optionally its jar files) on your classpath so that the system can find it.
sorry for not making myself clear. I was referring too the lax.jar file. Will I manually create this file, or should it already reside on the system? If the lax.jar file should already reside on the system then where is the usual locations? I have looked everywhere and I cant seem to locate it. Per the notes in the install script this appears to be a important file. Thx
Yes, that jar file should have been provided as part of the zip file. A jar file contains binary files so it would not make sense for you to create one yourself unless you were creating an extension to the program.
FWIW, a jar file is an archive that extends your filesystem. If you store a jar in, say, opt and it contains a directory called "com", which "contains" a directory called "foo", which contains your main class, then your system will behave as if that main class is in directory /opt/com/foo (Of course, it needs to know about the existence of the jar file, which is the whole point of using a classpath).
Thank You very much for your informative replies. Just to confirm. Are you stating that the lax.jar file is a part of the Java Install, or should I be expecting that this file was included within the zip of the application install that I am attempting to install/configure. As you can see I still have not located it on my file system, so Im trying to confirm if this should have been included in the Java Install, or should it have been extracted from my application install when I initially unzipped it. Thx
You are correct! lax.jar is a file that is included within my install. I have now corrected the problem. This was the cause. I have discovered that all the needed JRE components were bundled within my Software Install. I was attempting to execute the install via SSH over a VPN connection without having Xwindows Installed on the desktop that I was using at home.
Because I was attempting to install using that method, I was getting the reported errors.
The moment I executed the install from a Terminal Client directly on the Box, the GUI Portion launched and I was good to go. At any rate, Thanks for all the useful information and I truly appreciate your efforts. Take care, and I'm sure we will chat again...