File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
JavaRanch » Java Forums » Java » Java in General
Bookmark "System.getProperty trouble" Watch "System.getProperty trouble" New topic
Author

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");
System.out.println(data);
}
}
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: http://aspose.com/file-tools
 
subject: System.getProperty trouble
 
Similar Threads
why System.setProperty donot work?
String h?
string change event
copy to app server
Calling a java object fromn a store procedure no idea how to get it to work