Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #23963
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!usenetcore.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Thu, 09 May 2013 10:22:24 -0500 |
| Date | Thu, 09 May 2013 16:22:21 +0100 |
| From | lipska the kat <"nospam at neversurrender dot co dot uk"> |
| Organization | Trollbusters 3 |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Setting a property for System.getProperty() |
| References | <38d76348-f691-439f-b476-50eeb2908c14@googlegroups.com> |
| In-Reply-To | <38d76348-f691-439f-b476-50eeb2908c14@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Message-ID | <LK2dnU_WKrStIhbMnZ2dnUVZ8qSdnZ2d@bt.com> (permalink) |
| Lines | 39 |
| X-Usenet-Provider | http://www.giganews.com |
| X-AuthenticatedUsername | NoAuthUser |
| X-Trace | sv3-skw+pL9D/oPEjdWtpTS4Gflgm8gk5b3QwzcXznSJCMvVdA5IW9XGuTFXdhOIYtizdwBGpmtyQfroUk0!ppMJmzxf7txjnSlBtx6Ard+hJt2bJLAlgPCP6ZhsvDty1lDxxiQRcp2d253PAPfN9jdBBMwcrTA= |
| X-Complaints-To | abuse@btinternet.com |
| X-DMCA-Complaints-To | abuse@btinternet.com |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 2392 |
| Xref | csiph.com comp.lang.java.programmer:23963 |
Show key headers only | View raw
On 09/05/13 15:53, RVic wrote:
> I inherited someones mountain of code wherein they use different idioms and ways of doing things than I typically do.
>
> In one instance, there is a line of code:
>
> System.getProperty("cn.env");
>
> which, depending on what machine it is run on, has properties like "production" or "mirror"
>
> Yet, I think this call, System.getProperty(), calls properties from the actual system, like (System.getProperty("user.home") or System.getProperty("file.separator").
>
> So how can I set this on a particular machine (Ubuntu 12 in this case) for a value for cn.env?
>
> Thanks in advance, RVic
Well of course you can use System.setProperty("myprop", "myval");
Or ...
You can set properties when you start your application using the -D
command line switch.
something like
javac Foo.java
java -Dmyprop=myval Foo
in you code you can access these properties like so
System.getProperty("myprop");
This would return the String "myval"
HTH
lipska
--
Lipska the Kat©: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Setting a property for System.getProperty() RVic <rvince99@hotmail.com> - 2013-05-09 07:53 -0700
Re: Setting a property for System.getProperty() lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-05-09 16:22 +0100
Re: Setting a property for System.getProperty() Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-05-09 11:33 -0400
Re: Setting a property for System.getProperty() RVic <rvince99@hotmail.com> - 2013-05-09 09:01 -0700
Re: Setting a property for System.getProperty() Arne Vajhøj <arne@vajhoej.dk> - 2013-05-09 21:51 -0400
Re: Setting a property for System.getProperty() RVic <rvince99@hotmail.com> - 2013-05-09 09:14 -0700
Re: Setting a property for System.getProperty() markspace <markspace@nospam.nospam> - 2013-05-09 09:48 -0700
Re: Setting a property for System.getProperty() Arne Vajhøj <arne@vajhoej.dk> - 2013-05-09 21:57 -0400
csiph-web