I have Java swing application. I want to convert to web base application. What is easiest 开发者_StackOverflow中文版way? Is there any tool available, preferably open source code?
There is a new open source project webswing.org. It is a web server where you deploy your swing application. The application is rendered to html canvas through websockets, so you get the exact same look and feel like on desktop.
AjaxSwing is a run-time tool and needs a server license for commercial use.
You might want to try Mia Transformer -parts of the website are in French-. They change Swing Java code to GWT Java Code and GWT changes it to Javascript and then if you want you can use Google V8 compiler for faster execution. Of course it is not 100%. We are going to try it for a large project and see if it works.
The other link provided to us was SwingWeb. Have not checked it out though.
Will keep you posted. If you come across a workable solution please share.
For a Java programmer the Vaadin framework is very similar to Java Swing.
Architecturally, Vaadin and Swing applications are of course quite different (web vs desktop), but because the UI logic in Vaadin applications is run on the server side (in a JVM), all the Java classes and application logic from Swing applications is typically fully reusable. You can see in the hello-world sample how similar the event-diven programming model is to Swing.
Furthermore, Vaadin effectively hides all the web specific details (html, css, rpc,...) from Java application programmers, making it a familiar and effective tool to convert old Swing applications to modern HTML5 web applications.
There is actually a magic tool you could use to convert desktop apps to web apps: AjaxSwing
But note that it can only convert very simple swing apps. If you use complex renderers, you may not get right results. Also its not free.
You can think about Java Web Start it's not converting the application but you can use your application as web based...
This tool: http://sourceforge.net/projects/j-wings/ is a API compatible replacement for Swing but runs in an servlet engine renders to HTML.
I know this is late but Webswing lets you run Java Swing applictions in your webbrowser.
For the current visitors, Jetbrains has a new open source projector called Projector which can be used to render swing applications in web and they are using this to render their Intellij IDE also.
Below is the excerpt from their github
Projector is a way to run Swing applications without any windowing system and accessing them either locally or remotely.
JetBrains Projector
This project is still in incubator stage. But I have tried using it with their IDE and its working great.
As Vinod mentioned Java Web Start is the easiest way. Another alternative is to convert the application to an Applet that you can run from a web page.
精彩评论