× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Yes, but you can't specify the file on the command line.  Well, you sort of can, but in a minute.

First, you could do this somewhere in the bowels of your application, in one of your base classes:

java.io.InputStream props = loader.getResourceAsStream("myProperties.txt");
System.getProperties().load(props);

But that's fraught with peril, as you may overlay system properties.

And in fact, once you've gotten to the point where you have a base class that you can modify, you could just write your own small routine to parse an .ini file and do the system.setProperty.

I'm guessing, though, that you want to just be able to specify a properties file on the command line and have the JVM parse it for you.  And that, sadly, is not an option AFAIK.




On 3/14/2019 3:24 PM, David Gibbs via JAVA400-L wrote:
Folks:

Does anyone know if there is a way to invoke Java code (on the i or not) so that system properties are loaded from a property file instead of the command line?

What I want to do is avoid using -Dproperty=value or PROP((property value)) and just specify a property file that all those system properties would be specified in.

Thanks!

david



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.