niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » shell
Execution error java prog inside shell script
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
weaselboy1976
*nix forums beginner


Joined: 18 Feb 2005
Posts: 2

PostPosted: Fri Feb 18, 2005 12:52 pm    Post subject: Re: Execution error java prog inside shell script Reply with quote

Martin Caldwell wrote:
Quote:
When I execute a java program from the command line

/test/mypath>java myprog

everything is fine. If I put the same statement into shell script (in
the same directory)
the execution fails with an error

Exception in thread "main" java.lang.NoClassDefFoundError:
/test/mypath/myprog

What's wrong?

Martin

The environment variables aren't passed to your script. Try setting or
exporting PATH and CLASSPATH in your script.
Back to top
Heiner Steven
*nix forums Guru Wannabe


Joined: 19 Feb 2005
Posts: 170

PostPosted: Thu Feb 17, 2005 9:57 pm    Post subject: Re: Execution error java prog inside shell script Reply with quote

Martin Caldwell wrote:
Quote:
When I execute a java program from the command line

/test/mypath>java myprog

everything is fine. If I put the same statement into shell script (in the same directory)
the execution fails with an error

Exception in thread "main" java.lang.NoClassDefFoundError: /test/mypath/myprog

What's wrong?

Maybe your CLASSPATH is set correctly, but not exported (using "export
CLASSPATH")? In this case the current shell had the right settings
for CLASSPATH, but any subshell (e.g. a shell script) would not
get the settings exported, but get e.g. an empty CLASSPATH.

Heiner
--
___ _
/ __| |_ _____ _____ _ _ Heiner STEVEN <heiner.steven@nexgo.de>
\__ \ _/ -_) V / -_) ' \ Shell Script Programmers: visit
|___/\__\___|\_/\___|_||_| http://www.shelldorado.com/
Back to top
Martin Caldwell
*nix forums beginner


Joined: 17 Feb 2005
Posts: 2

PostPosted: Thu Feb 17, 2005 9:36 pm    Post subject: Execution error java prog inside shell script Reply with quote

When I execute a java program from the command line

/test/mypath>java myprog

everything is fine. If I put the same statement into shell script (in the same directory)
the execution fails with an error

Exception in thread "main" java.lang.NoClassDefFoundError: /test/mypath/myprog

What's wrong?

Martin
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 9:43 pm | All times are GMT
navigation Forum index » Programming » shell
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts GIDS 2009 Java:: Save Big, Win Big, Learn Big: Act Before... Shaguf Apache 0 Tue Dec 23, 2008 7:41 am
No new posts Postfix + MySQL error: very strange variable %s iWarior Postfix 0 Mon Aug 25, 2008 2:01 pm
No new posts ** Postfix error on console every minute or so ** ?? drywash Postfix 0 Fri Jul 04, 2008 8:49 pm
No new posts Postfix error bounce diwash Postfix 0 Fri Mar 28, 2008 3:37 am
No new posts I am getting following error in Aix 5.3 rockcharles1 AIX 0 Tue Aug 28, 2007 11:06 pm

Watch Anime Online | Neopets Cheats, Games and Neopoints | Mortgages | Bad Credit Credit Cards | MPAA
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1872s ][ Queries: 20 (0.1141s) ][ GZIP on - Debug on ]