I am developing a JavaFX application. As my development is almost complete, I would like to know if we can run our JavaFX app in a web browser. I have already read many posts that state that we can't run it now.
It is very confusing to determine whether we can run desktop application in the browser or not, as all posts I have read are old.
What has been said so far is simply not true. You can run JavaFX application in a browser even without any plugin or such. Just have a look here: https://www.jpro.one/
Just look at their demo page https://www.jpro.one/?page=demos to see many well known JavaFX examples. You can try them out yourself there.
You can also compile it to javascript a la GWT using webfx-project (https://github.com/webfx-project/webfx).
The result is a single-page webapp (only HTML + javascript) running in the browser. And by the looks of the demos the result is exactly as the original JavaFX application.
If you develop using swing, then i recommend trying https://www.webswing.org
Related
I have created a Swing application in Netbeans that is basically a chat system (between multiple clients and server using socket programming).
Now I wanted to run this application on a webpage. Is this possible without changing any code?
Now I wanted to run this application on a webpage. Is this possible without changing any code?
No. It would have to be a JApplet to be embedded in a web page, and applets have been effectively killed off. See Java Plugin support deprecated and Moving to a Plugin-Free Web.
On the other hand, a desktop application (based on a JFrame) can be launched from a link on a web page using Java Web Start.
Edit
Scrap that advice regarding JWS, apparently it too is being deprecated as of Java 9.
So, I have a fully functioning html/javascript/css web app, not sure if that's the right term, it works fine and dandy in a web browser.
The thing is I now have to move it OUT of a browser, OFFLINE, and to the "desktop", make it a standalone app. I would have to somehow wrap it in java/c++/python something, to make it run like that.
I really like Java since that is the language I know out of that list. I have looked into Rhino & Gecko. I haven't really found anything that is a nice plug and play. Like here is my .html file now run with it. I assume it would have to be in a swing window or something too.
Any hints/help/comments?
(As per request, I reposted my comment as an answer.)
The Atom editor is built using only web technologies, and uses the Electron framework (based on the Chromium browser) to run as a standalone application, with no external browser dependencies.
It looks very easy to set up something similar yourself, and basically just requires you to put your files in a special directory. (Electron uses a lot of space, though, so it may not be practical for distributing applications below ~20 MB.)
If you are really looking for an option where you just point at your current html and are off then you might just want to configure run a local web-server. It changes almost nothing about how you are running your application except where it is being served from.
So, I wish to program a game in Java, but be able to post it on online video gaming websites. For some reason, most game websites do not support the use of .jar files, so I sadly cannot just publish that. However, I have seen one method that works, but I need an explanation to what it is, and how to do it. Some Java games appear to be put on an independent website, then an SWF loads the page, like a browser. For example, Runescape on Kongregate seems to run like this, despite the actual game being written in Java.
Is this a known method? Does anyone have any idea on how to do this? Please, I'd really like my game written in Java, not ActionScript. I can't imagine running Java from an SWF similar to how a browser does it is that hard. Thanks.
Runescape uses their own version of Java web start to play the game. When you first play Runescape, Jagex uses Java web start to load Java code to your computer that loads the rest of the game. That's what the update check does every time you play.
You can write your Java application so that it uses Java web start. You have to provide a URL on a web page so that the user's browser can download your code to their computer.
Your other choice is to write a Java applet. An applet is run from a web page. The web page has applet HTML to start the applet.
Im trying to resolve following dilemma. I have to develop whole webpage system(with user friendly content management, it should look like very simple Drupal or Joomla) as a project to school. The webpage should have function of adding and removing articles, editing menus, editing whole webpage layout(header position, menu position etc).
Im in phase of deciding which system would be the best for this purpose. I wrote several applications in GWT. It's very quick to develop something, it works on Tomcat etc. So it could be very good adept for this task. But recently I got an idea of writing whole webpage system in JavaFX 2.0 (webpage would open inside the browser).
What is your opinion about this fact ? Should I use JavaFX or GWT? I'm not sure if whole webpage will be quick enough in JavaFX. If the users that will be visiting this page wont have problems with launching this page etc. I havent found any information about this on the internet.
Thanks for your answers :)
Go for GWT (also consider using Vaadin or SmartGWT). It does not require a Java Virtual Machine to be installed on the client. Also, GWT allows the client to download only small pieces of the application, and not the whole thing.
You cited two Content Management Systems like Drupal and Joomla that are written in PHP, so maybe the best solution for you is a CMS written in java like Alfresco or Magnolia.
do you want to do a web page or an applicatin for one plugin ? GWT of course.
GWT
GWT follows a most innovative approach: you write the entire application in Java. But it’s executed in Javascript. A good portion of your code is cross-compiled to Javascript and uploaded to the client.
Judging from the presentations I’ve seen, this approach works surprisingly good. In former times the GWT compiler used to be slow, but today, they seem to have solved (or at least alleviated) the problem. As far as I can see, GWT is an excellent choice
javafx
JavaFX 2.0 is a pretty new GUI framework. So expect a few glitches. The good news is that it’s likely to improve over the years. And I suppose people will start to write JavaFX component frameworks if JavaFX is going to be popular.
There’s a video showing the domain of JavaFX very clearly.
Container terminal monitoring with 3D JavaFX
Source
I need a integrated or embedded java browser. I used WebEngine of javafx which support basic css as well html & java script but could not able to run flash file. Any way to do so.
Or any other Project u know which could fulfill my requirement.
You can also look at JxBrowser Java library that allows embedding Chromium-based web browser control into Java AWT/Swing application.
It supports both Java Swing and JavaFX.
BTW: the browser control is totally lightweight. All rendering happens in a separate native process by native Chromium engine. The web page looks like it's displayed in Google Chrome.
Check those (although they are not JavaFX but I suppose that they can be used):
http://lobobrowser.org/java-browser.jsp - pure Java
http://www.javadesktop.org/articles/jdic/index.html - better imho, but no longer maintained