Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UrlyBird: Codebase file location

 
Dan Pike
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I am having some problems launching my server application due to the location of the codebase file. Basically, my application is launched and packaged using a single .jar file named runme.jar. When this is run using the java -jar command with the parameter "server", it launches the server.

I am trying to set the JVM parameters such as java.security.policy programmatically. I have succcessfully been able to do this for java.security.policy and java.rmi.server.hostname. However, when I try to do this for java.rmi.server.codebase, I am having some issues.

Basically, if I specify the absolute directory of the runme.jar file, using the command:

System.setProperty("java.rmi.server.codebase", "file:/c:/.../runme.jar")

it works fine. If I try to set it using a relative path by using the command:

System.setProperty("java.rmi.server.codebase", "file:/runme.jar")

I receive the error message "java.lang.ClassNotFoundException: suncertify.server.RemoteData_Stub".

I have attempted to retrieve the classpath by printing the command System.getProperty("java.class.path"). When I do this, it only prints runme.jar. I am not sure if this is normal or not but attempting to add additional class paths by adding Class-Path entries to the manifest file does not result in any new paths being displayed.

I am just wondering if someone can help me out in order to run my application without specifying the codebase on the command line as required by the spec.

Thanks Guys!

Dan.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11943
212
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dan,

Welcome to JavaRanch and this forum.

I assume you are going down this path because you are trying to start the rmi registry from the command line, and then trying to connect your server to it.

You might want to look at the java.rmi.registry.LocateRegistry class - in particular the createRegistry method. Using this you can start the registry from within your server application, which means taht your codebase will be automagically correct, and no security policy will be necessary.

Regards, Andrew
 
Daniel Pike
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats great, thanks for your help andrew. I will take a look at this class and see how it goes.

Thanks again!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic