Jnlp错误:无法找到主类

时间:2013-10-10 08:28:13

标签: java java-web-start jnlp

我也面临类似的问题:

我有TrainingDNA.jnlp用于TrainingDNA.jar。 jar和jnlp都是Linux服务器上的Tomcat Apache 6(webapps / root)的主机。 jnlp在64位Windows操作系统中启动jar文件应用程序,但是当我尝试从: 1. IE浏览器32bit操作系统,Win XP它给我错误:“找不到主类:com.sangha.gui.Main,程序会退出”,我已经启用了java控制台看输出,下面是java控制台错误:

Java Web Start 1.6.0_43
Using JRE version 1.6.0_43-b01 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\s-projectusertwod
----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
m:   print memory usage
o:   trigger logging
p:   reload proxy configuration
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
0-5: set trace level to <n>
----------------------------------------------------
java.class.path=C:\\Program Files\\Java\\jre6\\lib\\deploy.jar
java.majorVersion=1
java.minorVersion=6
Class-Start=com.sangha.gui.Main
Class-Memory=1024
-propsResource
/com/sangha/gui/client.cfg
DNA.Client
Java Path=null
MAX MEMORY=259522560
Executing: javaw.exe -Xmx1024M -classpath C:\\Program Files\\Java\\jre6\\lib\\deploy.jar com.sangha.gui.Main -propsResource /com/sangha/gui/client.cfg DNA.Client
java.lang.NoClassDefFoundError: com/sangha/gui/Main
Caused by: java.lang.ClassNotFoundException: com.sangha.gui.Main
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)

2.从Firefox开始,java Java 6窗口出现,java控制台闪烁一秒钟。

PS:TrainingDNA.jar没有任何问题,因为如果我不使用JNLP并双击并运行它,它在32位运行正常。

以下是我的jnlp文件:

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://192.168.244.25:8080/" href="TrainingDNA.jnlp">
<information>
<title>Training DNA</title>
<vendor>DNA</vendor>
<homepage href="http://www.google.com" />
<description>Web Porting Testing</description>
</information>
<security>
<all-permissions/>
</security>
<resources>
<jar href="TrainingDNA.jar" main="true" />
<j2se version="1.6+" />
</resources>
<application-desc main-class="com.sangha.util.Relauncher" />
</jnlp>

*上面提到的主要类'Relauncher'只是应用程序的入口点,在这个类中它读取一个配置文件'relauncher.config',后者又指定应用程序的主类。配置文件的内容如下:

Class-Start: com.sangha.gui.Main
Class-Memory: 1024
Class-Arg-0: -propsResource
Class-Arg-1: /com/sangha/gui/client.cfg
Class-Arg-2: DNA.Client
java.majorVersion: 1
java.minorVersion: 6 

此致 秋田

1 个答案:

答案 0 :(得分:0)

(@ akita的评论重新发布为答案,以获取一些格式)

它开始在32位Java中工作,但确实做到了:

已替换:

<resources> 
    <j2se version="1.6+" />
    <jar href="TrainingDNA.jar" main="true" /> 
 </resources> 

具有:

<resources> 
    <j2se version="1.6+" java-vm-args="-Xmx1024M"/>
    <jar href="TrainingDNA.jar" main="true" /> 
    <property name="sun.java2d.noddraw" value="true"/> 
</resources>