• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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

 
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:
 
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.
 
Bartender
Posts: 19731
92
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!