dyploying javafx on web - browser

I want to build set of tools for my team and they will be as part of JavaFX application for which GUI will be build with help of SCENE BUILDER. I have seen everything that was available but I need an example how to embed this type of application on the server from which it can be invoked somehow. Please help with examples and links. I'd like to make it look as this one. http://download.oracle.com/otndocs/products/javafx/2.2/samples/Ensemble/index.html
Thank you.

Place a copy of the jar, jnlp and html file output by the NetBeans JavaFX project build or JavaFX packaging tools deploy command into a directory of your webserver, then access the html file in your browser.
For example, let's say you called your application MyPowerApp and netbeans output MyPowerApp.html and you wanted to deploy that to a local Tomcat server:
Download and install a copy of Tomcat
Copy the jar, jnlp and html file into tomcat's webapps/ROOT directory.
Start tomcat.
Access your application via http://localhost:8080/MyPowerApp.html
The applet will start automatically and you can click on the link to launch the application via WebStart.
To update the application just rebuild it in NetBeans, copy it over into the tomcat webapps/ROOT directory and refresh your browser link (no need to restart Tomcat).
In practice you will want to modify the html rather than use the generated html to embed either the applet or WebStart link somewhere on your website (you won't need both execution modes in a single page like the Netbeans generated sample).
You may need to sign your application if it refers to needs permissions outside of the jnlp application sandbox.
To get the application to fill a browser window like Ensemble, it's height and width need to be set to 100% and the HTML page template modified to not have any page margins (view source on the Ensemble page for a sample).
You can include your fxml in your application jar and load it from there or you can load it off your server relative to your application deployment directory.
The information above is a variation of my forum answer on deploying JavaFX web applications to a server.
See the JavaFX deployment guide and Ensemble sample application source for more info.
deployment guide
deployment QuickStart
ensemble sample application
JavaFX sample application source at the JavaFX demos and samples link

Related

How to find out right URL to JSF page? Opening in IntelliJ IDEA causes 404

I'm very new on Java Web dev. On intellij Idea 14, I started a new project with plain Java, JSF support (no JavaEE, will add Spring later). Tomcat 7.0.59 as server. When I hit run on the IDE, firefox opens up and hits on 'http://localhost:8080/index.xhtml', it should display the hello world in index.xhtml that the IDE makes on new project, but the page just displays 'HTTP 404'.
I think the problem is path on the browser, how can I find the correct path and configure it on IDE deploy settings?, how can I debug on tomcat?, where can I start looking?
http://localhost:8080/index.xhtml is an incomplete address. Where is the context root? It should be the name of your project/webapplication, where you would have
"http://localhost:8080/{application-name}/index.xhtml".
Unless you've set your application to be the default tomcat application (which I highly doubt), you should have the name of your project in there in the URL
%CATALINA_HOME% is Tomcat install directory. Use %CATALINA_HOME%\logs to read Tomcat log for debugging.
When you create a new Java web project, It also means you are diving to Java EE (Enterprise Edition).
Create new JSF web application by IntelliJ IDEA:
Offical tutorial for you: http://docs.oracle.com/javaee/7/tutorial/partwebtier.htm#BNADP .
You should use GlassFish 4 application server for simplicity at first one.
move the lib directory into WEB-INF

Is it possible to deploy JSF application on Bluemix?

I have installed IBM Bluemix tools on Eclipse and created a 'Hello World' JSF and EAR project. While creating I have chosen a Bluemix runtime environment. Now I try to deploy EAR from Eclipse, it successfully deployed and started but when I try to open it I get the following error:
Not Found The application or context root for this request has not been found: [Ljava.lang.Object;#bdb04149
What have I missed? Is there comprehensive tutorial to deploy Java EE web applications on Bluemix available anywhere?
You can deploy complete EAR files on Bluemix yes. Using the eclipse tools also makes it much easier. This link has steps on how you can do this https://www.ng.bluemix.net/docs/#manageapps/eclipsetools.html
Further down the page (you can use the menu on the left too) there are steps on how to push an EAR. It might be with pushing a complete Liberty profile to get finer control on the application behavior. This link has further details on pushing Liberty apps and the profile itself https://www.ng.bluemix.net/docs/#starters/liberty/index.html#liberty
If you deployed an EAR (containing your JSF app) you need to add the web module name to the URL, for example, if your project is called testJSF, your URL will look like this:
http://testApp.mybluemix.net/testJSF/
And of course, if your web page is not called index.xxx you need to add the web page name as well, for example:
http://testApp.mybluemix.net/testJSF/textPage.xhtml
or
http://testApp.mybluemix.net/testJSF/textPage.faces

JavaFX, embedded application in jsf page is slower than standalone

I am working about embedding a JavaFX GUI in a web application and I have this issue: the application launched standalone without using the jnlp file is faster than when it is launched by the web application using the jnlp file.
Some details:
The jvm is the last stable 1.7u40
All (also the application server) is running on my pc
All used jars are signed by a certificate I signed using a CA created by my self using keytool.
I set <update check="always" policy="always"/> on the jnlp file
The download policy of jars on jnlp file is lazy
On the web I found nothing useful or explaining this behaviour. My suspect is that the jnlp start my application and something more, I will do some check about this.
I am open to any suggestions.
Thank you
Update
I found that the JavaFX GUI is slow only if it is embedded in the web page: if I call from the web page dtjava.launch(that executes the jnlp standalone) instead of dtjava.embed(that embeds the GUI in the page) all seams to work quite good.
The question persists why is it slower embedded?

How to open a Java Web Start Application from a Hyperlink in a JavaFX 2.0 Application

I have a web application that loads other applications from within it, how can I open a java web start application from within my JavaFx 2.0 application. All help is greatly appreciated.
It's long to answer, you need to study how to Deploy Java Web Start application first.
The basic approach is:
Create a JAR file containing your application's class files and resources. including Main-Class attribute in your MANIFEST.MF.
Create JNLP files to describe how your application to run, You can also use JavaFX Packager tool to help.
Then look at source code for The Java FX Ensemble example to figure out JavaFX specific configuration, and full documentation Deploying JavaFX Applications.

How do I deploy an OpenLaszlo solo application?

I have been looking at OpenLaszlo. I could not find how to deploy a solo application..
What do I have to copy or what programs do I have to run?
I know the deployment type can be dhtml or flash...
Thanks in advance.
For SOLO mode, you take the OpenLaszlo .lzx source "program" (expressed in XML format) and "compile" it into an Adobe Flash .swf file using the lzc utility.
For example, a hello.lzx source would be compiled as follows
lzc hello.lzx
into a Flash application called
hello.sw8.swf
Then you simply embed the .swf into an HTML page as you would any other Flash content. The client browser must have the Adobe Flash Player version 8 or version 9 to play the .swf Flash application.
To see the Flash application work right off the disk of your development machine, just point your browser directly at the local .swf file and it should show up in the browser.
The OpenLaszlo documentation contains a section with some information on how to deploy an application:
http://www.openlaszlo.org/lps3.4/docs/deploy/deployers-guide.html#deployers-guide.steps
There's another section in the docs describing the SOLO and proxied deployment mode.
http://www.openlaszlo.org/lps4.9/docs/developers/proxied.html
The documentation can be a bit confusing, since it has not been updated over the past years.
The simplest way to deploy an application is to use the developer console, which is displayed below the OpenLaszlo application in the browser. You'll see a "SOLO" button in the console, which will start the process of generating an embedding HTML page for you OpenLaszlo application, bundle up all static resources into a ZIP file, which can be processed by automated build scripts to generate a new version of your software.
All the compilation and deployment steps can be run from the command line using the "lzc" command for compilation, and the "lzdeploy" command to generate the deployment ZIP file. Both tools can be integrated into Ant. The commands can be found in folder
$LPS_HOME/WEB-INF/lps/server/bin
Check this blog post in the OpenLaszlo project blog for more information on the lzdeploy tool (which does not seem to be documented in the official documentation):
http://weblog.openlaszlo.org/archives/2008/04/lzdeploy-new-command-line-utility-for-deploying-solo-applications/
There has been a similar question regarding automated builds of an OpenLaszlo SOLO application using Apache Ant. The answer contains a full build script to compile either an SWF or DHTML/HTML5 application, including all required resources. The discussion can be found here:
How to build an OpenLaszlo DHTML application using Apache Ant

Resources