Programming

So I got a JFrame app the other day for a plugin on a program. I found out how to change variable values in a text file without a recompile of the java class. Here it is (I did not include the preliminary java declarations/import classes, but they must also be included as usual).

The var declare portion of app.java file

Static int varName = Integer.parseInt(readData("config.txt", "WindowWidth"));

The config.txt file

WindowWidth = 205

After compiling the java file (cmd “javac app.java”), you will be able to change the initial value of varName by changing the value of WindowWidth in the text file. It works great!!


Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *