Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8585599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:06:20+00:00 2026-06-11T22:06:20+00:00

I need to set the codebase for the RMI application I’m working on at

  • 0

I need to set the codebase for the RMI application I’m working on at the moment and have done this successfully using first

try{
  ResourceBundle config = ResourceBundle.getBundle("myApp");
  String codeBaseUrl = config.getString("codeBaseUrl");
  System.setProperty("java.rmi.server.codebase", codeBaseUrl);
} catch (Exception e) {
  e.printStackTrace();
}

and later using

java -Djava.rmi.server.codebase=http://192.168.1.1/path/to/codebase ...

on the command line.

Both of these approaches allow for the codebase to be changed without the need to recompile, but the System.setProperty approach allows codebase to be bunlded into a properties file and the same launch command to be used.

Most of the tutorials/documentation I’ve read on this uses the -D approach leading me to believe this is accepted as best practice, but I’ve been unable to find anything that explains WHY I should use over the other.

Is -D considered best practice for setting system properties such as codebase, and what benefits does this give / what pitfalls does it avoid?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:06:21+00:00Added an answer on June 11, 2026 at 10:06 pm

    (Edited – I mis-read the question)

    Comparing the two:

    • -D is configurable – it’s specified at runtime
    • A resource bundle via System.setProperty() is still “runtime”, but it’s edited via a file which lives beyond the start-up command

    Firstly, driving flexible behaviour by specifying settings at runtime is always preferable to hard-coding behaviour (unless the behaviour isn’t actually flexible – ie don’t use configuration unless there is value in doing so).

    The main downside to using a file is that it may contain sensitive data, like passwords, that sysadmins don’t want permanently lying around on disk. If the password is entered as part of the start-up command, it’s ephemeral and much more secure (session command history not withstanding).

    The upside to using a file is that you can establish the correct settings and they stay in the file. You can even manage the file via source control.

    There’s another even safer option, which is the have the start-up ask for passwords to be entered on the command line, which leaves no trace.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know I'm not the first to need this. I am working on an
I have a website using asp.net mvc in which I need to embed a
I am trying to do some testing using RMI. I have a .jar file
I have a massive, unfamiliar Java codebase that I need to use in one
I need set to all app ToolTipService.ShowDurationProperty = 10000 this anwser HCL <Style TargetType=Control>
I need to create a persistent Java based application that will run at set
Need set zoom for camera preview...
I need set a cultureinfo different of others in a currency field. Metadata: [Display(ResourceType
I need Set collection, where its items will be identified by items class. Something
Need to set some attributes of button. For example Checked. I guess it is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.