• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

System.getProperty trouble

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Egil, try this:
java -Dpath=optional_parameter Server -Dpath=command_line_argument
System.out.println( System.getProperty("path") );
System.out.println( args[0] );
 
reply
    Bookmark Topic Watch Topic
  • New Topic