Is there any way of launching Oracle's Java.exe and have it take its command line options from a text file on Windows?
What I'd like to be able to do is something like this:
java.exe -optionsFile=myOptionsFile.txt MyClass
where 'myOptionsFile.txt' contains a list of standard Java VM options such as "-classpath="my very long classpath" and "-Dthis=that" etc.
All of the options must be present when Java.exe is run as it is the target of a memory debugging tool called VMMap. VMMap allows you to launch a .exe and attach to it in order to debug native heap issues. In this case, I cannot generate the command line args at runtime or have another process launch java.exe for me.
You could use
xargs
.Given a file,
arguments.in
, with the following contents:Invoked like so:
Produces this output (i.e. the same output as if you invoked
java -version
):Note: this assumes you are either on a *nix OS or are using Cygwin (or a simulator emulator such as GOW).