aspose file tools
The moose likes Java in General and the fly likes System.getProperty trouble Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "System.getProperty trouble" Watch "System.getProperty trouble" New topic

System.getProperty trouble

Egil Poma
Ranch Hand

Joined: Nov 23, 2002
Posts: 40
I have this simple program:
public class Server
public static void main(String[] args)
String data;
data = System.getProperty("path");
If I start this program like this:
java Server -Dpath=whatever
It prints out 'null'.
No matter what value i put after '=' it only prints 'null'. Am I doing something wrong here or is it something else?
I'm using jdk 1.4.0_02
[ November 23, 2002: Message edited by: Egil Poma ]
Vin Kris
Ranch Hand

Joined: Jun 17, 2002
Posts: 154
Egil, try this:
java -Dpath=optional_parameter Server -Dpath=command_line_argument
System.out.println( System.getProperty("path") );
System.out.println( args[0] );
I agree. Here's the link:
subject: System.getProperty trouble