Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

problem running client.jar executable

 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I created two executable jar files in root directory of my assignment: client.jar, server.jar. I include stub classed in client.jar.
I got the following exceptions trying to connect
to the server:

I could run my application without using executable jars. I am wondering what's wrong
with it.
 
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I could run my application without using executable jars.


I had the same problem. This is likely because you forgot to include the subs and/or remote interfaces in your client jar. When you ran your client as a class, it could find the stubs from the classpath, but when you run it from the jar, there is no classpath.
The other thing to make evrything easier is to start rmi from within your application, so that you don't need to set codebase, policy, or security manager.
My client start is as simple as
java -jar client.jar
Eugene.
 
Holmes Wong
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

This is likely because you forgot to include the subs and/or remote interfaces in your client jar. When you ran your client as a class, it could find the stubs from the classpath, but when you run it from the jar, there is no classpath.


I included stubs from server package, and interfaces from db package. About the classpath and executable jars, can you elaborate more on this? This may be the problem I have.


The other thing to make evrything easier is to start rmi from within your application, so that you don't need to set codebase, policy, or security manager.
My client start is as simple as
java -jar client.jar


You mean start rmi using LocateRegistry without using codebase, policy and security manager? I
have a policy file in my root directory, a manifest file for either client or server, and I start rmi in command line before I start server.

I used the same command as you did. I could start my server like this:
java -jar server.jar
but my client crashes with the above exceptions,
even I run it from my assignment root directory
which contains jar files. Whats wrong? Any guidance?
[ July 02, 2002: Message edited by: Holmes Wong ]
 
Holmes Wong
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gosh, I guess several threads are asking this same question. Any expert opinions?
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Holmes Wong, make sure that if you put your stubs and skels inside server.jar you add this to your manifest file when you jar the client jar file.
Class-path: server.jar
Hopefully this was your problem solver.
 
Holmes Wong
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Alex. Thats a great tip, it solved my problem.

Originally posted by Alex Gregory:
Holmes Wong, make sure that if you put your stubs and skels inside server.jar you add this to your manifest file when you jar the client jar file.
Class-path: server.jar
Hopefully this was your problem solver.

 
what if we put solar panels on top of the semi truck trailer? That could power this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic