Browser ignore my JVM parameters in JNLP - java

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!

Related

Java Web Start - jnlp database connection

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>

Access COM Port on Client Side in Web Programming Java

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)

java applet not visible in chrome but working in FF

i have an applet that was work fine in java version under 7u45 and in firefox ,but when i updated java to the latest version my applet loads but it does not appear except when I try to inspect the item with chrome, it will display.
Here are the console log:
févr. 02, 2014 11:56:46 AM mt.common.util.applet.myapplet init
Infos: isLoggable(ALL) : true
févr. 02, 2014 11:56:46 AM mt.common.util.applet.myapplet init
Infos: Loading of child applet successfull
févr. 02, 2014 11:56:46 AM mt.common.util.applet.myapplet init
Infos: OK : the child applet is an instance of myapplet
févr. 02, 2014 11:56:46 AM org.modula.applet.document.myapplet1 init
Infos: init() myapplet1 2.0
févr. 02, 2014 11:56:48 AM org.modula.applet.document.myapplet1 init
Infos: End init()
testmepl6
févr. 02, 2014 11:56:48 AM mt.common.util.applet.applet start
Infos: Start...
i call myapplet like this:
var attributes = {id:"appletInstance",
name:"appletInstance",
code:"mt.common.util.applet.myapplet",
codebase:"<%=urlCodeBase %>",
width:150, height:30};
var parameters = {jnlp_href: "<%=urlJnlp %>"};
<div style="text-align: center; float:right;">
<%= bordPanelState.getHTMLTop() %>
<div id="divPopupActions" style="text-align: center; padding: 2px 5px 2px 5px;">
<%if(vUrlFile.size()>0){ %>
<!---------------------------------------->
<!---------------- Applet ---------------->
<!---------------------------------------->
<!-- <script src="http://www.java.com/js/deployJava.js" type="text/javascript"></script> -->
<script src="<%= rootPath %>include/js/java/deployJava.js"></script>
<script type="text/javascript">
deployJava.runApplet(attributes, parameters, '1.6');
</script>
<%} %>
</div>
<%= bordPanelState.getHTMLBottom() %>
</div>
this is my jnlp file
<?xml version="1.0" encoding="UTF-8"?>
<jnlp href="appletContainer.jnlp">
<information>
<title>applet Container</title>
<vendor>MT</vendor>
</information>
<resources>
<!-- Application Resources -->
<j2se version="1.7+" href="http://java.sun.com/products/autodl/j2se" download="eager"/>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" download="eager"/>
<jar href=myapplet.jar" download="eager"/>
</resources>
<applet-desc
name="Applet Container"
main-class="mt.common.util.applet.AppletContainer"
width="200"
height="300">
</applet-desc>
<update check="always"/>
</jnlp>
I think there might be an error in your applet base code
As JaNeLa correctly reports, there are several issues with your jnlp file. I fixed the problems, try the following:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="6.0+" href="appletContainer.jnlp">
<information>
<title>applet Container</title>
<vendor>MT</vendor>
<offline-allowed />
</information>
<update check="always" policy="always"/>
<resources>
<j2se version="1.7+" href="http://java.sun.com/products/autodl/j2se"/>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="myapplet.jar" download="eager"/>
</resources>
<applet-desc
main-class="mt.common.util.applet.AppletContainer"
name="Applet Container"
width="200"
height="300"/>
</jnlp>
Interestingly JaNeLa also reports an error about those two j2se tags which is perfectly valid to do. Maybe Andrew Thompson can shed some light on this behaviour, which seem like a bug to me...

value passing in java applet

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 .

How to specify applet libraries in JNLP file

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">

Categories

Resources