This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Customer Requirements for Developers and have Marcho Behler on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to convert Applet program into an Exe Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to convert Applet program into an Exe " Watch "How to convert Applet program into an Exe " New topic

How to convert Applet program into an Exe

vijayendra sandeep vulligundam

Joined: Jul 29, 2008
Posts: 7
hi All,

I have created a Application in JApplet using swings.When i need to open the application i need to go to CMD and complie the program.I want to convert this application to an exe ,so that i can double click that and make the application to work.
Could you please help me how to convert Applet Program into an Exe?


Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42956
Does it need to be an .exe file? That implies compilation to native code which introduces a number of complications. Would having a double-clickable jar file be sufficient?

It's not hard to keep code that is usable both as an application and an applet if you have a clear separation of the applet-specific stuff and the general GUI stuff. Basically, the application's main class would open a JFrame, and then add the GUI, just like the applet would do with the applet's main panel. If you have anything in the applet's init, start and stop methods, you may need to refactor that into separate methods that are usable both from the applet code and the application code.
vijayendra sandeep vulligundam

Joined: Jul 29, 2008
Posts: 7
Thank you very much for the reply.

I have used Init() method.i have used around 16 tabs which acts as different classes for each i need to convert this who;e application into an exe.I am not aware how to do this?And am new to java..but i have managed to create tabs using swings.

Please help me how to make this into an exe.
I have used jpanel,japplet. and jtabbedpane. i have not used jframes.
Rob Spoor

Joined: Oct 27, 2005
Posts: 20050

Technically a JApplet is just a Container, so you should be able to add it to a JFrame's content pane. You must remember though to call methods like init() manually; the browser / applet viewer isn't around to do it for you.

As a hint for the future: follow Ulf's advice. Put all your actual code inside a subclass of JPanel, then the only thing the (J)Applet has to do is add an instance of that class. If you change to JFrame, the same rules apply: just add an instance to the JFrame.

The only thing that may be problematic is the JMenuBar since that cannot be added to JPanels in the same way as to JFrames and JApplets. However, you can have the panel create the JMenuBar and return a reference to it.

How To Ask Questions How To Answer Questions
Lovelesh Sharma

Joined: Jun 12, 2009
Posts: 3
Hi, I am also having similar kind of problem, I have made an aplication in applet by using jframe & made a subclass clicklistner in which i am using jfilechooser dialog. Now i want to make an exe of this application, kindly help me out in this,
Thanks in advance, i need it very urgently as it is one of the clients requirement.
Rob Spoor

Joined: Oct 27, 2005
Posts: 20050
  30 - a new thread would have been better
subject: How to convert Applet program into an Exe
It's not a secret anymore!