-   Linux - Newbie (
-   -   can't launch java app from shell script... (

LonAllen 07-07-2003 08:37 AM

can't launch java app from shell script...
I am a newbie so don't be too rough with me.

I have installed Mandrake 9.1 and j2sdk-1.4.1_03 on my PC. I have been developing a java app with eclipse and can run the app in Linux from the "Run" option in eclipse. I want to start the app outside of eclipse and have packaged the classes into a jar file using ant. I have created a directory in my $HOME to contain a copy of the jar I created and a shell script to start the application. I do not have the entire shell script in front of me but the following should be enough to explain what I have in it.

/usr/local/j2sdk-1.4.1_03/bin/java -classpath .:[several necessary jars all separated with colons(:)]:myApp.jar classToStart


Note that classToStart is contained in the myApp.jar and has a Main method to start the app. If I run this script I get an error message in the shell window that reads:

Exception in thread "main" java.lang.NoClassDefFoundError:classToStart

If I copy the command to start the app to the command line in the shell and execute it the app starts as expected. If I run this in a batch file under Windows (replacing the colons with semicolons) the app starts as expected. I just can't get starting the app from a shell script to work in Linux.

Any help would be greatly appreciated.

PS. I used chmod 755 to change the permissions on the script to executable and have tried launching the script with "/usr/bin/sh" (where is the name of my script) to no avail.

Lon Allen

All times are GMT -5. The time now is 12:42 PM.