I am a JavaFX application that uses Java Web Start to launch it. I'm trying to pass a parameter to it, but thus far I have failed. I have tried to follow the example given in the deployment toolkit. I here is where I am doing everything now.
HMTL:
& lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Parameter test & lt; / Title & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" /> & Lt; / Head & gt; & Lt; Body & gt; & Lt; H1 & gt; Parameter passing test & lt; / H1> & Lt; Script src = "http://java.com/js/dtjava.js" & gt; & Lt; / Script & gt; & Lt; Script & gt; Function Launch Application () {dtjava.launch ({url: 'ParamTesting.jnlp', Params: {Order: "852237"}}, {jvm: '1.7.0_72 +', javafx: '2.2+'}, {} ); return false; } & Lt; / Script & gt; & Lt; A href = 'ParamTesting.jnlp' onclick = "Return Launch App ();" & Gt; & Lt; Img src = "picture / jws-launch-button.png" width = "88" height = "23" /> & Lt; / A & gt; & Lt; / Body & gt; & Lt; / Html & gt;
JNLP:
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Jnlp spec = "1.0+" xmlns: jfx = "http://javafx.com" href = "parametting .jnlp" & gt; & Lt; Information & gt; & Lt; Title & gt; Para Testing & lt; / Title & gt; & Lt; Seller & gt; USGS & lt; / Vendor & gt; & Lt; / Info & gt; & Lt; Security & gt; & Lt; All permissions / & gt; & Lt; / Safety & gt; & Lt; Update check = "always" policy = "always" /> & Lt; Resources & gt; & Lt; J2se version = "1.7.0_72 +" href = "http://java.sun.com/products/autodl/j2se" /> & Lt; Jar href = "Paramastasting." Main = "true" version = "0.1" /> & Lt; Property Name = "jnlp.versionEnabled" value = "true" /> & Lt; / Resources & gt; & Lt; Application-desc name = "paramastasting" /> & Lt; Jfx: javafx-desc main-class = "gov.usgs.tnm.paramtesting.MainApp" name = "MainApp" & gt; & Lt; Fx: ultimate name = "command" value = "852237" /> & Lt; / JFX: JavaFX-desc> & Lt; / Jnlp & gt;
Java FX startup method:
throws a public zero start (stage stage) exception {System.out.println ( GetParameters (.) .getNamed () get ("command")); Original root = FXMLLoader.load (getClass (.) GetResource ("/ fxml / Scene.fxml")); Visual View = New View (Route); . Add Scene.getStylesheets () ("/ styles / styles.css"); Stage.setTitle ("Parameter Testing"); Stage.setScene (view); stage show(); }
Every time I run it, the "null" gets printed in the console. I do not know where I'm going wrong.
In addition, this app has an order system with it, so that the parameter should be dynamic. If anyone has any information about how I can complete it, then it will be highly appreciated.
I found my problem I do not need to describe application-element in JNLP. I do not know why the parameters running in this are not accessible to the JavaFX program, but it does.
Comments
Post a Comment