Set System propery to Null in Java?

You can't set a property to have an actual null value - you can only clear it, like this.

You can't set a property to have an actual null value - you can only clear it, like this: System. ClearProperty("workingDir").

Might be irrelevant, but this works only with JDK 5 or newer – darioo Dec 1 '10 at 11:51.

System.setProperty() is internally implemented using a Properties object, which in turn uses the good old Hashtable. Those hashtables never let you set a null value using theput() method, so it can't really be done that way. Jon Skeet's post has the solution.

You can't do it, as setProperty method throws NullPointerException if any of it's arguments is null. You can put an empty string there and check for it in your unit tests or simply clearProperty, as Jon suggested.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions