javafx applet部署

1、使用netbeans打包编写好的代码,生成类似如下的文件:
ColorPickerNode.jar、ColorPickerNode_browser.jnlp
2、将这两个文件copy到你的项目下:你可以在项目下建一个目录(如:dist),然后copy到这个目录中
3、修改ColorPickerNode_browser.jnlp(使用文本编辑器即可),:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/embwap/dist/" href="ColorPickerNode_browser.jnlp">
<information>
<title>ColorPickerNode</title>
<vendor>${application.vendor}</vendor>
<homepage href="http://localhost:8080/embwap/"/>
<description>ColorPickerNode</description>
<offline-allowed/>
<shortcut>
<desktop/>
</shortcut>
</information>
<resources>
<j2se version="1.5+"/>
<extension name="JavaFX Runtime" href="http://dl.javafx.com/1.2/javafx-rt.jnlp"/>
<jar href="ColorPickerNode.jar" main="true"/>
</resources>
<applet-desc name="ColorPickerNode" main-class="com.sun.javafx.runtime.adapter.Applet" width="200" height="200">
<param name="MainJavaFXScript" value="projavafx.colorpicker.ui.ColorPickerMain">
</applet-desc>
<update check="background">
</jnlp>
-------
其中codebase="http://localhost:8080/xxx/dist/"就是该文件所在的目录,因为是web项目所以http://localhost:8080。
<homepage href="http://localhost:8080/embwap/"/>表示applet页面文件所在的位置。
4、编辑applet页面文件:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Bounce</title>
</head>
<body>
<h1>Bounce</h1>
<script src="http://dl.javafx.com/1.2/dtfx.js"></script>
<script>
javafx(
{
archive: "dist/ColorPickerNode.jar",
draggable: true,
width: 400,
height: 600,
code: "projavafx.colorpicker.ui.ColorPickerMain",
name: "ColorPicker"
}
);
</script>
</body>
</html>
---------------
archive: "dist/ColorPickerNode.jar",如果你的页面文件与ColorPickerNode_browser.jnlp不在同一个目录,请指明路径
code: "projavafx.colorpicker.ui.ColorPickerMain",javafx的main
5、启动应用服务器

说明:我才调试时发现每次修改ColorPickerNode_browser.jnlp文件都需要重新启动服务.
其中localhost为客户端访问的ip地址
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值