-D setProperty OPTION

S

Sem

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
 
A

Alan Krueger

Sem said:
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.
 
M

Mark Jeffcoat

Sem said:
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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top