I'm trying to deploy an applet using JNLP. The file structure is thus:
/
dbstats.html
dbstats.jnlp
dbstats.jar
lib/
substance.jar
trident.jar
guava-0.7.jar
Here's my HTML:
<html>
<head>
<title>Dreambearstatistieken</title>
<script src="http://www.java.com/js/deployJava.js"></script>
<script type="text/javascript">
var attributes = {
code:'dreambear.stats.viewer.DBStatsViewer',
width:900, height:600
};
var parameters = {jnlp_href: "dbstats.jnlp"};
var version = "1.6";
</script>
</head>
<body>
<script type="text/javascript">
deployJava.runApplet(attributes, parameters, version);
</script>
</body>
</html>
And the JNLP file:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="">
<information>
<title>Dreambearstatistieken</title>
<vendor>Weber</vendor>
</information>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" />
<jar href="lib/trident.jar" />
<jar href="lib/substance.jar" />
<jar href="lib/guava-r07.jar" />
<jar href="dbstats.jar" main="true" />
</resources>
<applet-desc
name="Dreambearstatistieken"
main-class="dreambear.stats.viewer.DBStatsViewer"
width="900"
height="600">
</applet-desc>
<update check="background" />
</jnlp>
As far as I can see, everything should be ok, but it's not. I get a ClassNotFoundException on org.pushingpixels.substance.api.skin.SubstanceNebulaLookAndFeel, which is in substance.jar. What am I doing wrong?
And wider, is there a good tutorial or book about using applets and JNLP in the 2010s?
First your codebase is empty. As far as I remember it should contain the absolute path to your application. Probably I am wrong but start from this. If it helps but you wish to reuse the jnlp file try codebase="." (although I am not sure it is legal.)
Next, try to download one of the jars under lib directory using browser. It is needed to be sure that this directory is accessible.
Good luck!
You have to put the jlnp's name on href="" as well. Do it like this:
<jnlp spec="1.0+" codebase="http://mydomain:5500/myapp" href="dbstats.jnlp">
Related
My JavaWebStart(using Netbeans) application deploys and functions very well on the apache webserver(localhost), BUT when I connect it to its mysql DB, it only deploys but doesnt function. However, it is connecting very well in Netbeans.
I have tried signing in the jar files using 'keytool' but cmd cannot recognize 'keytool' either.
How do I connect this app to its database?
The JNLP:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="http://192.168.0.10/JWS2" href="launch.jnlp" spec="1.0+">
<information>
<title>JavaWebStart2</title>
<vendor>Administrator</vendor>
<homepage href=""/>
<description>JavaWebStart2</description>
<description kind="short">JavaWebStart2</description>
<offline-allowed/>
</information>
<update check="background"/>
<resources>
<j2se version="1.8+"/>
<jar href="JavaWebStart2.jar" main="true"/>
<jar href="lib/mysql-connector-java-5.1.18.jar"/>
</resources>
<application-desc main-class="main.NewJFrame">
</application-desc>
</jnlp>
HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test page for launching the application via JNLP</title>
</head>
<body>
<h3>Test page for launching the application via JNLP</h3>
Launch the application
<script src="http://java.com/js/deployJava.js"></script>
<script>
deployJava.createWebStartLaunchButton("launch.jnlp")
</script>
<!-- Or use the following link element to launch with the application --
>
<!--
-->
</body>
</html>
I am developing a Web page using jsp and html where in I need to read/write from/to a Device connected on Client's System who are accessing the Webpage. The Device is a Serial Device which is connected as COM1(Eg) in Windows. I went through different options available. I found this which serves my purpose. I started learning JNLP for the same. I imported the project and made changes according to my needs. (This project is using jssc.jar). I generated the jar (jSSC-Terminal.jar) and signed with self-generated key. The GUI is being loaded properly but I am unable to access the Serial port on client's machine. Here is my jnlp file launch.jnlp
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp href="launch.jnlp" spec="1.0+" codebase="http://192.168.1.33:8080/abc"
href="launch.jnlp">
<information>
<title>jSSC-Terminal</title>
<vendor>scream3r</vendor>
<homepage href="scream3r.org"/>
<description>jSSC-Terminal</description>
<description kind="short">jSSC-Terminal</description>
</information>
<update check="background"/>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.5+"/>
<jar href="jSSC-Terminal.jar" main="true"/>
<jar href="jssc.jar" download="eager"/>
</resources>
<applet-desc height="500" main-class="applet.Main" name="Main" width="700">
<param name="separate_jvm" value="true"/>
<param name="draggable" value="true"/>
</applet-desc>
</jnlp>
Here is my html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>jSSC-Terminal</title>
<style type="text/css">
body {
margin-left: 10px;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
}
</style>
</head>
<body>
<applet code="applet.Main" archive="http://192.168.1.33:8080/abc/jSSC-Terminal.jar, http://192.168.1.33:8080/amar/lib/jssc.jar" width="700" height="500">
<param name="separate_jvm" value="true"/>
<param name="draggable" value="true"/>
</applet>
</body>
</html>
I have placed all these files in Tomcat directory as below
/Tomcat/webapps/abc/launch.jnlp
/Tomcat/webapps/abc/jSSC-Terminal.jar
/Tomcat/webapps/abc/index.html
/Tomcat/webapps/abc/lib/jssc.jar
I am unable to get the SerialPort List when run as jnlp. Kindly help me out with a fix if available. Or are there any alternate things available in JSP. Thanks and Regards.
Edit :
Finally found out thank you. I replaced my applet tag and included jnlp location as below :
<applet code="applet.Main" archive="http://192.168.1.33:8080/abc/jSSC-Terminal.jar, http://192.168.1.33:8080/abc/lib/jssc.jar,"http://192.168.1.33:8080/abc/test.jnlp" width="700" height="500">
<param name="separate_jvm" value="true"/>
<param name="draggable" value="true"/>
</applet>
</body>
Your <applet> tag doesn't refer to the .jnlp file. You give access to COM ports in the jnlp file but it's not being used. You have to either use the jnlp file or set permissions in the <applet> tag.
Your link to the jssc example is a page that shows how to use the jnlp file from the <applet> tag.
I've done what you are trying to do with a Java Webstart app and the PureJavaComm library. I bet what you are doing will work once you get the permissions right, though. But if you want to have a look at how I set this up the jnlp file is here: https://bitminter.com/client/bitminter.jnlp (live app)
I try to test the JVM parameters with this JNLP file :
<jnlp spec="1.0+" codebase="" href="">
<information>
<title>Test Applet</title>
<vendor>D2D - Architecture - Composants</vendor>
</information>
<resources>
<!-- Application Resources -->
<!--<j2se version="1.7*" href="" java-vm-args="-ea -Xincgc -verbose -Xmx768m" />-->
<j2se version="1.6*" href="" initial-heap-size="512" max-heap-size="1024M" />
<jar href="Applet.jar" main="true" />
<!-- Si plusieurs jars : mettre plusieurs balises jar -->
</resources>
<applet-desc
name="Test Applet"
main-class="TestApplet"
width="600"
height="300">
</applet-desc>
<update check="always"/>
</jnlp>
When i launch the "jnlp", it taking in the account this but when i launch from a html page with this script :
<body>
<h1>Prototype Applet JRE</h1>
<!-- Script JavaScript pour le déploiement de l'applet -->
<script src="javaScript/deployJava.js"></script>
<!-- Les différentes informations sur l'applet -->
<script>
var attributes = { code:'TestApplet.class', archive:'Applet.jar'} ;
var parameters = {jnlp_href: 'applet.jnlp'} ;
deployJava.runApplet(attributes, parameters, '1.6');
</script>
</body>
The browser ignores this JVM parameters and launch the applet normally...but the jvm has "512" at the min...
I search a lot, test a lot, without results...
Test environment :
Browsers : Chrome 26.0.1410.43 m , IE 8.0.6..
JRE : 1.6.0_u22 / 1.7
Thanks for help!
i am passing value in java applet but value is coming there as null
my javascript for applet deployment :
<script src="javascript/deployJava.js"></script>
<script>
var attributes = { id:'dynamictreeapplet', code:'jstojava.com.vaannila.utility.dynamicTreeApplet.class',width:1000,height:1000} ;
var parameters = {jnlp_href:'./appletjars/a.jnlp'} ;
deployJava.runApplet(attributes, parameters, '1.6');
</script>
My jnlp
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/docRuleToolProtocol/appletjars/" href="a.jnlp">
<information>
<title>dynamictree</title>
<vendor>Ashutosh</vendor>
</information>
<resources>
<j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se" />
<jar href="dynamictree.jar" main="true" />
<jar href="prefuse.jar" main="true" />
</resources>
javascript to pass value :
function showSelected(value){
alert("the value given from"+value);
var diseasename=value;
alert(diseasename);
dynamictreeapplet.dieasenameencode=diseasename;
}
<applet-desc name="dynamictree" main-class="com.vaannila.utility.dynamicTreeApplet" width="500" height="500">
</applet-desc>
</jnlp>
Change
dynamictreeapplet.dieasenameencode=diseasename;
to
document.dynamictreeapplet.dieasenameencode=diseasename;
and probably dieasenameencode to diseasenameencode .
I am new to java Web Start and trying to set up a jnlp download on my server.
The Web start seems to initiate ok, butit gives the following error:
WARNING: <meta> tag is not closed correctly Exception parsing xml at line 3
Line 3 just contains the meta descriptions. Originally I used some characters the xml parse might object to, these were "-" and "(" ")". Suspecting that these characters might not be valid in a meta description, I removed them from the meta on my web page and in the jnlp script.
However, when I try to run Web start, it still has line 3 as:
<head><title>xxxxxx</title><meta name="author" content="xxxxx"><meta name="keywords" content="xxxxxx xxxxxxxx xxxxxxxxx"><meta name="description" content="xxxx (xxx) xxxxx, xxxx, 2-12 players."></head>
In other words it is not showing my updated meta info. Where is it getting this old version from, and how can I update it?
And most importantly, are the characters "- ( ) ," causing my problem anyway?
Here is a link to my site. Be aware it's not quite ready to go live yet!
fantasyhexwars.com/getting_started.html
Quite possibly something is configured wrong!
It seems so.
http://fantasyhexwars.com/include/launch.jnlp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html lang="en">
<head><title>Fantasy Hex Wars</title><meta name="author" content="Mark Keen"><meta name="keywords" content="strategy fantasy hex wars multiplayer war game turn based"><meta name="description" content="An online, turn-based, strategy game for up to 12 players."><link rel="shortcut icon" href="http://91.223.16.102/httpdocs/favicon.ico"></head>
<frameset rows="100%,*">
<frame title="http://91.223.16.102/include/launch.jnlp" src="http://91.223.16.102/include/launch.jnlp" name="mainframe" frameborder="0" noresize="noresize" scrolling="auto">
<frame title="empty frame" frameborder="0" scrolling="no" noresize="noresize">
<noframes>Sorry, you don"t appear to have frame support.
Go here instead - Fantasy Hex Wars</noframes>
</frameset>
</html>
http://91.223.16.102/include/launch.jnlp
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="http://fantasyhexwars.com/httpdocs/include" href="launch.jnlp" spec="1.0+">
<information>
<title>Fantasy Hex Wars</title>
<vendor>Fysh Games</vendor>
<homepage href="fantasyhexwars.com"/>
<description>A turn-based, online, multiplayer strategy game.</description>
<description kind="short">Fantasy Hex Wars</description>
</information>
<update check="always"/>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.5+"/>
<jar href="FantasyHexWar.jar" main="true"/>
<jar href="lib/appframework-1.0.3.jar"/>
<jar href="lib/swing-worker-1.1.jar"/>
<jar href="lib/beansbinding-1.2.1.jar"/>
<jar href="lib/mail.jar"/>
</resources>
<application-desc main-class="fantasyhexwar.FantasyHexWarApp">
</application-desc>
</jnlp>