Difference between revisions of "Setting up Slick2D with NetBeansIDE"
From Slick2D Wiki
m (Minor edit, fixed broken link.) |
|||
(4 intermediate revisions by 4 users not shown) | |||
Line 11: | Line 11: | ||
* Download [http://www.lwjgl.org/download LWJGL] standard bundle | * Download [http://www.lwjgl.org/download LWJGL] standard bundle | ||
− | * Extract the LWJGL zip (lwjgl-x.x.zip) file somewhere in your computer, remember or note down the location, you will need this later. We suggest you create a library (/lib) folder to store all these files in a well-known place. | + | * Extract the LWJGL zip (lwjgl-x.x.zip) file somewhere in your computer, remember or note down the location, you will need this later. We suggest you create a library (/lib) folder to store all these files in a well-known place. |
+ | * As of 9/16, the above Slick2D link will download a version that is not compatible with LWJGL 3. Try [https://sourceforge.net/projects/java-game-lib/files/Official%20Releases/LWJGL%202.9.3/ 2.9.3] instead. | ||
==Setting Up Slick2D and LWJGL in NetBeans== | ==Setting Up Slick2D and LWJGL in NetBeans== | ||
Line 42: | Line 43: | ||
Note: Remember to select the natives of your operating system. | Note: Remember to select the natives of your operating system. | ||
+ | |||
+ | ==Debugging== | ||
+ | |||
+ | * Seen from experience on 13/9/2017 (Windows): | ||
+ | # If an error claiming "Error: Could not find or load main class Files\NetBeans" comes up, try the following: | ||
+ | ## Copy '''all the .dlls*''' from the folder where you extracted Slick2D to a folder in your project. Eg.: ProjectsFolder/natives | ||
+ | ## In project (right-click) > properties > run > VM options (as described above) place this line instead: "-Djava.library.path=.\natives" where instead of "natives" you place the name of the folder where you pasted the .dlls in your project (Eg.: ProjectsFolder/natives). | ||
+ | Part of this solution, can be seen in this video: https://youtu.be/4IUAQEnYtK8?t=4m59s | ||
+ | |||
+ | ''<nowiki>*</nowiki>'' In case your downloaded version of Slick2D doesn't contain the '''.dlls''', I guess you could find them somewhere in the folder where you extracted the LWJGL... I didn't found them anywhere in LWJGL though! | ||
[[Category:Tutorials]] | [[Category:Tutorials]] |
Latest revision as of 08:35, 8 May 2018
Contents
Introduction[edit]
This tutorial will run you through the steps you'll need to set Slick2D up with NetBeans.
Since Slick2D uses LWJGL, setup is split into 2 parts, the JAR files, and the LWJGL natives (*.dll files for Windows, *.so files for Unix and Linux and *.dylib/*.jnilib for Mac).
Downloading and Extracting Slick2D and LWJGL[edit]
- Extract the LWJGL zip (lwjgl-x.x.zip) file somewhere in your computer, remember or note down the location, you will need this later. We suggest you create a library (/lib) folder to store all these files in a well-known place.
- As of 9/16, the above Slick2D link will download a version that is not compatible with LWJGL 3. Try 2.9.3 instead.
Setting Up Slick2D and LWJGL in NetBeans[edit]
Extracted from LWJGL with Netbeans
- Open up NetBeans.
- Go to Tools --> Libraries in the menu bar.
- Click on the New Library button.
- Type in Slick2D or any other name that you want for the Library Name.
- Select Classpath tab for your newly created Library and then click the Add JAR/Folder... button.
- Go to where you extracted lwjgl-X.X.zip and add the following '.jar'('Ctrl' or 'Alt' to select multiple files)
- lwjgl.jar
- slick.jar
- jinput.jar
- lwjgl_util.jar (if want to use OpenGL's GLU class)
Setting Up a Project to use LWJGL in NetBeans[edit]
- In a new Java project:
- Right-Click your project node or go to File>Project Properties and select Libraries
- Add your Slick2D Library , created as instructed above
- Select Run
- On VM Options put the following:
-Djava.library.path=<lwjgl-X.X path>/native/<linux|macosx|solaris|windows>
Note: Remember to select the natives of your operating system.
Debugging[edit]
- Seen from experience on 13/9/2017 (Windows):
- If an error claiming "Error: Could not find or load main class Files\NetBeans" comes up, try the following:
- Copy all the .dlls* from the folder where you extracted Slick2D to a folder in your project. Eg.: ProjectsFolder/natives
- In project (right-click) > properties > run > VM options (as described above) place this line instead: "-Djava.library.path=.\natives" where instead of "natives" you place the name of the folder where you pasted the .dlls in your project (Eg.: ProjectsFolder/natives).
Part of this solution, can be seen in this video: https://youtu.be/4IUAQEnYtK8?t=4m59s
* In case your downloaded version of Slick2D doesn't contain the .dlls, I guess you could find them somewhere in the folder where you extracted the LWJGL... I didn't found them anywhere in LWJGL though!