I want a bash script that reads the java arguments from a file and executes java with them
jvm_arguments=$(cat jvm-args)
exec java $jvm_arguments
The problem is that it does not work very well with this jvm-args file:
-Xms128m -Xmx512m -Dhostname=$(hostname)
The command hostname is not executed and replaced.
How can I get the hostname command executed? so that I get:
exec java -Xms128m -Xmx512m -Dhostname=MyMachine
Thanks.
InetAddress.getLocalHost().getHostName()might be another solution (download.java.net/jdk7/archive/b123/docs/api/java/net/…)