Hi to all,
first of all, a little introduction.
I decided to create a Java Local Application (JAR file) some time ago, and now it's finished (at least the beta). Later on I decided to migrate the options check outside of the Java code, building a C launcher that checks all the given options and, if they are correct, invokes the JVM using the GNU Unix function execvp(const char*, char *const[]). I chose the C language for its execution speed, and also because checking parameters did not required OO-programming. I also chose a specifically Unix function because I'm a Linux developer, so I wanted to test the application firstly on my system. The code's section looks like this:
1 2
|
char *const arguments[7] = {cmd, option, archive, debugSymbol, sourceFilename, destFilename, (char*) 0};
execValue = execvp(command, arguments);
|
where cmd (and command too) are strings that points to the Java binary, option is the "-jar" option, archive the location of my JAR, debugSymbol enables the Java stack trace, sourceFilename and destFilename are the input (already existent) and output (to be created) files of the JVM.
Problem is, I want to release a Win32 launcher that has the same behaviour of the Unix one, i.e. that it replaces the current executing process area with the one of the new process (JVM), but I don't know what function to use. system() won't work for me, because it will fork a new process, then execute the given command over the newly created process. For the Win32 launcher I intend to use plain C/C++ code, not a demi-interpreted one by .NET.
By the way, the JAR is a simple Universal Turing Machine.
I think I'm going to release the project over SourceForge, but I still haven't. I'll let you know when I'll do it.
Thank you for your help,
Marco