Finally moved up to 1.15. Also added 3137337 JNLP Example
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<HTML>
|
<HTML>
|
||||||
<BODY>
|
<BODY>
|
||||||
<!-- --------- -->
|
<!-- --------- -->
|
||||||
<h2>JACOB 1.15 M4</h2>
|
<h2>JACOB 1.15</h2>
|
||||||
<h3>What's New</h3>
|
<h3>What's New</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
@@ -65,6 +65,11 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><b>Feature Requests</b></td>
|
<td colspan="2"><b>Feature Requests</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
</tr>
|
||||||
|
<td width="13%" valign="top">3137337</td>
|
||||||
|
<td width="87%" valign="top">Add JNLP Applet example. Read the README to understand what jar
|
||||||
|
file signing and file placement is required</td>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="13%" valign="top">2963102</td>
|
<td width="13%" valign="top">2963102</td>
|
||||||
<td width="87%" valign="top">Convert API to use var args and remove the many overloaded Dispatch
|
<td width="87%" valign="top">Convert API to use var args and remove the many overloaded Dispatch
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
package com.jacob.samples.applet;
|
|
||||||
|
|
||||||
import java.applet.Applet;
|
|
||||||
import java.awt.Button;
|
|
||||||
import java.awt.FlowLayout;
|
|
||||||
import java.awt.TextField;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import com.jacob.activeX.ActiveXComponent;
|
|
||||||
import com.jacob.com.Dispatch;
|
|
||||||
import com.jacob.com.Variant;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Applet test case
|
|
||||||
*/
|
|
||||||
public class AppTest extends Applet implements ActionListener {
|
|
||||||
/**
|
|
||||||
* unique identifier added by Eclipse because this class is serializable
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = -6676420357823607065L;
|
|
||||||
|
|
||||||
TextField in;
|
|
||||||
|
|
||||||
TextField out;
|
|
||||||
|
|
||||||
Button calc;
|
|
||||||
|
|
||||||
ActiveXComponent sC = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* startup method
|
|
||||||
*/
|
|
||||||
public void init() {
|
|
||||||
setLayout(new FlowLayout());
|
|
||||||
add(in = new TextField("1+1", 16));
|
|
||||||
add(out = new TextField("?", 16));
|
|
||||||
add(calc = new Button("Calculate"));
|
|
||||||
calc.addActionListener(this);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* action method that receives button actions
|
|
||||||
*
|
|
||||||
* @param ev
|
|
||||||
* the event
|
|
||||||
*/
|
|
||||||
public void actionPerformed(ActionEvent ev) {
|
|
||||||
if (sC == null) {
|
|
||||||
String lang = "VBScript";
|
|
||||||
sC = new ActiveXComponent("ScriptControl");
|
|
||||||
Dispatch.put(sC, "Language", lang);
|
|
||||||
}
|
|
||||||
Variant v = Dispatch.call(sC, "Eval", in.getText());
|
|
||||||
out.setText(v.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
20
samples/com/jacob/samples/applet/Applet.html
Normal file
20
samples/com/jacob/samples/applet/Applet.html
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Jacob Test Applet</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<applet code="com.jacob.samples.applet.JacobTestApplet"
|
||||||
|
name="JacobTestApplet"
|
||||||
|
width="400"
|
||||||
|
height="50"
|
||||||
|
alt="Please install java first! (Java is available for free at www.java.com)">
|
||||||
|
<param name="jnlp_href" value="Applet.jnlp">
|
||||||
|
Java is not working! Several reasons:<br/>
|
||||||
|
1.) Your Browser is not able to execute java (-> get a different browser e.g. firefox.com)<br/>
|
||||||
|
2.) Java is not installed (-> install java e.g. java.com)<br/>
|
||||||
|
3.) Java is disabled/deactivated (-> enable java in your web browser)<br/>
|
||||||
|
4.) Your security settings are too tight (->enable java the settings)<br/>
|
||||||
|
5.) Contact support @ nepatec<br/>
|
||||||
|
</applet>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
27
samples/com/jacob/samples/applet/Applet.jnlp
Normal file
27
samples/com/jacob/samples/applet/Applet.jnlp
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<jnlp href="Applet.jnlp" spec="1.0+" version="1.1">
|
||||||
|
|
||||||
|
<information>
|
||||||
|
<title>Jacob Test Applet</title>
|
||||||
|
<vendor>ttreeck, nepatec GmbH & Co. KG</vendor>
|
||||||
|
<offline-allowed />
|
||||||
|
</information>
|
||||||
|
|
||||||
|
<security>
|
||||||
|
<all-permissions/>
|
||||||
|
</security>
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<j2se href="http://java.sun.com/products/autodl/j2se" version="1.6.0_20+" />
|
||||||
|
<jar href="lib/JacobTestApplet.jar-selfSigned.jar" main="true" version="1.0.0" />
|
||||||
|
<jar href="lib/jacob-signed.jar" version="1.0.0" />
|
||||||
|
<nativelib href="lib/jacob-dll-1.15-M3-signed.jar"/>
|
||||||
|
</resources>
|
||||||
|
|
||||||
|
<applet-desc
|
||||||
|
name="JacobTestApplet"
|
||||||
|
main-class="com.jacob.samples.applet.JacobTestApplet"
|
||||||
|
width="400"
|
||||||
|
height="50">
|
||||||
|
</applet-desc>
|
||||||
|
</jnlp>
|
||||||
88
samples/com/jacob/samples/applet/JacobTestApplet.java
Normal file
88
samples/com/jacob/samples/applet/JacobTestApplet.java
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
package com.jacob.samples.applet;
|
||||||
|
|
||||||
|
import java.applet.Applet;
|
||||||
|
import java.awt.Button;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.TextField;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
|
import com.jacob.activeX.ActiveXComponent;
|
||||||
|
import com.jacob.com.Dispatch;
|
||||||
|
import com.jacob.com.Variant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example applet to demonstrate:
|
||||||
|
* 1. The use of jacob from an applet
|
||||||
|
* 2. To show how to distribute the jacob native lib with the applet (also works with webstart)
|
||||||
|
*
|
||||||
|
* Comment on 2.:
|
||||||
|
* The way shown here is quite straight forward and it is not necessary to use
|
||||||
|
* a mechanism like the "DLLFromJARClassLoader" or something similar...
|
||||||
|
*
|
||||||
|
* @author ttreeck, www.nepatec.de
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class JacobTestApplet extends Applet implements ActionListener {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4492492907986849158L;
|
||||||
|
|
||||||
|
TextField in;
|
||||||
|
TextField out;
|
||||||
|
Button calc;
|
||||||
|
ActiveXComponent sC = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* startup method
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void init() {
|
||||||
|
setLayout(new FlowLayout());
|
||||||
|
add(this.in = new TextField("1+1", 16));
|
||||||
|
add(this.out = new TextField("?", 16));
|
||||||
|
add(this.calc = new Button("Calculate"));
|
||||||
|
this.calc.addActionListener(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns information about this applet.
|
||||||
|
* According to the java spec:
|
||||||
|
* "An applet should override this method to return a String containing information about the author, version, and copyright of the applet."
|
||||||
|
*
|
||||||
|
* @return information about the applet.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getAppletInfo() {
|
||||||
|
return "Jacob Test Applet. Written by ttreeck, nepatec GmbH & Co. KG.\nhttp://www.nepatec.de";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns information about the parameters that are understood by this applet.
|
||||||
|
* According to the java spec:
|
||||||
|
* "An applet should override this method to return an array of Strings describing these parameters."
|
||||||
|
*
|
||||||
|
* @return array with a set of three Strings containing the name, the type, and a description.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[][] getParameterInfo(){
|
||||||
|
return new String[][]{};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* action method that receives button actions
|
||||||
|
*
|
||||||
|
* @param ev the event
|
||||||
|
*/
|
||||||
|
public void actionPerformed(ActionEvent ev) {
|
||||||
|
if (this.sC == null) {
|
||||||
|
String lang = "VBScript";
|
||||||
|
this.sC = new ActiveXComponent("ScriptControl");
|
||||||
|
Dispatch.put(this.sC, "Language", lang);
|
||||||
|
}
|
||||||
|
Variant v = Dispatch.call(this.sC, "Eval", this.in.getText());
|
||||||
|
this.out.setText(v.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
59
samples/com/jacob/samples/applet/Readme.txt
Normal file
59
samples/com/jacob/samples/applet/Readme.txt
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
There is an easy and elegant way to load DLLs from Applets and JavaWebStart Applications.
|
||||||
|
|
||||||
|
Both JavaWebStart and Applets support JNLP (Applets since 1.6.0_10 aka plugin2).
|
||||||
|
Within a jnlp file it is possible to specify a nativelib and that's it!
|
||||||
|
So what do you need to do?
|
||||||
|
|
||||||
|
1.) package the jacob-1.XX-xXX.dll into a jar file (root level of the jar, not into a subfolder) and put it into your applications lib folder next to your other libs (e.g. jacob.jar)
|
||||||
|
2.) Specify all your libraries in your jnlp file like this:
|
||||||
|
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<jnlp href="MyApplicaton.jnlp" spec="1.0+" version="1.1">
|
||||||
|
|
||||||
|
<information>
|
||||||
|
<title>My cool Application or Applet</title>
|
||||||
|
<vendor>nepatec GmbH & Co. KG</vendor>
|
||||||
|
<offline-allowed />
|
||||||
|
</information>
|
||||||
|
|
||||||
|
<security>
|
||||||
|
<all-permissions/>
|
||||||
|
</security>
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<j2se href="http://java.sun.com/products/autodl/j2se" version="1.6.0_10+" />
|
||||||
|
<jar href="MyCoolApp.jar" main="true" version="1.0.0" />
|
||||||
|
<jar href="jacob.jar" version="1.0.0" />
|
||||||
|
<nativelib href="jacob-1.XX-xXX.jar"/>
|
||||||
|
</resources>
|
||||||
|
|
||||||
|
<!-- Use either this for an applet -->
|
||||||
|
<applet-desc
|
||||||
|
name="MyCoolApp"
|
||||||
|
main-class="de.nepatec.app.MyCoolApplet"
|
||||||
|
width="265"
|
||||||
|
height="60">
|
||||||
|
</applet-desc>
|
||||||
|
|
||||||
|
<!-- or this for an web start application -->
|
||||||
|
<application-desc main-class="de.nepatec.app.MyCoolApp">
|
||||||
|
<argument>some crazy arguments</argument>
|
||||||
|
</application-desc>
|
||||||
|
</jnlp>
|
||||||
|
|
||||||
|
3.) Sign all the jars or set up a policy file (cp. Applet Security below)
|
||||||
|
4.) Deploy your application and start it via webstart or as an applet (from an webpage)
|
||||||
|
|
||||||
|
|
||||||
|
General comments:
|
||||||
|
|
||||||
|
- If you sign the jar files you need the <security> tag - when using a policy file it can be removed
|
||||||
|
- furthermore it is recommended that all libs are signed with an official certificate (e.g. from verisign, thawte etc) so that the browser doesn't pop a warning stating 'untrusted' application...
|
||||||
|
- to check the validity of your jnlp file the tool JaNeLA (link cp. sources below) is recommended.
|
||||||
|
|
||||||
|
[Sources]
|
||||||
|
New Applet: https://jdk6.dev.java.net/plugin2/
|
||||||
|
Applet JNLP: https://jdk6.dev.java.net/plugin2/jnlp/
|
||||||
|
Applet Security: http://java.sun.com/developer/onlineTraining/Programming/JDCBook/appA.html
|
||||||
|
JNLP API: http://www.oracle.com/technetwork/java/javase/index-141367.html
|
||||||
|
JNLP Verifier: http://pscode.org/janela/
|
||||||
Binary file not shown.
Reference in New Issue
Block a user