简体   繁体   English

IntelliJ Linux LWJGL 3将本机添加到

[英]IntelliJ Linux LWJGL 3 Add natives to

I wanted to try out the new LWJGL 3 which is currently in kind of a "beta"-state. 我想尝试一下新的LWJGL 3,它目前处于“ beta”状态。 Embarrassingly I can't even get the HelloWorld example ( http://www.lwjgl.org/guide ) to run. 令人尴尬的是,我什至无法运行HelloWorld示例( http://www.lwjgl.org/guide )。

package org.lwjgl.glfw does not exist 软件包org.lwjgl.glfw不存在

is all I get. 是我所得到的。

I added the lwjgl.jar and disruptor.jar to my module dependencies, but I guess I'm missing something about the natives here. 我将lwjgl.jar和interruptor.jar添加到我的模块依赖项中,但是我想我在这里缺少有关本机的某些信息。 I tried adding them as a lib, as a module (which tells me it's an empty library although there are two .so files in there oO) 我尝试将它们添加为lib,作为模块(这告诉我这是一个空库,尽管那里有两个.so文件)

I tried setting the -Djava.library.path of course, no success here: 我尝试设置-Djava.library.path当然没有成功:

-Djava.library.path=home/teolha/lwjgl-test/lib/natives/linux/x64

I tried invalidating caches, adding it as system lib and about everything I know. 我尝试使缓存无效,将其添加为系统库以及我所知道的所有内容。 Still, the glfw package can't be found. 仍然找不到glfw软件包。

I'm not sure what I'm doing wrong, but I've never done this in IntelliJ 14, neither with lwjgl 3, so maybe something has completely changed here? 我不确定自己在做什么错,但是我从来没有在IntelliJ 14中做到这一点,也没有使用lwjgl 3,所以这里的某些事情可能已经完全改变了吗?

Any help appreciated! 任何帮助表示赞赏!

Before anything else, I'm using LWJGL 3 NIGHTLY. 首先,我正在使用LWJGL 3 NIGHTLY。

I've just managed to build and launch LWJGL 3's HelloWord. 我刚刚设法构建并启动了LWJGL 3的HelloWord。 Does this help? 这有帮助吗?

From lwjgl.org/guide: 从lwjgl.org/guide:

  • Add the LWJGL jars to the classpath. 将LWJGL罐子添加到类路径。 This is usually done by setting up a library dependency for your project and attaching jars to it. 通常通过为您的项目设置库依赖项并将jars附加到它上来完成。

In my case, compiling with this worked 以我为例,使用它编译

javac -cp ../jar/disruptor.jar:../jar/lwjgl.jar: -d . *.java
  • Set the -Djava.library.path system property (as a JVM launch argument) to the appropriate path for the target OS/architecture 将-Djava.library.path系统属性(作为JVM启动参数)设置为目标OS /体系结构的适当路径

And actually launching the tutorial worked with this. 并实际上启动了该教程。

java -classpath ../jar/disruptor.jar:../jar/lwjgl.jar: -Djava.library.path=../native/linux/x64/ org.lwjgl.demo.glfw.HelloWord

Be sure to adjust the path if needed. 如果需要,请确保调整路径。

edit: I just realized you were probably asking for a solution with intellij, in which case I'm not sure if this is helpful. 编辑:我只是意识到您可能正在使用intellij寻求解决方案,在这种情况下,我不确定这是否有帮助。

So, well, the error wasn't on my side. 所以,好吧,错误不在我这边。

LWJGL 3 is under heavy development currently and the latest stable version wouldn't match the example, thus I had to use the latest nightly. LWJGL 3当前正在大量开发中,最新的稳定版本与该示例不匹配,因此我不得不每晚使用最新版本。

(The api changed significantly) (API发生了很大变化)

My solution is: 我的解决方案是:

Add the jars as libs and add the .so files as lib as well. 将罐子添加为libs,并将.so文件也添加为lib。 That way you don't need to specify a library path argument :) 这样,您无需指定库路径参数:)

Works like a charm with the new lwjgl-api! 使用新的lwjgl-api就像魅力一样!

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

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