Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- java.io.FileNotFoundException: file:{localpath}application.jar!BOOT-INFclasses!application.properties (The filename, directory name, or volume label syntax is incorrect)
- username=user
- password=password123
- //get properties
- prop = new Properties();
- InputStream input = null;
- try {
- input = new FileInputStream(f);
- // load a properties file
- prop.load(input);
- } catch (IOException ex) {
- logger.error("Error reading application.properties", ex);
- ex.printStackTrace();
- } finally {
- if (input != null) {
- try {
- input.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- //update properties
- prop.setProperty("TESTSTRING", "testvalue");
- //write to properties file
- OutputStream os = null;
- try{
- File f = new File(Application.class.getClassLoader().getResource("application.properties").getFile());
- os = new FileOutputStream(f);
- prop.store(os, comments);
- }catch(IOException ex){
- logger.error("Error updating application.properties", ex);
- ex.printStackTrace();
- } finally {
- if(os != null){
- try{
- os.close();
- } catch (IOException e){
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement