English 中文(简体)
Java - 图书馆道路错误
原标题:Java - Library path error
  • 时间:2012-04-08 14:26:22
  •  标签:
  • java
  • path

我不想开始我的 j球游戏,但我对java指挥线有一些麻烦:

这里指的是:

C:>java - Djava.library.path=%cd%lib -jar 游戏。

这里我说的是:

Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
    at com.game.Main.main(Main.java:7)
    Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
    at java.net.URLClassLoader$1.run(Unknown Source)
    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)
    ... 1 more

我可以开始对Eclipse(With Ron as Java Application)的游戏,但在菜单出现以下错误之后:

Exception in thread "Thread-5" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at org.lwjgl.Sys$1.run(Sys.java:72)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.lwjgl.Sys.doLoadLibrary(Sys.java:65)
    at org.lwjgl.Sys.loadLibrary(Sys.java:81)
    at org.lwjgl.Sys.<clinit>(Sys.java:98)
    at org.lwjgl.opengl.Display.<clinit>(Display.java:129)
    at com.game.displaygui.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

<代码>lwjgl.jar已输入lib/code>。

你们能否向我解释一下?

感谢。

最佳回答

这是因为图书馆由两个部分组成:

  • the .jar file which contains Java code
  • and the native binary library (which can be .so or .dll or .dylib according to your OS)

你发现的第一个错误是,因为你正在确定图书馆的道路,这应当包含native的图书馆,但它确实含有“.jar”。 因此,请见java.lang.NoClassDefFoundError。 因为你要么把图书馆通往有土著图书馆的夹,要么把教室放在真正的lwjgl.jar<>/em>档案中。

您接手Eclipse的第二种错误是连续的一步:您的班次含有Jar图书馆,但无法找到附属的土著图书馆,你可以采取以下方式:

“entergraph

问题回答

您应明确列出哪些校准档案包括(由......编辑);

-cp %cd%liblwjdl.jar;%cd%lib<another-lib>.jar

不要使用野心片,因为它会造成比好更大的伤害(从以往的经验来看:)

请使用<代码>java.library.path的备选办法,具体说明土著图书馆的装货地点。 在这种办法指明的地点,你将存放LWJGL所要求的所有<代码>dll或。 另一方面,你需要确保通过<代码>-舱载<>>/代码>的所有必需的JAR档案都列入你的类别。 目前,您的JAR档案存放在错误的目录中。

在Eclipse,如果你使用ma。

在“Run”项目中添加以下内容:“VER办法”。

-Djava.library.path=yourpath/youproject/java/target/natives




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...