You cannot directly do this. If you want to dynamically modify the configuration information, you can only store it as a file, rather than package it.
Two other methods:
◎ Package properties separately, and thenProgramTo modify the attributes, use Java zip to re-package the properties. Jar. This is not recommended;
◎ Save the modified properties and generate a dedicated file. During loading, use the JAR file first, and then read the dedicated file to overwrite the modified properties.
========================================================== ========================================================
Generally, the properties file is used in the project. If the application is packaged into a jar package, you need to re-create the jar after modifying the properties file, which is very troublesome.
So I mentioned the properties file to the jar package statistics directory, so you don't need to re-package it after modification, which makes it easier to use.
CodeAs follows:
String profilepath = system. getproperty ("user. dir") + "\ filename. properties ";
Inputstream in = new bufferedinputstream (New fileinputstream (profilepath ));
Resourcebundle = new propertyresourcebundle (in );