LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 07-07-2003, 08:37 AM   #1
LonAllen
LQ Newbie
 
Registered: Jul 2003
Location: Tampa Bay
Posts: 1

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

<code>
#!/usr/bin/sh
/usr/local/j2sdk-1.4.1_03/bin/java -classpath .:[several necessary jars all separated with colons(]:myApp.jar classToStart

</code>

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 run.sh" (where run.sh is the name of my script) to no avail.


Lon Allen

Last edited by LonAllen; 07-07-2003 at 08:43 AM.
 
  


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
Check if an app is running and if it's not launch this app Coume Linux - General 3 07-28-2008 02:34 AM
help on shell script as a wrapper to launch default programs according to input file daveiro Programming 2 11-24-2005 04:20 PM
running SHell script from java anirudh Programming 2 01-07-2005 07:37 AM
How to use Java in a Shell Script arnneisp Programming 1 07-13-2004 02:18 AM
shell script to compile java czy11421 Programming 4 04-30-2004 09:42 AM


All times are GMT -5. The time now is 01:36 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