rhbrb
rhbrb

Reputation: 139

Parsing Environment Variables as Arguments in JNLP File

I would like to know if there is a way of passing Windows environment variables as arguments in JNLP files?

I have a JNLP file in which I specify an argument that should be passed to the application's main method. If possible, I would like the argument to take the form %USERPROFILE%/dir/file. However, when I try to execute like this, webstart is taking userprofile as a literal value instead of replacing it with the environment variable.

Upvotes: 2

Views: 1380

Answers (1)

Dave L.
Dave L.

Reputation: 11238

The value of system property user.dir should be equivalent to %USERPROFILE% as an abstract file path. Instead of specifying file as a JNLP program argument, obtain it as follows:

File file = new File(System.getProperty("user.dir"), "dir/file");

Upvotes: 1

Related Questions