What is the setProperty method of the System class on Android?

3

In my case I used this way:

System.setProperty("file.encoding", "UTF-8");

Would it be the language ID used?

    
asked by anonymous 24.05.2015 / 20:16

1 answer

3

When you run a program, you "start" a JVM instance and this instance has its own environment variables, some properties being natively initialized (native method initProperties ). In the implementation of System you notice that there is a static Properties , which is the object that contains all the properties of system and is accessible by any application / library running on the instance of JVM .

From the documentation for System.setProperty

  

Sets the system property indicated by the specified key.

That is, this method creates or changes the value of a system property that is shared by all applications / libraries running on the same instance of JVM .

In your case you are resetting the default encoding to be used by the applications / libraries running in the same instance that you are running your application.

Just as a curiosity about coding in the JVM, there are three standard "encodings":

24.05.2015 / 21:06