How to load java app from exe binary

W

wensa

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
 
A

Andrew Thompson

wensa said:
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
 
W

wensa

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
 
I

impaler

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
 
M

Martinez

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
 
I

impaler

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.
 
I

impaler

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

Martinez wrote
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top