Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy a desktop JavaFx 2.0 application correctly using jnlp for 32 and 64 bit?

I have a jnlp file for deploying my javafx 2.0 application, however, how do I make sure that the users have the correct javafx runtime (32 or 64 bit depending on the jvm present on the machine) and if not, download it and run the application.

Assuming that the user does not have a javafx runtime currently installed, the problems that I'm facing mostly with a 64 bit machine with either 32-bit, 64-bit or both JRE's are:

1) The Javafx swing deployment guide mentions to use the <jfx:javafx-runtime version /> tag to download the appropriate jfx runtime, but JRE below 1.7 doesn't understand this tag/namespace.

2) If a 32-bit jre is installed on a 64-bit machine, then how do I install my application to the "Program Files(x86)" folder, download and use 32-bit javafx runtime.

3) If a 64-bit jre is installed on a 64-bit machine, then how do I install my application to the "Program Files" folder, download and use 64-bit javafx runtime.

Here is how my jnlp file looks currently:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="file:///C%3A/Program%20Files/HP/Pulse/PulseLite"href="iMonLauncher.jnlp">
    <information>      
        <title>iMonLauncher</title>  
        <vendor>Administrator</vendor>   
        <homepage href="file:///C%3A/Program%20Files/HP/Pulse/PulseLite"/>     
        <description>iMonLauncher</description>  
        <offline-allowed/>    
    </information>   
    <security>      
        <all-permissions/>  
    </security> 
    <resources> 
        <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
        <jar href="iMon.jar" size="428419"/>         
         <jar href="lib/ibase-core.jar" size="197029"/>
         <jar href="lib/ibase-fx.jar" size="210175"/>
         <jar href="lib/imonDB.jar" main="true" size="156616"/>
         <jar href="lib/imon-service.jar" main="true" size="73190"/>
         </resources>
     <application-desc name="iMon" main-class="imon.Main" >
     </application-desc>
     <update check="always"/>

The codebase changes automatically, to point to the correct program files folder depending on the architecture.

Thanks in advance !

like image 804
Saurabh Avatar asked Nov 13 '22 14:11

Saurabh


1 Answers

You miss xmlns:jfx namespace in your jnlp. It should starts with

<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="iMonLauncher.jnlp">

Once user has regular java installed and clicked on such jnlp file he would be presented with automatic download message for FX. It will find out which java is used, download and install approprivate javafx version.

jnlp response

like image 107
Sergey Grinev Avatar answered Dec 08 '22 01:12

Sergey Grinev