Public Group

# Java - OpenGL?

This topic is 2926 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello,

I'm starting to get the hang of java, but I don't know where to go to start working with graphics. My focus is fullscreen 3d games, so I tried to use JOGL, but I can't seem to find the libraries for it. I've gotten LWJGL but it doesn't seem to work with netbeans. Am I missing something, is there another library I should be using instead? Thanks.

Antone

##### Share on other sites
While I don't personally use Netbeans there should be nothing which prevents you from using LWJGL. "Doesn't seem to work" however is, as error descriptions go, completely useless. The most obvious beginner problem would be failing to specify the location of the needed native libraries but without information it is impossible to give reasonable help.

##### Share on other sites
You could also consider using jMonkeyEngine if you're after something slightly higher-level -- from the website:
[font="Arial"][color="#222222"]The jMonkeyEngine 3 is a 3D game framework for Java developers. You can use it for free to create 3D games that run on Windows, Mac OS, and Linux; true cross-platform thanks to the JavaVM. This third major iteration of the engine has been completly rewritten — Only the best-of-breed code from the previous jME2 project was brushed up and optimized, the rest is completely from scratch for fewer limitations and more power to match the current and next generation of hardware.[/font][/quote]

BitMaster is correct however, there's no particular reason you shouldn't be able to use LWJGL with Netbeans, and if you describe your problems in more detail we should be able to help you get it working.

Hope that helps!

##### Share on other sites
Sorry, I was following a tutorial here. I've created a library for lwjgl in netbeans, included the .jars, and added a path to the native folder just as the installation tutorial on lwjgl.org said. Yet, I'm still getting an error.
 Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.lwjgl.opengl.Display at gtest.Main.destroy(Main.java:91) at gtest.Main.main(Main.java:56) 

the lines referenced are:
 91: Display.destroy(); 56: Main.destroy(); 
Everything else works fine, it just doesn't like those for some reason.

##### Share on other sites
Since org.lwjgl.opengl.Display is likely implicitly loading the native libraries somewhere this looks indeed like you did not set the native library location correctly. Make sure the folder you specified does indeed contain the required DLLs/library files for your platform. Take note that the standard LWJGL distribution contains the actual libraries not in the native directory but in the platform specific subdirectories. Otherwise, double check you specified these paths correctly for Netbeans or consider setting the Java command line switch to set a native directory directly.
While jbadam's suggestion of using a higher level library like jMonkeyEngine or Slick has certainly some merit, these libraries also rely on LWJGL (or maybe JOGL) under the hood.

Edit: Actually, I just tested it under Eclipse and I get a java.lang.UnsatisfiedLinkError if the native libraries are not properly present. NoClassDefFoundError suggests then that Java cannot actually find the corresponding class file, although I had a faint memory of that exception also being thrown when it is not possible to load the class because the static initializer fails. I cannot really guess how an error like that happens because usually the compiler would already refuse to compile a Java file if neither the class file of a referenced class nor its source is present. And it seems unlikely Netbeans manages different Jar setup for compiling and running something.

##### Share on other sites
I suppose so. I had a typo in my path to the native folder. I assume you program in java? What ide do you use, and would you recommend it over netbeans?

##### Share on other sites
I have always liked Eclipse and used it for several years. Back then Netbeans felt inferior but they are supposed to have made a lot of progress since then. I haven't checked it out myself for a long time though, so I cannot draw any conclusions here.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 12
• 13
• 9
• 25
• ### Forum Statistics

• Total Topics
634444
• Total Posts
3017495
×