my dog learned polymorphism*
The moose likes Java in General and the fly likes from .java  to .exe??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "from .java  to .exe???" Watch "from .java  to .exe???" New topic
Author

from .java to .exe???

amer seif el dine
Greenhorn

Joined: Jul 26, 2001
Posts: 16
Hi,
i want to make my java code a self excecutable file without
installimg the jdk or jre on the UserWorkstation.
there are compilers like jet to do this work but need
a license!
is there any way to do this work ?
i asked many and many programmers they didn't give me the
solution.
thank you,
Amer Seif El Dine.
Mo Ibrahim
Greenhorn

Joined: Jul 10, 2001
Posts: 28
I think this might work:
1. Delete all files from c:\temp
2. Copy jre installed dir to your C:\temp
3. Copy your classes dir to c:\ temp as well
4. Write a batch file that will execute your program from c:\temp and put that file there as well
5. Zip c:\temp and convert the zip to self extracting exe.
6. Give the batch file name to execute upon unzip while you are creating self extracting exe.
7. Now, delete all the files from c:\temp except the self extracting exe.
8. Execute the self extracting exe and see if it unzips all the files back as you zipped them and executes the batch file to bring up your program.
Prasanna KumarBP
Greenhorn

Joined: Jul 25, 2001
Posts: 21
if ur not using swing components try using VJ++.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
The power of java is that it is platform independant. The way it stays platform independant is that it is interpreted at the last minute by a JVM that is operating system DEPENDANT. If you try to compile your Java code, it will ONLY work on the operating system that it was compiled for. Well that really dilutes the reason for using Java in the first place. So there is no cheap/free way to do this that I know of.
Do NOT use VJ++. First of all it only works on Windows. Secondly even MicroSoft does not support it any more.
The real question is - what is your big objection to installing a JRE with the application? It is not that big of a deal. Actually in my company we install a JRE with EACH application that we install, even if the user already has a JRE on their machine. That way we can protect the version of JRE that the application is going to use preventing upgrade headaches.
Of course when we bundle our applications, we create a bundle for each target operating system, so that the correct JVM gets installed for the OS.


"JavaRanch, where the deer and the Certified play" - David O'Meara
amer seif el dine
Greenhorn

Joined: Jul 26, 2001
Posts: 16
Well thanks Cindy for your comment,
i will answer to why i am asking about this!
well, First in the company i am working they have windows NT and the java application didn't work with JRE while it works on any other OS.
I don't know wt was the mysterious problem?!!
but wt is more strange it works on JBuilder 4.0 as well with the same OS and same PC!!!
Second using JBuilder, the time to save a file on a shared directory on the network is less 20 or 30 times using JRE on another OS (EX windows 2000).
what was the probelm in your opinion?
thank you again Cindy for your help.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
I use WinNT at my work, and don't have any problem with the JRE. What didn't work?
I would guess whatever is causing the problems with the application is also affecting the performance.
amer seif el dine
Greenhorn

Joined: Jul 26, 2001
Posts: 16
hi Cindy,
I think it is the set classpath in winnt.
how to set the classpath.
i can compile the application, run it from JBuilder but i can't run it from JRE.
javac works but not java command.
i think this is classpath how to set it?
thank you.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
In WinNT, do start/control panel/system/environment/classpath and add the JRE jar files.
Of course I tend to use a variety of versions of Java to play with. So I have a bat file that sets the classpath on the fly (one for each version of java that I have downloaded). When I invoke a DOS session I run the appropriate bat file and I'm set.
When we invoke applications, we use a bat file that sets the correct classpath for that application just before invoking the application.
Ex:
file myApp.bat
_____________________________________________________________
cd \"Program Files"\company\myApp
path = .;C:\"Program Files"\company\myApp;C:\"Program Files"\company\myApp\jre\bin;
"c:\Program Files\company\myApp\jre\bin\java" -classpath .;"c:\Program Files\company\myApp";"c:\Program Files\company\myApp\myApp.jar";"c:\Program Files\company\myApp\deploy.jar";"c:\Program Files\company\myApp\jre\lib\rt.jar";"c:\Program Files\company\myApp\jre\lib\jaws.jar";"c:\Program Files\company\myApp\jre\lib\i18n.jar";"c:\Program Files\company\myApp\classes12.jar";"c:\Program Files\company\myApp\images" myApp.client.myAppDesktop "c:\Program Files\company\myApp\myApp.properties"
------------------------------------
This invokes the myAppDesktop class with an input parameter naming the properties file.
[This message has been edited by Cindy Glass (edited August 20, 2001).]
jasonkosowan
Greenhorn

Joined: Sep 07, 2001
Posts: 25
Well, if you are really hung up on having a .exe file, try wrapping the call to "java MyClass" in a .c or .cpp file. It still requires the JRE to be installed (that you can NEVER change, nor SHOULD you) but you will have a .exe at the end that will call the JVM to run a specific class file.
Note, though, that this is functionally equivalent to a .sh (or for you Windows people) a .bat file. It buys you nothing AND is harder to implement.
shashank bapat
Ranch Hand

Joined: Jul 11, 2001
Posts: 69
Originally posted by jasonkosowan:
Note, though, that this is functionally equivalent to a .sh (or for you Windows people) a .bat file. It buys you nothing AND is harder to implement.

And still u are giving this dumb suggestion because u don't have anything else to do??
[This message has been edited by shashank bapat (edited September 09, 2001).]


-Shashank<BR>MS(CS),BS(CS),SCJP2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: from .java to .exe???
 
Similar Threads
software market at Germany and Czech Republic?
Cleared SCEA5 (1) this morning 68%
How to get the IP Addresses & Net Masks of all the NICs ?
SCJP for work or fun?
Java 5 vs. C#