• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ben Flowers
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 344
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic