LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices

Reply
 
Search this Thread
Old 12-20-2008, 04:25 PM   #1
ConfigMan_08
LQ Newbie
 
Registered: Dec 2008
Posts: 10

Rep: Reputation: 0
Question Installing Java Based Application throws "java.lang.NoClassDefFoundError"


Hello Everyone,

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
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
echo $CLASSPATH
/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.

Launching installer...

Invocation of this Java Application has caused an InvocationTargetException. This application will now exit. (LAX)

Stack Trace:
java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsE ronment.java:68)
at java.awt.Window.init(Window.java:270)
at java.awt.Window.<init>(Window.java:318)
at java.awt.Frame.<init>(Frame.java:419)
at java.awt.Frame.<init>(Frame.java:384)
at com.zerog.ia.installer.LifeCycleManager.g(DashoA8113)
at com.zerog.ia.installer.LifeCycleManager.h(DashoA8113)
at com.zerog.ia.installer.LifeCycleManager.a(DashoA8113)
at com.zerog.ia.installer.Main.main(DashoA8113)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorIm java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.zerog.lax.LAX.launch(DashoA8113)
at com.zerog.lax.LAX.main(DashoA8113)
This Application has Unexpectedly Quit: Invocation of this Java Application h caused an InvocationTargetException. This application will now exit. (LAX)
 
Old 12-20-2008, 08:10 PM   #2
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Is the application bundled as a jar file? If so, you need to place the full path to the jar file (that is including, the jar itself) on your CLASSPATH.
 
Old 12-20-2008, 09:40 PM   #3
ConfigMan_08
LQ Newbie
 
Registered: Dec 2008
Posts: 10

Original Poster
Rep: Reputation: 0
Thumbs up

Hey,

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)
 
Old 12-20-2008, 10:31 PM   #4
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
If I understand correctly, you need to create a properties file and place it in the same
directory as the installer. Here is an example:
http://www.birds.cornell.edu/brp/rav...enLauncher.lax
 
Old 12-20-2008, 11:41 PM   #5
ConfigMan_08
LQ Newbie
 
Registered: Dec 2008
Posts: 10

Original Poster
Rep: Reputation: 0
Hey,

Thanks for the example. It's starting to make more sense to me now. I agree. At this point I still have a couple of questions. The contents of the properties file, is where I become a little hazy:-)

1. To define the lax.class.path I will need to specify a jar file. Based of my instructions I believe the jar file will be lax.jar. Will I create this file? I do not see it on my system at this point.

I am also a bit hazy in regards too

2) lax.nl.java.launcher.main.class (main class of LaunchAnywhere Executable)

For Example

as I see it the property is referring too the class LauncherBootstrap.class the file launcher.properties and the jar appserv-launch.jar.

They all currently reside within the directory /usr/java/j2sdk-5/lib. Now when I go to create the properties file and define the main class of the LaunchAnywhere Executable
The Default is as follows:

"lax.nl.java.launcher.main.class=com.zerog.lax.LAX"

Should I change it too the lax file that I am about to create?

ex. lax.nl.java.launcher.main.class=mksserver.lax
or lax.nl.java.launcher.main.class=LauncherBootstrap.class

As you can probably tell by now, Classes and Jars are bit new to me

Thanks again for your assistance thus far....
 
Old 12-21-2008, 12:23 AM   #6
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
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.

Last edited by jay73; 12-21-2008 at 12:26 AM.
 
Old 12-21-2008, 12:36 AM   #7
ConfigMan_08
LQ Newbie
 
Registered: Dec 2008
Posts: 10

Original Poster
Rep: Reputation: 0
Hey,

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
 
Old 12-21-2008, 12:47 AM   #8
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
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).

Last edited by jay73; 12-21-2008 at 12:50 AM.
 
Old 12-21-2008, 01:47 AM   #9
ConfigMan_08
LQ Newbie
 
Registered: Dec 2008
Posts: 10

Original Poster
Rep: Reputation: 0
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
 
Old 12-21-2008, 02:24 AM   #10
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
lax.jar - to my knowledge - is not a JDK/JRE component so, yes, it assume it should have been bundled with the zip file (or maybe it was a separate download, that is another possibility).
 
Old 12-22-2008, 04:58 PM   #11
ConfigMan_08
LQ Newbie
 
Registered: Dec 2008
Posts: 10

Original Poster
Rep: Reputation: 0
Thumbs up

Hey Jay73,

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...

Happy Holidays
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Signature canonas Linux - Software 3 06-16-2008 04:00 AM
Exception in thread "main" java.lang.NoClassDefFoundError: LinuxNewbie999 Programming 2 03-24-2008 12:12 AM
eclipse "main" java.lang.NoClassDefFoundError: sefaklc Programming 1 10-08-2007 04:35 PM
Exception in thread "main" java.lang.NoClassDefFoundError: Lobais Linux - Software 19 06-23-2004 08:42 AM
Exception in thread "main" java.lang.NoClassDefFoundError: melinda_sayang Programming 2 04-27-2004 11:49 AM


All times are GMT -5. The time now is 09:32 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration