Home > Back-end >  Desktop applications can not normal use of the properties file to read and write data
Desktop applications can not normal use of the properties file to read and write data

Time:10-02

Background:
Doing a desktop application (set the Spring boot environment), involves the TCP connection, I want to in the application is opened automatically enter the IP address and port number (IP address and port number can also change in interface)

As shown in figure:

After the running of the idea, can read and write data from the properties and normal but cannot read and write data after the packaged into a jar, this how to solve? Or what better way to store the IP address and port number?

CodePudding user response:

The read and write an external configuration file (.ini, properties), and 127.0.0.1 is not accessed nodes outside of the machine

CodePudding user response:

Can check the packaging and see if the properties is playing out of the jar in the bag

CodePudding user response:

refer to the second floor squid ing response:
you can check the packaging, check the properties in the jars of typing
yes

CodePudding user response:

 properties. The load (new ClassPathResource (" prop/config. The properties "). GetInputStream ()); 

Tried it on last night, the method can read the properties file in jars, but I don't know how to modify the file

CodePudding user response:

reference 1st floor tianfang response:
, speaking, reading and writing external configuration file (.ini, properties), and 127.0.0.1 is not accessed the machine outside the node
I try to read and write an external configuration file
  • Related