• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

rmi.codebase vs. classpath

 
Dan Myers
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Question1:
I do not understand the posts on rmi.codebase or CLASSPATH and whats the difference.
Question2:
When do i need to use rmi.codebase?
Question3:
Whats wrong on my plan described below (CLASSPATH)?
- I want to packaged two jar files, one for the server, one for the client.
Both jar files contain all classes but
a)server.jar doesnt contain client classes
b)client.jar doesnt contain server classes

For clientstart:
- Before startup, user sets the CLASSPATH to the client.jar
- user starts client
For serverstart:
- Before startup, user sets the CLASSPATH to the server.jar
- user starts server
Comments please ...
 
Nate Johnson
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dan Myers:
Question1:
I do not understand the posts on rmi.codebase or CLASSPATH and whats the difference.
Question2:
When do i need to use rmi.codebase?

When you are doing dynamic loading of your stubs... I did not use that in my project.
Originally posted by Dan Myers:
Question3:
Whats wrong on my plan described below (CLASSPATH)?
- I want to packaged two jar files, one for the server, one for the client.
Both jar files contain all classes but
a)server.jar doesnt contain client classes
b)client.jar doesnt contain server classes

For clientstart:
- Before startup, user sets the CLASSPATH to the client.jar
- user starts client
For serverstart:
- Before startup, user sets the CLASSPATH to the server.jar
- user starts server
Comments please ...

I did not have to set a classpath for anything... just used executable jars and told that accessor to run them from the install directory of my submission.
One note on you packaging above... you client will need to know about your stubs and interfaces so that your RMI stuff will work right, but you probably already knew that... I just couldnt tell if they were included in the client jar
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dan,
To spare yourself a world of grief, do not require the assessor to set the CLASSPATH.
Make sure your executable jars have every class that is required. The only differnce between my two jar files was the manifest file. The main class in the client jar was FBNClient and FBNServer in the server jar. Setting the CLASSPATH is a bad idea because the procedure is as different as OS platforms that Java runs on. How can you possibly cover all the bases? No need to worry about the codebase either. Just keep the command line simple and don't require any environmental setup.
Michael Morris
 
CyJenny Wong
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Michael,
So does it mean that essentially your server.jar & client.jar are exactly the same (i.e. consists of same packages of all classes) and the only difference is the manifest file. Since in my case, I have four different packages namely client, gui, db & server which are under suncertify sub-directory. So how should I make my executable jar file.
 
Dan Myers
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nate and Michael,
thanks for the tip - i will try it the same way as you recommend...
1) No usage of rmi.codebase - i do not need it as i understand now.
2) Package as executable jars
thanks
Dan
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by CyJenny Wong:
So does it mean that essentially your server.jar & client.jar are exactly the same (i.e. consists of same packages of all classes) and the only difference is the manifest file. Since in my case, I have four different packages namely client, gui, db & server which are under suncertify sub-directory. So how should I make my executable jar file.

Exactly the same except for the manifest. You won't lose any points for doing it that way and you won't have to worry if some class may not load on the assessor's machine because his CLASSPATH or working directory was different from yours. As far as make up you should have an executable jar that starts the server and one that starts the client.
Hope this helps,
Michael Morris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic