File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
Author

How to convert Applet program into an Exe

vijayendra sandeep vulligundam
Greenhorn

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?


Thanks

Sandeep
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42264
    
  64
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.


Ping & DNS - my free Android networking tools app
vijayendra sandeep vulligundam
Greenhorn

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 tab.now 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
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Lovelesh Sharma
Greenhorn

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
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

http://faq.javaranch.com/java/EaseUp
http://faq.javaranch.com/java/DontWakeTheZombies - a new thread would have been better
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to convert Applet program into an Exe