aspose file tools*
The moose likes Linux / UNIX and the fly likes cant run java file from command line but works with .sh file?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "cant run java file from command line but works with .sh file??" Watch "cant run java file from command line but works with .sh file??" New topic
Author

cant run java file from command line but works with .sh file??

Ben Flowers
Greenhorn

Joined: Sep 12, 2011
Posts: 17
Hi, basically i am writing an RMI based java application and ive written some scripts to run and comile it.
The compile scipt is:


and to run the server i run the script:


if i type those exact commands in the same order i get an exception and the server fails.
if i run the scripts from the command line i get the same exception
but if i run them from the GUI the server works perfectly.
THIS IS DRIVING ME INSANE. does anyone have a clue why this is happening and how i can fix it??
Thanks,
Ben


the exception i am getting is:
Koen Aerts
Ranch Hand

Joined: Feb 07, 2012
Posts: 344

Looks like perhaps the CLASSPATHs are different from the one on your command line vs the one through the GUI. You could try an "echo $CLASSPATH>/tmp/myfile.txt" just before you execute the "java RMIServerImpl" command (both command line and GUI) and then compare.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16068
    
  21

RMI has special needs. One of them is that the RMI Registry needs to have the application linkage classes within its classpath. That is because the registry is simply an app that listens on a port, receives client requests, and returns the requested linkage to the client. For more details, check in out RMI forum where the experts hang out.

IDEs tend to have sloppy classpaths, since both the development and debug environments exist and overlap, as do multiple applications that might be running at the same time. So the fact that something runs in an IDE doesn't guarantee it will run in the Real World.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cant run java file from command line but works with .sh file??