Why is the System.getProperty not working in eclipse + Java 8? -


so in run configuration in eclipse, picked main class main.java, in tab "program arguments" put testarg=sample.

in application's main method, a: system.out.println on:

  1. args[0]
  2. system.getproperty("testarg")

the result args[0] testarg=sample, result system.getproperty("testarg") null.

what going on? using java 8 , eclipse kepler.

note:

when put in "vm arguments" box testarg=sample, , error :

error: not find or load main class testarg=sample`

system.getproperty() gets vm arguments specified -d, these typically used configure vm. argument 'program argument'.

see : what's difference between program arguments , vm arguments?

as using eclipse (depending on version); should able specify vm arguments , program arguments run configuration in same place under arguments tab:

  • program arguments - passed args[] main method
  • vm arguments - available through system.getproperty()

enter image description here


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -

jquery - Keeping Kendo Datepicker in min/max range -