• Post Reply Bookmark Topic Watch Topic
  • New Topic

java -D option not getting expected output.  RSS feed

 
Ranch Hand
Posts: 86
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


For the above program if run with "java SysProp -DFontSize=18 os.name java.version appName FontSize" in the output FontSize = 18 is expected but getting FontSize = null.



Please tell me what is wrong with the above
 
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Put the -D option before the name of the class whose main method will be called. Otherwise it is just a parameter, and no property will be set.

Henry
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you are running the code like this :



then the following code will get you correct results.



Cheers,
Nick
http://www.the-tech-talent.com
 
shuba gopal
Ranch Hand
Posts: 86
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry,Nick thanks to your help I got the expected output. Thanks

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!