Running my swing program on a browser - java

I'm doing my academic project currently. Its based on swings and awt. I am running it in command prompt. Is there any possibility for me to run it on a browser

In order to run a Java application in a browser, you need to make it (or wrap it) in an Applet. A Swing application is actually usually designed as a desktop application (meaning, standalone). Applets tend to be pretty resource-intensive for your user.

You should create an applet probably, that could run in a browser.
An applet can have GUI part too similar to a desktop GUI app.
The GUI of the applet can be based on Swing or AWT.
See also:
http://docs.oracle.com/javase/7/docs/api/java/applet/Applet.html

Take a look at Java Web Start which will allow you to deploy your application as is without any redevelopment of the code.

The First Suggestion is to use Applets. If that is not confortable for you and if you have a simple Swing application, I would recommend that you look at AjaxSwing
I onced used it on a simple Application and it works.
Webstart is another Way to go. You have Options to take, pick the one that works best for you.

Related

UI for a java lib

I have a java library that generates a report given some simple input parameters. Currently its a console app. I wanted to create an extremely simple UI for this. What is the quickest way to achieve this ? Are there alternatives other than embedding this library in an application server and then creating a web server that will call it to get the results.
If you are using Eclipse, you can use SWT, WindowBuilder plugins.
http://www.eclipse.org/windowbuilder/
http://www.eclipse.org/swt/
Why a web server? Creating simple GUI with Java's swing is simple enough, and it'll allow you to use the library directly.
Another option is to write a simple GUI application that'll run the console application you already have. If you are using Windows I recommend using HTA for the GUI, and WScript.Shell.Run for running the console application. If you are using Linux, you might want to check out node-webkit and use the child_process module for running the console application.

Run netbeans java project in browser

How is it possible, to run netbeans project in the browser?
My project have only one frame, and uses swing. I have no idea, how is it possible, to write an embedded java application, for browsers.
You are looking for Java WebStart , take a look to this tutorial in Enabling Java Web Start in Netbeans.
More information Lesson: Java Web Start
Also you may interested in Applets, Lesson: Java Applets
Consider looking into JApplets, this sounds to be what you are looking for.
Links:
Example
Documentation
I think if you want to launch it in Browser then it is better in Netbeans you chose Java EE project. This you can run in browser and you can create much better GUI than swing by using HTML and CSS. Of course it will be applet based.
Check this tutorial

java desktop app gui in html5/JS

can I create Gui in html5/JS for the desktop java application. If yes, what tools I need and how would I connect GUI with java code?
Possible - but not entirely sure why you'd want to do that.
Your main options would be:
Have the Java application act as a local web server and connect to it with a browser. Would be a wierd design but fairly easy to make it work. It's essentially the same as you would do if you had a remote Java web server so the components are pretty standard - you could use a toolkit like Vaadin for example.
Run JavaScript within a Java hosted environment / embedded browser. Should be possible with Rhino - though I must admit I haven't ever seen this approach used to build a desktop GUI
The first option in particular might make sense if you were considering using the application remotely at some point in the future.
Overall though, I'm still not sure if this is a good idea. The JavaScript web frameworks still aren't IMHO as good as the native Java ones (SWT, Swing or JavaFX) for building local desktop application GUIs.

Code generation between JSP <-> Swing

Is there any tool that can convert already programmed Swing J2SE into JSP J2EE shell?.
Thanks!
No, there is no such tool. Although you might found some attempts to do it, desktop and WEB paradigms are way too different to have a tool that converts between between them properly.
If you absolutely must run your APP on a WEB environment, you might find easier to convert your Swing application into a Web Applet. It's not the same though. An Applet is basically a Swing application running inside a browser. Not a WEB-WEB application.

Rendering a Java application in a browser (without Java installed)

I am researching possible ways to deploy an existing Java Swing application in a browser such that the client would not need to have a Java runtime installed (and "plugged into" the browser).
The application including the UI would need to run on a server, but the GUI should then "somehow" be rendered in a plain vanilla (of course JavaScript-enabled) browser. Performance and scalability are for once not an issue here...
The challenge is to get away with minimal changes or wrappers of the original Swing application.
I am aware of Eclipse RAP that allows something like that and using the SWT_AWT bridge it should then be possible to embed the Swing UI inside an SWT wrapper and render that on a browser.
I wonder, whether there are any other alternatives or approaches that come to mind?
Cheers,
Michael
AjaxSwing (formerly known as WebCream)seems to promise to do exactly that. I have no experience using it myself however.
Slightly related, but probably no direct help: someone has done the same to the GTK 3 UI Toolkit.

Categories