Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

-D setProperty OPTION

Thread view: 
Sem - 14 Mar 2007 04:42 GMT
Can you please give me more INFO how am I going to use

-D on command line to compile to add setProperty?

Thank you

-sem
Alan Krueger - 14 Mar 2007 05:35 GMT
> Can you please give me more INFO how am I going to use
> -D on command line to compile to add setProperty?

The Java command-line allows you to specify system properties with the
-D<name>=<value> option.  You can also programmatically set system
properties using the System.setProperty method.

I'm afraid I can't make out what you're asking beyond that, though.
Mark Jeffcoat - 14 Mar 2007 06:31 GMT
> Can you please give me more INFO how am I going to use
>
> -D on command line to compile to add setProperty?

It's used at run time, not compile time.

public class Demo {
   public static void main(String[] args) {
       System.out.println(System.getProperty("foo"));
   }
}

java -Dfoo="meaningful value" Demo

Will print "meaningful value" on stdout.

(If you have a property you want to set at compile time,
you can just write it directly into the program you're
compiling.)

Signature

Mark Jeffcoat
Austin, TX



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.