This code should get the absolute path, append a string from a preferences file and then append ".json" to match the necessary file. I tried using "+" to concatenate strings, but it was giving the same output as the StringBuilder.append()
StringBuilder pt= new StringBuilder(path);
pt.append(System.getProperty("file.separator"));
pt.append("lib");
pt.append(System.getProperty("file.separator"));
pt.append("ling");
pt.append(System.getProperty("file.separator"));
String lingua =PrefManager.getPref("lingua")+("=");
System.out.println(lingua);
pt.append(lingua);
System.out.println("com extensão"+pt.toString());
String file = pt.toString();
System.out.println(file);
System.out.println(file);
Object obj = parser.parse(new FileReader(file));
This is my console output:
=t-br
=om extensão/home/mateus/BrinoBuildScript/Filesx64/lib/ling/pt-br
=home/mateus/BrinoBuildScript/Filesx64/lib/ling/pt-br
=home/mateus/BrinoBuildScript/Filesx64/lib/ling/pt-br
java.io.FileNotFoundException: /home/mateus/BrinoBuildScript/Filesx64/lib/ling/p= (No such file or directory)
How can a variable have three different outputs to console? what should I do to fix this?