S
Stefan Ram
I assume one had written a nice directory lister in Java.
The only problem would be that the user cannot simply write
jdir
but has to write something along the lines of
java -cp shelltools com.example.shellcalls.jdir
in his system text-command shell. Appearingly, jar-files
can be opened in a GUI, but not directly from a text
shell, that is, one has to write
java -jar jdir.jar
, while simply
jdir
can not be used as an abbreviation for »java -jar jdir.jar«.
Now, one might write a C program as a wrapper for that
java -cp shelltools com.example.shellcalls.jdir
. The straightforward solution would be the C statement
system( "C:\Programs\Java\jdk1.6.0\bin\java -cp shell..." );
, but one might need to do some more coding, for
example, to try to lookup JAVA_HOME and use this and so.
After all, this seems to be the way the standard call
javac
has been implemented for a long time: The compiler is
written in Java, but the call uses a native executable
wrapper for this.
So, what I am looking for is some example code for this.
Maybe someone has already published a generic wrapper code
in C or C++ under the GPL to be used in such cases?
The only problem would be that the user cannot simply write
jdir
but has to write something along the lines of
java -cp shelltools com.example.shellcalls.jdir
in his system text-command shell. Appearingly, jar-files
can be opened in a GUI, but not directly from a text
shell, that is, one has to write
java -jar jdir.jar
, while simply
jdir
can not be used as an abbreviation for »java -jar jdir.jar«.
Now, one might write a C program as a wrapper for that
java -cp shelltools com.example.shellcalls.jdir
. The straightforward solution would be the C statement
system( "C:\Programs\Java\jdk1.6.0\bin\java -cp shell..." );
, but one might need to do some more coding, for
example, to try to lookup JAVA_HOME and use this and so.
After all, this seems to be the way the standard call
javac
has been implemented for a long time: The compiler is
written in Java, but the call uses a native executable
wrapper for this.
So, what I am looking for is some example code for this.
Maybe someone has already published a generic wrapper code
in C or C++ under the GPL to be used in such cases?