0

We've developed a Java web application in Eclipse with a Swing GUI, all part of the same Eclipse web application project. We now want to be able to run the application outside an IDE, for example as a WAR or JAR file. We tried to deploy the application as a WAR using Tomcat and accessing it through the browser and the server is running but the GUI doesn't show up, naturally. Is there some way, preferably as simple and fast as possible, to be able to run the web application and at the same time have the GUI appear and be able to interact with it, the same way we did through Eclipse?

6
  • 1
    maybe webswing as an option? I dont't think, that a desktop application can be simply run as a web app Commented Oct 16, 2017 at 13:57
  • Probably you can use Java Web Start Commented Oct 16, 2017 at 14:01
  • I'm not sure a Swing UI can run as a webapp but curious what you find out here Commented Oct 16, 2017 at 14:05
  • See : stackoverflow.com/questions/2261728/… Commented Oct 16, 2017 at 14:21
  • 2
    Possible duplicate of Run a Java application in a web browser Commented Oct 16, 2017 at 14:22

1 Answer 1

1

Thank you all for your help. I've solved the problem simply using embedded Tomcat (an example for using it can be found here(https://devcenter.heroku.com/articles/create-a-java-web-application-using-embedded-tomcat). Instead of running Tomcat separately as a service, I ran it in embedded form within a Swing application to listen to HTTP GET/POST requests.

Sign up to request clarification or add additional context in comments.

5 Comments

are you able to convert your swing GUI application as web based application? . Can you share the steps?
I'm not sure what you mean. If you mean to ask whether I have a systematic method to convert a Swing app to a web based application with a web front end, then no. This was an early server app I wrote (partially at least) where the actual server and a GUI for viewing and manipulating its data were part of the same executable. This is generally probably a bad idea, but this was achieved technically using a third party library that allowed running a tomcat service inside our executable. In this manner, our GUI code could interact directly with the code running the server.
Ok Yaniv. My requirement is , I have a swing desktop application.Is there way to access this desktop application by multiple users through browser?
What you need to do is isolate the internal logic of the swing application to a different application, a web service capable of handling HTTP requests. How you do that exactly can be achieved in several different ways but from what I know, in Java, the best way is to use the Spring framework. As for the frontend, I am a little less proficient in that, but it's a matter of how much time you can and need to devote. If it's a simple non-important app, you can just create a simple HTML page and have it make HTTP requests to your new service behind the scenes.
rewriting the complete app as web app is not recommended here. I need to convert some how like application virtualization.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.