J2EE News, Forums, Discussions, Articles, Jobs, Books J2EEWorld.COM
J2EE News, Forums, Blogs, Articles, Books, Jobs
J2EE Careers | Vancouver J2EE Jobs | Sitemap

Search >> 
 Site last updated: Thursday, 24 July 2008
 Home arrow J2EE Weblog arrow How to make exe for our Java Applications?
Main Menu
   Home
   J2EE News
   J2EE Weblog
   J2EE Books
   J2EE articles
   J2EE Web Links
   J2EE FORUM
   J2EE Download
   Newsletter
   About us
Latest News
Testing Portal Web Applications With HttpUnit
IBM vs Microsoft Developer Productivity Study
The J2EE 1.4 Tutorial
Linux file system structures for J2EE developers
Apache Jakarta DBCP Component -- efficient, feature-rich connection pool package
Login Form





Lost Password?
No account yet? Register
SoloSunglasses
SoloSunglasses: buy sunglasses direct from the manufacturer
Most Read Content
Using Oracle Timestamps in Java
IBM Restocks Eclipse Project
Introducing Sun Java Desktop System, Release 2
How to submit file to J2EE server?
Java 2 Enterprise Edition
Polls
What J2EE Application Server do you use?
 
Hit Counter
Visitors: 426113
How to make exe for our Java Applications?
Written by Alexi Jordanov   
Monday, 12 July 2004
Most of users of Windows platform doesn't likes ".bat" files of Java applications and their consoles. They want standard ".exe" with its own icon, tray, services. Everybody knows that the client is right and we as developers have to satisfy all his wishes. Therefore I will share some tips with you and I will teach you how to make our Java applications more attractive. The first thing is to learn how to make exe file with its own icon that will start our main class. The second thing is how to use tray bar of Windows and to allow our Java application to be minimized there, to set its own menu and to receive events back in our java code. The third thing is how to make our Java application to act as normal Windows Service. To follow all these steps we need just one thing - download J2Exe Project which is free tool for noncommercial use. J2Exe contains 4 modules: J2Exe , J2TrayExe, J2WinService , J2TrayWinService.

Download Example

1) Generate standard exe Download J2Exe. Lets suppose that we have starting script "start.bat" and "server.jar" with main class "server.MyServer". Starting script is in "bin" folder, while the "server.jar" is in "lib" folder. We want to replace "start.bat" file with "MyServer.exe" file. The "MyServer.exe" file will reside in "bin" folder too. The starting script looks like this: cd ..\lib java -Djava.compiler=NONE -classpath server.jar server.MyServer parameter1 parameter2. So, start J2Exe. You will see that "Input" is selected. Fill necessary information: Java parameters: -Djava.compiler=NONE -classpath server.jar; Main class: server.MyServer Application parameters: parameter1 parameter2; Working directory: %APP_HOME%/../lib. Then select "Output", choose type of application: "JDK with Console", "JDK with Managed Console" or "JDK without Console", click over icon if you want to specify your own icon, specify where "MyServer.exe" file should be saved including absolute path to "bin" folder. And finally click "Generate". Now you can find generated file and start it.

2) Minimize into tray Download J2TrayExe. Repeat the same actions as with J2Exe and you will receive exe. Console variant has separate button to minimize into tray. The other variants "JDK with Managed Console" and "JDK without Console" will use close button of frame to minimize into tray. Two additional classes - WinTray.java and WinTrayListener.java, are provided to create tray menu and to receive events back in Java code. The class WinTray.java contains static method "main" with an example how to use these two classes. Remember, no additional natives are required.

3) Create Windows service Download J2WinService. Repeat the same actions as with J2Exe. Fill additional information about service - name and discription, service type and start type. Service name: MyServer; Service discription: MyServer Description; Interact with the desktop: checked; Service type: Service that runs in its own process; Start type: Service started on demand or Service started automatically during system startup. To install this service write "MyServer /install" in the command prompt. To uninstall the service write "MyServer /uninstall".

Alexi Jordanov, Project Manager in ProSyst Bulgaria
http://alexiworld.tripod.com
alexiworld@yahoo.com

Last Updated ( Monday, 19 July 2004 )
 
< Prev   Next >
Who's Online

Warning: Invalid argument supplied for foreach() in /home/httpd/vhosts/j2eeworld.com/httpdocs/modules/mod_whosonline.php on line 32
latest topics
+ Free Porn Clips! 91120 FREE PORNO Movies!
+ pac man free video game 56.hi5.com free hostname movie pic p
+ Fuck the sperm
+ * * * FREE PORNO VIDEO * * * - company middlesex title
+ u0bbvr8x7c5ih1gouw86ywl75
+ u0bbvr8x7c5ih1gouw86ywl75
+ zfzigamaoa31tct06m3itz5czd4
+ zfzigamaoa31tct06m3itz5czd4
+ sex in art northern middlesex
+ arourioug
most download
J2Exe (4844)
J2TrayExe (1792)
J2WinService (1598)
HealthXP
HealthXP: Experience the Benefits of Health Innovations