Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Build "Win-tuitive" Java Applications

You can make your cross-platform Java application more intuitive for Windows users. Learn how enabling access to the tray bar and programming your application to act as a Windows Service provides this functionality.


advertisement

WEBINAR: On-Demand

Unleash Your DevOps Strategy by Synchronizing Application and Database Changes REGISTER >

he ability to run Java applications on Windows is a clear demonstration of the language's interoperability, but it also has its drawbacks from the user's perspective. Since most Windows users regularly employ executable (.exe) files in their applications, they are not accustomed to—nor particularly fond of—using the bat files in Java applications. Besides, .bat files are ugly—they don't even have their own icons like .exe files do. On top of that, Java applications on Windows don't have access to the tray bar and users can't start them as Windows Services.

Of course, a Java developer can use JNI to provide access to the tray bar, but he or she would have to write C code every time such a feature is required. Wouldn't solving the problem once for all Java applications be better? As for the Windows Service shortcoming, a general service that starts or stops the Java application would solve that. However, this is not the best solution either. Because the service and the Java application each has its own security privileges, a simple logoff could destroy the application while the service continues to work.

This article introduces J2Exe, a free tool for noncommercial use that offers a solution for the drawbacks associated with Java applications on Windows. By using J2Exe, the Java developer can:

  • Make an .exe file (with its own icon) that will start his or her main class.
  • Enable use of the Windows tray bar and minimize the Java application.
  • Set the tray menu to receive events back in Java code.
  • Make the Java application a Windows Service.



How's It Do That?
Under the hood, the J2Exe tool contains four modules:

  • J2Exe
  • J2TrayExe
  • J2WinService
  • J2TrayWinService

Each one is independent of the others. The J2Exe module makes standard .exe files, while the others make .exe files that either operate with the tray bar or act as Window Services. Download J2Exe and its accompanying example to follow along with this tutorial, which demonstrates how to use the tool.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date