How to make the javaFX applet running offline

By W.ZH Aug 30 2010Issue:

When I build a JavaFX UI by netbean, and it can be deployed as a single java application, or can be deployed as a applet page to run in web application. But if it runs as an applet, it must go to javafx.com website to download many jars and other files to run the applet. So your web application must keep access to the internet to run it. So this article is going to help you can make it run in the enterprise intranet environment.



Analysis:  We have understand how a applet is trigger to open for javafx in web application. After you deploy from netbean, you get an html like this, myApp.html together with a myApp.jnlp file:

<html>

<head>

<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>

</head>

<body>

http://dl.javafx.com/1.3/dtfx.js

javafx(

{

archive: “myApp.jar”,

draggable: true,

width: 300,

height: 400,

code: “myApp.Main”,

name: “myApp”,

displayhtml: false

}

);

</body>

</html>

dtfx.js in fact is a set of javascript to check your client browser and dynimic create the applet html tag for you, based on the javaFX runtime versions and also your myAPP.jnlp file.

Solution:

You can read this article
http://blogs.sun.com/mobility_techtips/entry/how_to_develop_and_run . it basiclly explain how you an do to make it offline. But i list several tips here:

1. The js, and pic resources URL might different upon your FX version.  And even the files are different. My experience is you need dtfx.js, deployJava.js, and ping .js (maybe).  and those pics.

2. You need read the dtfx.js, deployJava.js, javafx-rt.jnlp code to find out what jars it needs, it will different with the article mentioned. I download aorund 20+ jars for 1.3 version javafx runtime, as they are for different os and browser.

3. then change all java script and also the jnlp files link to internet resource to let them point to your offline files and jars, and also your app’s html and jnlp files.  Then you should be able to run it offline.

4. Understand how dtfx.js works is very important. you can change it upon your needs, As i need to change a lot in the applet input parameters, So change myApp.html and also the dtfx,js can help a lot on this issue.

5. You can change  myApp.html to a jsp page, so it can merge into your J2EE web application, you can create dynamic input for the applet in jsp and make your javaFX runs in your J2EE context.

6. Shortcoming for offline version is that when the new version javaFX runtime release, you can not get update…but this is how current javaFX works,, I feel javaFX is still in early stage to be stable to use.

 

 

Advertisements

How to win friends

Let’s realize that criticisms are like homing pigeons. They always return home. Let’s realize that the person we are going to correct and condemn will probably justify himself or herself, and condemn us in return;

The next time we are tempted to admonish somebody, let’s pull a five-dollar bill out of our pocket, look at Lincoln’s picture on the bill, and ask. “How would Lincoln handle this problem if he had it?”

“Don’t complain about the snow on your neighbor’s roof,” said Confucius, “when your own doorstep is unclean.”

When dealing with people, let us remember we are not dealing with creatures of logic. We are dealing with creatures of emotion, creatures bristling with prejudices and motivated by pride and vanity.

PRINCIPLE 1

Don’t criticize, condemn or complain.

SQL tips

1. SQL compare date·  WHERE DateDiff(dd, OrderDate, ’01/01/2006′) = 0

·  WHERE Convert(varchar(20), OrderDate, 101) = ’01/01/2006′

·  WHERE Year(OrderDate) = 2006 AND Month(OrderDate) = 1 and Day(OrderDate)=1

·  WHERE OrderDate LIKE ’01/01/2006%’

·  WHERE OrderDate >= ’01/01/2006′  AND OrderDate < ’01/02/2006′
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=38012

http://www.dba-oracle.com/t_sql_compare_two_date_ranges.htm

2.  Express builder to create date compare

http://www.java-examples.com/compare-two-java-date-objects-using-compareto-method-example

PL/SQL Study Notes

PL/SQL Study Notes, By W.ZH

1. What is PL/SQL — Oracle default language for DB.

PL/SQL = Procedural Language to SQL   = IF-ELSE-LOOP…..+ SQL

PL/SQL in fact is to add the conditional logic to the SQL , make you can do more things directly on the DB data.

2. Three types block in the PL/SQL

Anonymous blocks – can not reuse

Procedures blocks – reusable to  to perform an action

Function blocks – reusable to compute and return a value

3. Programs

Application Procedures/Functions = stored in an Oracle Form developer or share lib

Stored Procedures/Functions = stored in an Oracle Server

Package = Moudules that group Application or Stored  Procedures/Functions

DB triggers = PL/SQL blocks that are associated with a db table and fired auto by some events

Application triggers = trigger that in the applications , such as Oracle Form developer

4. Coding tools

Jdeveloper and iSQL*plus both can used to developing tools.  iSQL*plus is the web version of SQLplus