Jump to content

System.getProperty(Import) doesnt work! plz help!

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
zhok

zhok

    Newbie

  • Members
  • Pip
  • 9 posts
I am trying to import a file to a program using
java -DImport=data.txt App

The problem is when I try to save the data.txt into a string I get an error
Code:
String file = System.getProperty(Import);

Error:
Cannot find symbol
Symbol: Variable Import
Locatin: String file = System.getProperty(Import);

Edited by xXHalfSliceXx, 30 October 2009 - 04:09 PM.


#2
manux

manux

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 234 posts
the correct line is:
String file = System.getProperty("Import","default value");
Java was looking for a variable called Import within the code, getProperty looks for a named variable(as a String).