I have a properties file where I'd like to define a file path as a variable and then reference it. This is causing a file not found exception:
test.folder=C:/code/
file={test.folder}File.csv
But this works:
file=C:/code/File.csv
What am I doing wrong?
In JavaScript, we can assign strings to a variable and use concatenation to combine the variable to another string. To concatenate a string, you add a plus sign+ between the strings or string variables you want to connect.
Concatenation is the process of appending one string to the end of another string. You concatenate strings by using the + operator. For string literals and string constants, concatenation occurs at compile time; no run-time concatenation occurs. For string variables, concatenation occurs only at run time.
This should works:
test.folder=C:/code/
file=${test.folder}File.csv
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With