Advertisement
Guest User

Untitled

a guest
Apr 12th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. java.io.FileNotFoundException: file:{localpath}application.jar!BOOT-INFclasses!application.properties (The filename, directory name, or volume label syntax is incorrect)
  2.  
  3. username=user
  4. password=password123
  5.  
  6. //get properties
  7. prop = new Properties();
  8. InputStream input = null;
  9. try {
  10. input = new FileInputStream(f);
  11. // load a properties file
  12. prop.load(input);
  13. } catch (IOException ex) {
  14. logger.error("Error reading application.properties", ex);
  15. ex.printStackTrace();
  16. } finally {
  17. if (input != null) {
  18. try {
  19. input.close();
  20. } catch (IOException e) {
  21. e.printStackTrace();
  22. }
  23. }
  24. }
  25.  
  26. //update properties
  27. prop.setProperty("TESTSTRING", "testvalue");
  28.  
  29. //write to properties file
  30. OutputStream os = null;
  31. try{
  32. File f = new File(Application.class.getClassLoader().getResource("application.properties").getFile());
  33. os = new FileOutputStream(f);
  34. prop.store(os, comments);
  35. }catch(IOException ex){
  36. logger.error("Error updating application.properties", ex);
  37. ex.printStackTrace();
  38. } finally {
  39. if(os != null){
  40. try{
  41. os.close();
  42. } catch (IOException e){
  43. e.printStackTrace();
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement