放在linux下运行(java -classpath ./browser.jar com.xxx.util.Browser)却报错,
说是找不到某个类,不知道是为什么,
环境变量配好了,
所需的jar也全都放在linux上了。。。
哪位高人遇到过这样的情况不?帮帮小弟吧。。。
10 个解决方案
#1
上错误日志
#2
先把所需要的LIB库都拷贝过去, 然后把要引入的LIB库和要运行的类的入口都配在你的JAR包的MANIFEST文件中.
然后使用java -jar browser.jar 就OK了
然后使用java -jar browser.jar 就OK了
#3
我都配了
Manifest-Version: 1.0
Main-Class: com.xxx.util.Browser
Class-Path: lib/DJNativeSwing.jar lib/DJNativeSwing-SWT.jar lib/MozillaInterfaces-1.8.1.3.jar lib/swt-3.5M6-win32-win32-x86.jar
#4
情况是这样的,我现在做的是在java application中嵌入浏览器,用到了SWT,
所以就报:
[root@server Desktop]# java -jar br.jar
NativeSwing: Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3536 or swt-win32 in swt.library.path, java.library.path or the jar file
NativeSwing: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing: at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
NativeSwing: at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
NativeSwing: at java.lang.Class.forName0(Native Method)
NativeSwing: at java.lang.Class.forName(Class.java:169)
NativeSwing: at org.eclipse.swt.graphics.Device.<clinit>(Unknown Source)
NativeSwing: at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.runNativeSide(NativeInterface.java:796)
NativeSwing: at chrriis.dj.nativeswing.swtimpl.NativeInterface.main(NativeInterface.java:821)
Exception in thread "main" java.lang.RuntimeException: java.net.SocketException: Connection reset
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface.openChannel(OutProcessMessagingInterface.java:64)
at chrriis.dj.nativeswing.swtimpl.MessagingInterface.initialize(MessagingInterface.java:47)
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface.<init>(OutProcessMessagingInterface.java:29)
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface$SwingOutProcessMessagingInterface.<init>(OutProcessMessagingInterface.java:149)
at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.createOutProcessMessagingInterface(NativeInterface.java:682)
at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.createOutProcessCommunicationChannel(NativeInterface.java:436)
at chrriis.dj.nativeswing.swtimpl.NativeInterface.open(NativeInterface.java:187)
at SwtBrowser.main(SwtBrowser.java:55)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2266)
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2279)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2750)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface.openChannel(OutProcessMessagingInterface.java:62)
... 7 more
所以就报:
[root@server Desktop]# java -jar br.jar
NativeSwing: Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3536 or swt-win32 in swt.library.path, java.library.path or the jar file
NativeSwing: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing: at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
NativeSwing: at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
NativeSwing: at java.lang.Class.forName0(Native Method)
NativeSwing: at java.lang.Class.forName(Class.java:169)
NativeSwing: at org.eclipse.swt.graphics.Device.<clinit>(Unknown Source)
NativeSwing: at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.runNativeSide(NativeInterface.java:796)
NativeSwing: at chrriis.dj.nativeswing.swtimpl.NativeInterface.main(NativeInterface.java:821)
Exception in thread "main" java.lang.RuntimeException: java.net.SocketException: Connection reset
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface.openChannel(OutProcessMessagingInterface.java:64)
at chrriis.dj.nativeswing.swtimpl.MessagingInterface.initialize(MessagingInterface.java:47)
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface.<init>(OutProcessMessagingInterface.java:29)
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface$SwingOutProcessMessagingInterface.<init>(OutProcessMessagingInterface.java:149)
at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.createOutProcessMessagingInterface(NativeInterface.java:682)
at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.createOutProcessCommunicationChannel(NativeInterface.java:436)
at chrriis.dj.nativeswing.swtimpl.NativeInterface.open(NativeInterface.java:187)
at SwtBrowser.main(SwtBrowser.java:55)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2266)
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2279)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2750)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface.openChannel(OutProcessMessagingInterface.java:62)
... 7 more
#5
听说在linux下使用swt会有问题是不?
#6
估计是你程序用到的jar包没找到。
你可以把用到的Jar包都写到bash file里。
你可以把用到的Jar包都写到bash file里。
#7
在linux下跑有swt,swing的需要可视图话软件,比如X-Win32或者VNC。
我试过,还行。
我试过,还行。
#8
NativeSwing: Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3536 or swt-win32 in swt.library.path, java.library.path or the jar file
NativeSwing: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
很明显的是在loadLibrary的时候调用JNI找不到本地库. 在WINDOWS上当然可以了, 因为操作系统有WIN32的库. LINUX上面没有 所以报错:UnsatisfiedLinkError. 就是找不到本地库. 去找一个适用于LINUX的swt-3.5M6-win32-win32-x86.jar吧
NativeSwing: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
很明显的是在loadLibrary的时候调用JNI找不到本地库. 在WINDOWS上当然可以了, 因为操作系统有WIN32的库. LINUX上面没有 所以报错:UnsatisfiedLinkError. 就是找不到本地库. 去找一个适用于LINUX的swt-3.5M6-win32-win32-x86.jar吧
#9
swt不是纯java 有些是调用windows的。。看swt生成的窗体就知道了。
#10
问题已解决,非常感谢大家,这次学到很多很多东西,总结一下
1.org.eclipse.swt.SWTError: No more handles [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]
SWTError:没有更多的处理[未知Mozilla的路径(MOZILLA_FIVE_HOME未设置)]
环境:linux下运行swt程序(我出现此问题是,在linux下嵌套浏览器)
原因:firefox版本不一致
解决:重装一个firefox,并设置相关变量
2.Exception in thread "main" org.eclipse.swt.SWTError: No more handles [Could not detect registered XULRunner to use]
环境:用XULRunner 在java application中嵌套浏览器
原因:没有注册XULRunner
解决:window下环境中,在程序中加入,如(第二个参数是下载解压后的存放路径):
static{
System.setProperty("org.eclipse.swt.browser.XULRunnerPath", "C:\\xulrunner");
}
3.Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3536 or swt-win32 in swt.library.path, java.library.path or the jar file
环境:用DJ Natvie Swing时,在java application中嵌套浏览器,且在windows环境下运行正常,
但在linux下却包此异常
原因:windows下与linux下使用的swt jar包不一样
解决:在windows下用swt-3.5M6-win32-win32-x86.jar,在linux下用swt-3.5.1-gtk-linux-x86.jar
希望对后来者有用,再次感谢大家
1.org.eclipse.swt.SWTError: No more handles [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]
SWTError:没有更多的处理[未知Mozilla的路径(MOZILLA_FIVE_HOME未设置)]
环境:linux下运行swt程序(我出现此问题是,在linux下嵌套浏览器)
原因:firefox版本不一致
解决:重装一个firefox,并设置相关变量
2.Exception in thread "main" org.eclipse.swt.SWTError: No more handles [Could not detect registered XULRunner to use]
环境:用XULRunner 在java application中嵌套浏览器
原因:没有注册XULRunner
解决:window下环境中,在程序中加入,如(第二个参数是下载解压后的存放路径):
static{
System.setProperty("org.eclipse.swt.browser.XULRunnerPath", "C:\\xulrunner");
}
3.Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3536 or swt-win32 in swt.library.path, java.library.path or the jar file
环境:用DJ Natvie Swing时,在java application中嵌套浏览器,且在windows环境下运行正常,
但在linux下却包此异常
原因:windows下与linux下使用的swt jar包不一样
解决:在windows下用swt-3.5M6-win32-win32-x86.jar,在linux下用swt-3.5.1-gtk-linux-x86.jar
希望对后来者有用,再次感谢大家
#1
上错误日志
#2
先把所需要的LIB库都拷贝过去, 然后把要引入的LIB库和要运行的类的入口都配在你的JAR包的MANIFEST文件中.
然后使用java -jar browser.jar 就OK了
然后使用java -jar browser.jar 就OK了
#3
我都配了
Manifest-Version: 1.0
Main-Class: com.xxx.util.Browser
Class-Path: lib/DJNativeSwing.jar lib/DJNativeSwing-SWT.jar lib/MozillaInterfaces-1.8.1.3.jar lib/swt-3.5M6-win32-win32-x86.jar
#4
情况是这样的,我现在做的是在java application中嵌入浏览器,用到了SWT,
所以就报:
[root@server Desktop]# java -jar br.jar
NativeSwing: Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3536 or swt-win32 in swt.library.path, java.library.path or the jar file
NativeSwing: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing: at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
NativeSwing: at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
NativeSwing: at java.lang.Class.forName0(Native Method)
NativeSwing: at java.lang.Class.forName(Class.java:169)
NativeSwing: at org.eclipse.swt.graphics.Device.<clinit>(Unknown Source)
NativeSwing: at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.runNativeSide(NativeInterface.java:796)
NativeSwing: at chrriis.dj.nativeswing.swtimpl.NativeInterface.main(NativeInterface.java:821)
Exception in thread "main" java.lang.RuntimeException: java.net.SocketException: Connection reset
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface.openChannel(OutProcessMessagingInterface.java:64)
at chrriis.dj.nativeswing.swtimpl.MessagingInterface.initialize(MessagingInterface.java:47)
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface.<init>(OutProcessMessagingInterface.java:29)
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface$SwingOutProcessMessagingInterface.<init>(OutProcessMessagingInterface.java:149)
at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.createOutProcessMessagingInterface(NativeInterface.java:682)
at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.createOutProcessCommunicationChannel(NativeInterface.java:436)
at chrriis.dj.nativeswing.swtimpl.NativeInterface.open(NativeInterface.java:187)
at SwtBrowser.main(SwtBrowser.java:55)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2266)
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2279)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2750)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface.openChannel(OutProcessMessagingInterface.java:62)
... 7 more
所以就报:
[root@server Desktop]# java -jar br.jar
NativeSwing: Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3536 or swt-win32 in swt.library.path, java.library.path or the jar file
NativeSwing: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing: at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
NativeSwing: at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
NativeSwing: at java.lang.Class.forName0(Native Method)
NativeSwing: at java.lang.Class.forName(Class.java:169)
NativeSwing: at org.eclipse.swt.graphics.Device.<clinit>(Unknown Source)
NativeSwing: at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.runNativeSide(NativeInterface.java:796)
NativeSwing: at chrriis.dj.nativeswing.swtimpl.NativeInterface.main(NativeInterface.java:821)
Exception in thread "main" java.lang.RuntimeException: java.net.SocketException: Connection reset
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface.openChannel(OutProcessMessagingInterface.java:64)
at chrriis.dj.nativeswing.swtimpl.MessagingInterface.initialize(MessagingInterface.java:47)
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface.<init>(OutProcessMessagingInterface.java:29)
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface$SwingOutProcessMessagingInterface.<init>(OutProcessMessagingInterface.java:149)
at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.createOutProcessMessagingInterface(NativeInterface.java:682)
at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.createOutProcessCommunicationChannel(NativeInterface.java:436)
at chrriis.dj.nativeswing.swtimpl.NativeInterface.open(NativeInterface.java:187)
at SwtBrowser.main(SwtBrowser.java:55)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2266)
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2279)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2750)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
at chrriis.dj.nativeswing.swtimpl.OutProcessMessagingInterface.openChannel(OutProcessMessagingInterface.java:62)
... 7 more
#5
听说在linux下使用swt会有问题是不?
#6
估计是你程序用到的jar包没找到。
你可以把用到的Jar包都写到bash file里。
你可以把用到的Jar包都写到bash file里。
#7
在linux下跑有swt,swing的需要可视图话软件,比如X-Win32或者VNC。
我试过,还行。
我试过,还行。
#8
NativeSwing: Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3536 or swt-win32 in swt.library.path, java.library.path or the jar file
NativeSwing: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
很明显的是在loadLibrary的时候调用JNI找不到本地库. 在WINDOWS上当然可以了, 因为操作系统有WIN32的库. LINUX上面没有 所以报错:UnsatisfiedLinkError. 就是找不到本地库. 去找一个适用于LINUX的swt-3.5M6-win32-win32-x86.jar吧
NativeSwing: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
很明显的是在loadLibrary的时候调用JNI找不到本地库. 在WINDOWS上当然可以了, 因为操作系统有WIN32的库. LINUX上面没有 所以报错:UnsatisfiedLinkError. 就是找不到本地库. 去找一个适用于LINUX的swt-3.5M6-win32-win32-x86.jar吧
#9
swt不是纯java 有些是调用windows的。。看swt生成的窗体就知道了。
#10
问题已解决,非常感谢大家,这次学到很多很多东西,总结一下
1.org.eclipse.swt.SWTError: No more handles [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]
SWTError:没有更多的处理[未知Mozilla的路径(MOZILLA_FIVE_HOME未设置)]
环境:linux下运行swt程序(我出现此问题是,在linux下嵌套浏览器)
原因:firefox版本不一致
解决:重装一个firefox,并设置相关变量
2.Exception in thread "main" org.eclipse.swt.SWTError: No more handles [Could not detect registered XULRunner to use]
环境:用XULRunner 在java application中嵌套浏览器
原因:没有注册XULRunner
解决:window下环境中,在程序中加入,如(第二个参数是下载解压后的存放路径):
static{
System.setProperty("org.eclipse.swt.browser.XULRunnerPath", "C:\\xulrunner");
}
3.Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3536 or swt-win32 in swt.library.path, java.library.path or the jar file
环境:用DJ Natvie Swing时,在java application中嵌套浏览器,且在windows环境下运行正常,
但在linux下却包此异常
原因:windows下与linux下使用的swt jar包不一样
解决:在windows下用swt-3.5M6-win32-win32-x86.jar,在linux下用swt-3.5.1-gtk-linux-x86.jar
希望对后来者有用,再次感谢大家
1.org.eclipse.swt.SWTError: No more handles [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]
SWTError:没有更多的处理[未知Mozilla的路径(MOZILLA_FIVE_HOME未设置)]
环境:linux下运行swt程序(我出现此问题是,在linux下嵌套浏览器)
原因:firefox版本不一致
解决:重装一个firefox,并设置相关变量
2.Exception in thread "main" org.eclipse.swt.SWTError: No more handles [Could not detect registered XULRunner to use]
环境:用XULRunner 在java application中嵌套浏览器
原因:没有注册XULRunner
解决:window下环境中,在程序中加入,如(第二个参数是下载解压后的存放路径):
static{
System.setProperty("org.eclipse.swt.browser.XULRunnerPath", "C:\\xulrunner");
}
3.Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3536 or swt-win32 in swt.library.path, java.library.path or the jar file
环境:用DJ Natvie Swing时,在java application中嵌套浏览器,且在windows环境下运行正常,
但在linux下却包此异常
原因:windows下与linux下使用的swt jar包不一样
解决:在windows下用swt-3.5M6-win32-win32-x86.jar,在linux下用swt-3.5.1-gtk-linux-x86.jar
希望对后来者有用,再次感谢大家