简体   繁体   English

使用JNLP启动后,应用程序无响应

[英]Unresponsive application after launched with JNLP

I'm looking into the JNLP stuff and I decided to try to run a small application that I made with JNLP. 我正在研究JNLP内容,因此决定尝试运行一个用JNLP制作的小型应用程序。 I created a simple java program and the jnlp file. 我创建了一个简单的Java程序和jnlp文件。 I upload both the jar file and the jnlp file to my apache server, along with an html file to display the Launch button. 我将jar文件和jnlp文件都上传到了我的apache服务器,同时将一个html文件上传到了显示启动按钮的位置。 This is the jnlp file (I'm not 100% sure if it's correct): 这是jnlp文件(我不确定100%是否正确):

<?xml version="1.0" encoding="UTF-8"?>
  <jnlp spec="1.0+" codebase="http://localhost:8080/" href="example.jnlp">
  <information>
      <title>Example</title>
      <vendor>Dev</vendor>
  </information>
  <resources>
      <!-- Application Resources -->
      <j2se version="1.6+"
            href="http://java.sun.com/products/autodl/j2se"/>
      <jar href="Example.jar" main="true" />

  </resources>
  <application-desc name="Example"
       main-class="main.Example"
       width="600"
       height="600">
   </application-desc>
   <update check="background"/>
  </jnlp>

The following is my html file on my apache server: 以下是我的apache服务器上的html文件:

<html>
  <head>
    <title>Example</title>
  </head>
  <body>
    <script src="http://www.java.com/js/deployJava.js"></script>
    <script>
      // using JavaScript to get location of JNLP file relative to HTML page
      var dir = location.href.substring(0, location.href.lastIndexOf('/')+1);
      var url = dir + "example.jnlp";
  document.alert(dir);
      deployJava.createWebStartLaunchButton(url, '1.6.0');
    </script>
  </body>
</html>

The problem is, when I click the Launch button it asks if I want to run example.jnlp. 问题是,当我单击启动按钮时,它询问是否要运行example.jnlp。 Then after a bit the application just opens up but when I click any the buttons they do nothing. 然后,应用程序刚刚打开,但是当我单击任何按钮时,它们什么也不做。 It's as if the GUI is showing but all over the under lying logic is not there. 好像GUI正在显示,但整个底层逻辑都不存在。 Any idea what may be the issue? 知道可能是什么问题吗?

..This is the jnlp file (I'm not 100% sure if it's correct): .. ..这是jnlp文件(我不确定100%是否正确):..

It is not 100% correct. 这不是100%正确的。 Check it using JaNeLA . 使用JaNeLA进行检查。 Of most concern is the HREF of "examp.jnlp", which does not seem to match the actual name. 最值得关注的是“ examp.jnlp”的HREF,它似乎与实际名称不匹配。

..The following is my html .. ..以下是我的HTML ..

Which is also over complicated, and quite probably invalid, though I doubt that is the problem here. 这也很复杂,而且很可能无效,尽管我怀疑这是问题所在。 For the moment, launch the JNLP from a plain old HTML link. 目前,从一个普通的旧HTML链接启动JNLP。 I am guessing you are testing from a machine running 1.6+ Java, so the deployJava.js is not necessary at this stage. 我猜您正在从运行1.6+ Java的计算机上进行测试,因此在此阶段不需要deployJava.js。

..after a bit the application just opens up but when I click any the buttons they do nothing. ..过了一会儿,应用程序才打开,但是当我单击任何按钮时,它们什么也不做。 It's as if the GUI is showing but all over the under lying logic is not there. 好像GUI正在显示,但整个底层逻辑都不存在。 Any idea what may be the issue? 知道可能是什么问题吗?

Without code it is a little hard to say. 没有代码,这很难说。 But some preliminary questions are: 但是一些初步的问题是:

  1. Does the code swallow exceptions at any stage? 代码是否在任何阶段都吞下了异常 (If so, fix that immediately!) (如果是这样,请立即解决!)

  2. What is reported in the Java Console when the application launches? 应用程序启动时,Java控制台报告什么? When debugging, it is essential to ensure the console pops open for every launch of a Java applet or JWS app. 调试时,必须确保每次启动Java applet或JWS应用程序时都打开控制台弹出窗口。 Console visibility is configured via the Java Control Panel . 控制台可见性是通过Java控制面板配置的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM