I'm looking into writing a license wrapper for a small utility application written in c++.
I want the java wrapper to both provide a nice GUI and enforce the license.
I imagine that the application will be encrypted and included in the jar-file.
A cipher to unchrypt it will be created by the wrapper based on conditions in the license (duration / executions whaterver...).
I want to do something like this:
(The first parameter to runtime.exec() on line 13 doesn't work.)
That's not going to happen, because the operating system doesn't allow it. I wish it could myself sometimes, but no.
What you can do is first extract the application to a temporary file, then execute that:
1) This will create a file like C:\Windows\Temp\app1213213.exe (on Windows), or possibly in the user's own temp folder. You can delete the file either when done (when p.waitFor() has returned) using app.delete(), or when the application has finished using app.deleteOnExit().
2) The entire command, including its arguments, goes into the first parameter. The second String argument is for environment variables, in the form name=value, e.g. "PATH=C:\Windows".