IntelliJ Java IDE
The moose likes Swing / AWT / SWT / JFace and the fly likes how can we make a swing application executable for windows? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT / JFace
Reply Bookmark "how can we make a swing application executable for windows?" Watch "how can we make a swing application executable for windows?" New topic
Author

how can we make a swing application executable for windows?

Richa Goyal
Greenhorn

Joined: Aug 26, 2001
Posts: 18
Can an application developed using swings can be made executable?
And is it possible to upload it on an internet server?
Gregg Bolinger
Sheriff

Joined: Jul 11, 2001
Posts: 15040

The best way to make a Swing Application or and JAVA app executable is to use JAR files. java.sun.com has a tutorial on making JAR files.
Currently, there is no solid way of making an EXE out of a group of CLASS files.
Someone may tell you that Symantics IDE allows you to do this, but I have looked at the IDE and have not seen a way.
------------------
Happy Coding,
Gregg Bolinger


My Blog | DZone Articles
John Smith
Ranch Hand

Joined: Jul 20, 2001
Posts: 84
Dare I say it? Microsoft Visual J++...
Vinod Venugopal
Ranch Hand

Joined: Dec 06, 2000
Posts: 148
what about using any of the Java installers that installs ( atmost copy files) & then starts java *...which eventually opens the app ?


- Vinod<br />-------<br />SCJP2
K Glenn
Greenhorn

Joined: Aug 31, 2001
Posts: 2
Is there any way to distrubute my java app so that the end user doesn't have to have a jvm installed?
Just a self contained exe?
Ben Wood
Ranch Hand

Joined: Aug 14, 2001
Posts: 342
Hi,
In the absence of making Windows executables (which detract from the cross-platform nature of Java anyway) I tend to just use a batch file to start my Java apps on Windows, than all you have to do is double click to run it. eg: save following as "myapp.bat" or whatever...

I think it sort of defeats part of the objective to avoid using the Virtual Machine doesn't it? Why not just code in C++ or something platform specific?
regards,
Ben


SCJP 1.4, www.gsi3d.org.uk
K Glenn
Greenhorn

Joined: Aug 31, 2001
Posts: 2
From my experience a lot of windows users have difficulty in running java apps.
I would like the option to distribute without the jvm for windows.
I use Java for it's cross platform abilites for server side applications (write on windows - run on unix) - but I would like platform specific options for desktop applications.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4120

There are currently only three ways of producing an exe ( that I know of... ) :

  • Translation to C/C++ - the Gnu Java compiler works this way. Unfortunately, I think it is for Unix only and doesn't support some of the newer stuff like Swing...
  • Wrapping everything together - Most of the java "compilers" packaged with IDEs work this way. They don't really compile the class... all they do is have a small JVM, add all the classes as resources to it, and have the exe launch the JVM inside it with the classes specified.
  • Other ways - Some other high end ( i.e. really expensive ) Java compilers do other things to get a java executable... unfortunately, most don't put the details of how they accomplish this on their web sites, and are too expensive for me to try out...


  • From my experience a lot of windows users have difficulty in running java apps.


    LOL!!! That's because a lot of windows users are stupid...

    Why not include the JRE with your app? It'll make the download a little bigger, but at least you'll know that the user will have an up-to-date JVM... then just include a .bat file like Ben suggested above for the icon on the desktop to start it up...

    I've heard that InstallShield works pretty good for this type of thing...

    -Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Gregg Bolinger
Sheriff

Joined: Jul 11, 2001
Posts: 15040

Ok, there are a few decent JAVA to Binary converters out there. They are, for the most part, pretty expensive.
Basically, what they do, it compile all the JAVA class files that come with the JDK to a type of DLL. Then they compile your class files to an EXE but take all your library imports and include them as DLL's in the package that you would release and distribute.
As far as I know they work pretty good, but like I said, they aren't cheap.
russ wicks
Greenhorn

Joined: Sep 07, 2001
Posts: 3
Originally posted by K Glenn:
Is there any way to distrubute my java app so that the end user doesn't have to have a jvm installed?
Just a self contained exe?

use installanywhere (www.zerog.com)
Mike Boni
Greenhorn

Joined: Sep 13, 2001
Posts: 3
You don't really have to install the JRE, just include it in a subdirectory with your application.
Then, create a batch file that launches your app using the subdirectory, and includes the -Xbootclasspath variable to specify the location of the system class files.
batch file start command:
./jre/bin/java -Xbootclasspath:./jre/lib/rt.jar <application>
anandh
Greenhorn

Joined: Sep 06, 2001
Posts: 22
Does VisualAge for Java support native compiling?
 
 
subject: how can we make a swing application executable for windows?
 
Threads others viewed
overloading main()
How to Make Executable War File for Web App
Calling executable from an action class
Creating an executable file in NetBeans 6.1
Calling an exe from java
IntelliJ Java IDE