LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-14-2010, 07:18 PM   #1
Alexvader
Member
 
Registered: Oct 2009
Location: Japan
Distribution: Arch, Debian, Slackware
Posts: 994

Rep: Reputation: 94
Paths in Java application...


Hi...

So, I have this application called Impact, it is an explicit time integration Finite Elements code written in Java...

http://impact.sourceforge.net/

I untar the pack, and launch the application calling a script, from within the untarred folder,

Code:
alex@iskandhar:~/stuff/Impact$ ls
COPYING                  ImpactClusterServerKill.bat          ImpactGUI_JOGL_OGL_solaris_sparcv9.sh  ImpactGUI_OGL_windows_amd64.bat  Pro.conf      featured.ico
Constraints.properties   ImpactClusterServerKill.sh           ImpactGUI_JOGL_OGL_windows_amd64.bat   ImpactGUI_OGL_windows_i586.bat   README        impact.png
Graph.conf               ImpactClusterTask.bat                ImpactGUI_JOGL_OGL_windows_i586.bat    ImpactOpt.bat                    bin/          interfaces/
Impact.bat               ImpactClusterTask.sh                 ImpactGUI_OGL_linux_amd64.sh*          ImpactOpt.sh                     bin_cluster/  jalopy.xml
Impact.ico               ImpactGUI_JOGL_OGL_linux_amd64.sh    ImpactGUI_OGL_linux_i586.sh            License.txt                      build.xml     lib/
Impact.sh*               ImpactGUI_JOGL_OGL_linux_i586.sh     ImpactGUI_OGL_macosx.sh                Loads.properties                 cluster.png   lib_cluster/
ImpactClusterClient.bat  ImpactGUI_JOGL_OGL_macosx.sh         ImpactGUI_OGL_solaris_amd64.sh         Material.properties              debug.bat     lib_j3d/
ImpactClusterClient.sh   ImpactGUI_JOGL_OGL_solaris_amd64.sh  ImpactGUI_OGL_solaris_i386.sh          Opt.conf                         debug.sh      make.bat
ImpactClusterServer.bat  ImpactGUI_JOGL_OGL_solaris_i386.sh   ImpactGUI_OGL_solaris_sparc.sh         Post.conf                        doc/          src/
ImpactClusterServer.sh   ImpactGUI_JOGL_OGL_solaris_sparc.sh  ImpactGUI_OGL_solaris_sparcv9.sh       Pre.conf                         examples/
alex@iskandhar:~/stuff/Impact$./ImpactGUI_OGL_linux_amd64.sh
This launches a gui which allows me to setup a case, which needs some setup file, tipically some *.in and a mesh file, tipically some *.msh.

Other mode of executuion consists of calling the setup file as argument to Impact.sh script ( CLI execution mode, for g33k5 )


My problem is : I have packed the whole stuff into a Slackware .tgz, that places it in /usr/local/Impact, and placed a calling script in /usr/local/bin ,

Code:
alex@iskandhar:~/stuff/Impact/build# echo '/usr/local/Impact/ImpactGUI_OGL_linux_amd64.sh' > /usr/local/bin/Impact&&chmod +x /usr/local/bin/Impact
Why the heck doesn't it find the java libraries even after i having created the package with makepkg -l y -c n /path/to/package.tgz...?

Code:
Meskimen's Law:
        There's never time to do it right, but there's always time to
do it over.

alex@iskandhar:~$ impact
bash: impact: command not found
alex@iskandhar:~$ Impact
Exception in thread "main" java.lang.NoClassDefFoundError: gui/ImpactGUI
Caused by: java.lang.ClassNotFoundException: gui.ImpactGUI
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: gui.ImpactGUI.  Program will exit.
alex@iskandhar:~$

I decided to hack the ImpactGUI_OGL_linux_amd64.sh script from

Code:
alex@iskandhar:~$ cat /usr/local/Impact/ImpactGUI_OGL_linux_amd64.sh
#!/bin/sh
export LD_LIBRARY_PATH=lib_j3d/linux_amd64
java -Xmx1000m -Xss1m -cp .:bin:doc:lib/jogl.jar:lib/gluegen-rt.jar:lib/patbinfree153.jar:lib_j3d/j3dcore.jar:lib_j3d/j3dutils.jar:lib_j3d/vecmath.jar -Djava.library.path="lib_j3d/linux_amd64" gui.ImpactGUI
to

Code:
alex@iskandhar:~$ cat /usr/local/Impact/ImpactGUI_OGL_linux_amd64.sh
#!/bin/sh
export LD_LIBRARY_PATH=/usr/local/Impactlib_j3d/linux_amd64
java -Xmx1000m -Xss1m -cp .:bin:doc:lib/jogl.jar:lib/gluegen-rt.jar:lib/patbinfree153.jar:lib_j3d/j3dcore.jar:lib_j3d/j3dutils.jar:lib_j3d/vecmath.jar -Djava.library.path="lib_j3d/linux_amd64" gui.ImpactGUI

no avail,


Code:
alex@iskandhar:~$ Impact
Exception in thread "main" java.lang.NoClassDefFoundError: gui/ImpactGUI
Caused by: java.lang.ClassNotFoundException: gui.ImpactGUI
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: gui.ImpactGUI.  Program will exit

even after adding /usr/local/Impact/bin to PATH... won't go...

Can someone please tell me what is wrong here...?

I can run this thing from within its directory... but I do not like messing within the directories of my applications, this is why I sent this to /usr/local, and placed a calling script in /usr/local/bin...

Why can't this go...?

BRGDS

Alex
 
Old 04-14-2010, 08:32 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
What does your calling script look like ?
 
1 members found this post helpful.
Old 04-15-2010, 02:36 AM   #3
timufea
LQ Newbie
 
Registered: Jan 2006
Location: UK
Distribution: Slackware
Posts: 7

Rep: Reputation: Disabled
The NoClassDefFoundError exception is thrown because the class files needed by the application could not be found. These class files are stored in .jar files listed in the '-cp' ("classpath") option on the java command line.

You could modify the '-cp' option in your script to use absolute pathnames for the .jar files, but it's easier to simply have the script change directory:

Code:
#!/bin/sh
cd /usr/local/Impact
export LD_LIBRARY_PATH=lib_j3d/linux_amd64
java -Xmx1000m -Xss1m -cp .:bin:doc:lib/jogl.jar:lib/gluegen-rt.jar:lib/patbinfree153.jar:lib_j3d/j3dcore.jar:lib_j3d/j3dutils.jar:lib_j3d/vecmath.jar -Djava.library.path="lib_j3d/linux_amd64" gui.ImpactGUI
If you prefer to use absolute pathnames, you should note that your modified LD_LIBRARY_PATH is missing a '/' (i.e. it should be /usr/local/Impact/lib_j3d/linux_amd64).
 
1 members found this post helpful.
Old 04-15-2010, 02:32 PM   #4
Alexvader
Member
 
Registered: Oct 2009
Location: Japan
Distribution: Arch, Debian, Slackware
Posts: 994

Original Poster
Rep: Reputation: 94
Quote:
Originally Posted by kbp View Post
What does your calling script look like ?
Hi Kbp

this is it... :

Code:
alex@iskandhar:~$ cat /usr/local/bin/Impact
/usr/local/Impact/ImpactGUI_OGL_linux_amd64.sh
alex@iskandhar:~$ cat /usr/local/Impact/ImpactGUI_OGL_linux_amd64.sh
#!/bin/sh
export LD_LIBRARY_PATH=/usr/local/Impact/lib_j3d/linux_amd64
java -Xmx1000m -Xss1m -cp .:bin:doc:lib/jogl.jar:lib/gluegen-rt.jar:lib/patbinfree153.jar:lib_j3d/j3dcore.jar:lib_j3d/j3dutils.jar:lib_j3d/vecmath.jar -Djava.library.path="lib_j3d/linux_amd64" gui.ImpactGUI
alex@iskandhar:~$
BRGDS

Alex
 
Old 04-15-2010, 02:37 PM   #5
Alexvader
Member
 
Registered: Oct 2009
Location: Japan
Distribution: Arch, Debian, Slackware
Posts: 994

Original Poster
Rep: Reputation: 94
Hi Timufea

Hacked the script to cd into /usr/local/Impact...

seems allright for now...

Thkz

BRGDS


Alex
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
KDE jar MIME is application/zip and not application/java-archive in Ubuntu Intrepid? arobinson74 Linux - Software 2 09-18-2009 11:40 AM
Paths in java MRMadhav Programming 5 12-14-2005 05:16 AM
locating and edition .profile for java paths Madaize Linux - Newbie 1 11-06-2004 11:41 PM
relative/absolute paths in Java djgerbavore Programming 2 10-26-2004 08:01 PM
How do you set up links or paths in LINUX? Mandrake 9.2 Java VM Ygarl Linux - Newbie 4 03-29-2004 03:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:16 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration