• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

from .java to .exe???

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if ur not using swing components try using VJ++.
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
amer seif el dine
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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).]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic