You labeled this as a noob question, but even though it is an easy question to ask, it is not an easy thing to answer in java. Java limits this type of evaluation to compile time, so either you need to write your own tool, or use another language. Fortunately, java includes other languages as shown in this question Is there an eval() function in Java?
The accepted answer uses the Javascript engine to evaluate strings. Here's an example combining that answer with your question.
import javax.script.*;
public class Test{
public static void main (String args[]){
String message = System.getProperty("message");
System.out.println(message);
try {
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("JavaScript");
engine.eval("print('" + message + "')");
} catch (Exception e)
{ System.out.println("Exception: " + e.getMessage()); }
}
}
This program gives the following result:
C:\test>java -Dmessage=test Test
test
test
C:\test>java -Dmessage=te\nst Test
te\nst
te
st