I'm wondering how to load java app from a single exe file, just like
eclipse, in which eclipse.exe file launches all eclipse application
written in java.
Does anyone know how to write such exe file using c or cpp to launch
java app. I hate using .bat files
Andrew Thompson - 06 Jan 2006 07:29 GMT
> I'm wondering how to load java app from a single exe file, just like
> eclipse, in which eclipse.exe file launches all eclipse application
> written in java.
>
> Does anyone know how to write such exe file using c or cpp to launch
> java app. I hate using .bat files
You don't have to.
1) A jar file with a 'main' specified is 'double click launchable'.
2) An app. deployed by JWS makes it even easier for the end user
(start from a desktop icon or program menu).
HTH

Signature
Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew
wensa - 06 Jan 2006 07:36 GMT
Thank you for your information
I knew the first method you just mentioned.
However, I really want to know why eclipse uses a exe file to launch
all the platform, and how to write such a launcher
Andrew Thompson - 06 Jan 2006 07:58 GMT
> ..I really want to know why eclipse uses a exe file to launch
> all the platform, and how to write such a launcher
Maybe you should direct those questions to the people that
wrote it. Their forums are here..
<http://www.eclipse.org/newsgroups/index_all.php>

Signature
Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew
impaler - 06 Jan 2006 09:51 GMT
The only way to do this is to launch the JVM from your C code and give
as parameter the class that contains the main method and from there on
is java.
This is the way eclipse does it.
There is no way of converting a java app into a runnable native app.
Make use of JNI and you can achieve your goal but is platform dependant
check this out and follow the other links too:
http://www.inonit.com/cygwin/jni/invocationApi/launch.html
Regards
Martinez - 06 Jan 2006 10:14 GMT
very good link
Marcin Opaska
wensa - 06 Jan 2006 11:01 GMT
Thanks a lot, this is what I want :)
Martinez - 06 Jan 2006 10:12 GMT
I heard about the programm that rebuild jar file on the exe file or only run
the jar file.
But this programm is payable.
I think that if you know any other language (C, Pascal, VB) you may create
that program.
That languages offer functions to load external programs.
In nearly future I will be nedeed this program too. Please send what you
think over that.
thanks
Marcin Opaska
impaler - 06 Jan 2006 10:27 GMT
There are many apps like this. All they do is bundle the JVM and the
jar into a single file and when you run it it will do the exact same
thing I described earlier.
You won't be able to run a java class file on a machine without a jre.
All the apps out there are packing the JVM and all the dependencies
into a file and that is all. Basically there is the jvm.dll on windows
that will run the rest of the java code and this jvm.dll is loaded from
your C code.
You all may check out sun's very own invocation API at:
http://java.sun.com/j2se/1.4.2/docs/guide/jni/spec/invocation.html
> I think that if you know any other language (C, Pascal, VB) you may create
> that program.
Sun provides the "jni.h" that is a wrapper and contains the helper
methods for marshalling and with it you can achieve the bridge between
jvm and the native code.
You cand write your own in Pascal I presume but it ain't worth it.
impaler - 06 Jan 2006 10:58 GMT
There are many apps like this. All they do is bundle the JVM and the
jar into a single file and when you run it it will do the exact same
thing I described earlier.
You won't be able to run a java class file on a machine without a jre.
All the apps out there are packing the JVM and all the dependencies
into a file and that is all. Basically there is the jvm.dll on windows
that will run the rest of the java code and this jvm.dll is loaded from
your C code.
You all may check out sun's very own invocation API at:
http://java.sun.com/j2se/1.4.2/docs/guide/jni/spec/invocation.html
> I think that if you know any other language (C, Pascal, VB) you may create
> that program.
Sun provides the "jni.h" that is a wrapper and contains the helper
methods for marshalling and with it you can achieve the bridge between
jvm and the native code.
You cand write your own in Pascal I presume but it ain't worth it.
Martinez - 06 Jan 2006 10:58 GMT
See here http://www.excelsior-usa.com/articles/java-to-exe.html
Marcin Opaska
Roedy Green - 06 Jan 2006 16:27 GMT
>I'm wondering how to load java app from a single exe file, just like
>eclipse, in which eclipse.exe file launches all eclipse application
>written in java.
>
>Does anyone know how to write such exe file using c or cpp to launch
>java app. I hate using .bat files
see http://mindprod.com/jgloss/aot.htm
http://mindprod.com/jgloss/jet.html
http://mindprod.com/jgloss/nativecompiler.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.