Ich über gerade Deployment mit jnlp. Ich habe ein Applet, und auf eine von dessen Funktionen will ich erneut vermittels JavaScript zugreifen. Hier ist mein html:
Hier ist meine jnlp-Datei:
[XML]
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="6.0+" codebase="localhost/htdocs/tests" href="app.jnlp">
<information>
<title>Test Application</title>
<vendor>Me</vendor>
<homepage href=""/>
<description>Demo Application</description>
<icon href="images/img.jpg"/>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.6+"/>
<jar href="X.jar" main="true" download ="eager"/>
</resources>
<application-desc main-class="Test1.X"
</application-desc>
</jnlp>
[/XML]
Es kommt immer der Fehler
[QUOTE
calling downloadEagerorAll
0
CacheEntry[http://localhost/tests/app.jnlp]: updateAvailable=true,lastModified=Tue Mar 04 13:54:39 CET 2014,length=1137
JNLParseException[ Startdatei konnte nicht geparst werden. Fehler in Zeile 0.]
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory._buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.initialize(Unknown Source)
at sun.plugin2.main.client.PluginMain.initManager(Unknown Source)
at sun.plugin2.main.client.PluginMain.access$200(Unknown Source)
at sun.plugin2.main.client.PluginMain$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Error while initializing manager: JNLParseException[ Startdatei konnte nicht geparst werden. Fehler in Zeile 0.], bail out
JNLParseException[ Startdatei konnte nicht geparst werden. Fehler in Zeile 0.]
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory._buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.initialize(Unknown Source)
at sun.plugin2.main.client.PluginMain.initManager(Unknown Source)
at sun.plugin2.main.client.PluginMain.access$200(Unknown Source)
at sun.plugin2.main.client.PluginMain$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Error while initializing manager: JNLParseException[ Startdatei konnte nicht geparst werden. Fehler in Zeile 0.], bail out
Java-Plug-in 10.51.2.13
JRE-Version verwenden 1.7.0_51-b13 Java HotSpot(TM) Client VM
[/QUOTE]
Aber ich weiß jetzt auch nicht, was daran falsch ist.
Es handelt sich um ein einfaches Applet, welches ich in ein Archic X.jar gepackt habe. Das Applet hat folgenden Code:
PHP:
<?php
echo '<!DOCTYPE HTML>
<html>
<head>
<title></title>
</head>
<body bgcolor="lightblue">';
echo '<a href="app.jnlp"></a>'; //Hier der Link zur jnlp-Datei.
?>
<script src="https://www.java.com/js/deployJava.js"></script>
<script>
var attributes = {
//id:'myApplet',
//code:'X'
archive:'X.jar'
};
var parameters = { jnlp_href: 'app.jnlp'} ;
deployJava.runApplet(attributes, parameters, '1.7');
</script>
<script language="javascript">
function writeSomething(){
// invoke public applet method
var foo = X.writer();
}
</script>
<?php
echo '</body>';
?>
Hier ist meine jnlp-Datei:
[XML]
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="6.0+" codebase="localhost/htdocs/tests" href="app.jnlp">
<information>
<title>Test Application</title>
<vendor>Me</vendor>
<homepage href=""/>
<description>Demo Application</description>
<icon href="images/img.jpg"/>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.6+"/>
<jar href="X.jar" main="true" download ="eager"/>
</resources>
<application-desc main-class="Test1.X"
</application-desc>
</jnlp>
[/XML]
Es kommt immer der Fehler
[QUOTE
calling downloadEagerorAll
0
CacheEntry[http://localhost/tests/app.jnlp]: updateAvailable=true,lastModified=Tue Mar 04 13:54:39 CET 2014,length=1137
JNLParseException[ Startdatei konnte nicht geparst werden. Fehler in Zeile 0.]
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory._buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.initialize(Unknown Source)
at sun.plugin2.main.client.PluginMain.initManager(Unknown Source)
at sun.plugin2.main.client.PluginMain.access$200(Unknown Source)
at sun.plugin2.main.client.PluginMain$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Error while initializing manager: JNLParseException[ Startdatei konnte nicht geparst werden. Fehler in Zeile 0.], bail out
JNLParseException[ Startdatei konnte nicht geparst werden. Fehler in Zeile 0.]
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory._buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.initialize(Unknown Source)
at sun.plugin2.main.client.PluginMain.initManager(Unknown Source)
at sun.plugin2.main.client.PluginMain.access$200(Unknown Source)
at sun.plugin2.main.client.PluginMain$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Error while initializing manager: JNLParseException[ Startdatei konnte nicht geparst werden. Fehler in Zeile 0.], bail out
Java-Plug-in 10.51.2.13
JRE-Version verwenden 1.7.0_51-b13 Java HotSpot(TM) Client VM
[/QUOTE]
Aber ich weiß jetzt auch nicht, was daran falsch ist.
Es handelt sich um ein einfaches Applet, welches ich in ein Archic X.jar gepackt habe. Das Applet hat folgenden Code:
Java:
import javax.swing.*;
import java.awt.*;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.*;
public class X extends JApplet{
public void writer(){
try {
File file = new File("text.txt");
// if file doesnt exists, then create it
if (!file.exists()) {
file.createNewFile();
}
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
bw.write("Hier steht etwas.");
bw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public void init(){
setLayout(new BorderLayout());
getContentPane().setBackground(Color.YELLOW);//Um die Farbe zu setzen, ist ContentPane noetig.
JLabel label = new JLabel("Hello!");
label.setHorizontalAlignment(JLabel.CENTER);
label.setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.black));
label.setPreferredSize(new Dimension(3, 2));
add(label, BorderLayout.CENTER);
}
}