This question looks like very similar to: Concatenating null strings in Java
But my issue is some different.
I want to build an absolute path to a file:
String path = properties.get("path"); // returns /home/myuser/relativepath/ , ends with bar /
String file = currentFile; // currentFile values "file.txt"
String result = path + file; // this results in /home/myuser/relativepath/nullfile.txt
Why is there than 'null' text? That's the reason my application does not work now.
I have review it in Windows and Linux. In Windows it works perfectly. In Linux, I have this issue.
I uploaded properties file and then, edited with vi command. Maybe is this the problem? Shouldn't I use this way to generate an absolute path, and use File.Separator property in Java?
EDIT: I have post my final right answer with detailed steps. I hope it would be useful.
result.String result = path + file;notString result = path + result;see my anwserpathandfileare what the OP says they are), so the OP's problem is obviously something different. Without knowing what the actual problem is, it's a bit difficult to help them solve it (or upvote an answer). In other words, your answer fixes a mistake the OP clearly doesn't have, because such a mistake would cause a compile-time error, not a runtime error as described.