简体   繁体   English

如何将LWJGL 3.1.1添加到netbeans以在Java项目中使用?

[英]How do I add LWJGL 3.1.1 to netbeans to use in a Java project?

I want to use the Light Weight Java Gaming Library(LWJGL) to my Netbeans so I can use it in my Java application. 我想在Netbeans中使用轻量级Java游戏库(LWJGL),以便可以在Java应用程序中使用它。 The only videos that I can find show the zip file that they downloaded with separate src and doc folders inside of it. 我能找到的唯一视频显示了他们下载的zip文件,其中包含单独的src和doc文件夹。 The zip file that I download has everything in one directory. 我下载的zip文件将所有内容都放在一个目录中。 I went to lwjgl.org/download and clicked on Stable and then Generate Bundle. 我去了lwjgl.org/download,然后单击“稳定”,然后单击“生成捆绑包”。 What am I missing? 我想念什么?

I had the same problem recently. 我最近有同样的问题。

LWJGL-Netbeans-Setup-Step-1 So, to begin you want to go to Tools in the context menu and select Libraries (as shown). 因此,首先,您要转到上下文菜单中的“ 工具” ,然后选择“ 库” (如图所示)。 Next you can add a new library and name it eg LWJGL-3.1.1 confirm with ok. 接下来,您可以添加一个新库,并将其命名为LWJGL-3.1.1单击确定。 You can find 3 tabs in the current window Classpath , Sources and Javadoc . 您可以在当前窗口的ClasspathSourcesJavadoc中找到3个选项卡。 There you add your jar files accordingly (in the downloaded .zip file you find .jar files with different names like lwjgl-{whatever}-sources.jar or lwjgl-{whatever}-javadocs.jar ) make sure you put them in the right place. 在其中,您相应地添加jar文件(在下载的.zip文件中,您会找到具有不同名称的.jar文件,例如lwjgl- {whatever} -sources.jarlwjgl- {whatever} -javadocs.jar ),请确保将它们放在正确的位置。 You have to repeat this process for all of the jar files you want. 您必须对所需的所有jar文件重复此过程。 The javadoc files are not required but recommended. Javadoc文件不是必需的,但建议使用。 Make sure you also collect all the native .dll files and merge them in a folder called \\natives . 确保您还收集了所有本机.dll文件,并将它们合并到名为\\natives的文件夹中。 You find them in these jar files that are called like: lwjgl-{whatever}-{your-OS}.jar . 您可以在名为以下文件的这些jar文件中找到它们: lwjgl- {whatever}-{your-OS} .jar

LWJGL-Netbeans-Setup-Step-2

Once you have finished the setup for your library right click on your current project and choose Add Library... . 完成库的设置后,右键单击当前项目,然后选择“ 添加库...” In the window that pops up you scroll down until you find your library that you have just created and you are almost done now. 在弹出的窗口中,向下滚动直到找到您刚创建的库,并且现在差不多完成了。

LWJGL-Netbeans-Setup-Step-3

Last but not least go to the project settings. 最后但并非最不重要的一点是转到项目设置。 Select Run and make sure that you set the classpath in VM options to something like in the image: -Djava.library.path="C:\\java_workspace\\LWJGL Library 3.1\\natives . Now this classpath tells netbeans where your native files are located. Your \\natives folder that you should have created in the beginning is where this path should lead to. That's it. This is all you have to do for a setup without the use of maven, gradle, ... 选择“运行” ,并确保将VM选项中的类路径设置为如下图所示: -Djava.library.path="C:\\java_workspace\\LWJGL Library 3.1\\natives 。现在,此类路径告诉netbeans本机文件位于何处。您应该在开始时创建的\\natives文件夹就是该路径的目的地。就是这样,这是不使用maven,gradle等设置过程所要做的全部工作。

LWJGL-Netbeans-设置完成

You can test if it is working with the code provided by LWJGL HelloWorld example . 您可以测试它是否与LWJGL HelloWorld示例提供的代码一起使用。

I hope this solved your problem. 我希望这可以解决您的问题。 Best regards. 最好的祝福。

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

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