Run Java OpenGL (JOGL) on Linux

shawon

Shawon Saha

Posted on March 27, 2021

Run Java OpenGL (JOGL) on Linux

At first, make sure you have java installed on your system. To check that open Terminal (ctrl + alt + t) and run java -version

OpenJDK Linux

If you don't see any version then you have to install OpenJDK on your system. To do that run these two commands

sudo apt-get install openjdk-11-jre
sudo apt-get install openjdk-11-jdk

and check your java -version again.

Once you successfully install java on your system then you have to install JOGL. To do that run this command on terminal.

sudo apt-get install libjogl2-java

After installing JOGL install eclipse

Now Open Eclipse and Create a Java project and give your project a name.

Create a Java Project
You can also find it under File > New > Java Project

After giving a nice name in your project Click Next
Project Name

From the Libraries select Classpath and click Add External JARs Add External JARs

Navigate to /usr/share/java/ and choose these two files jogl2.jar and gluegen2-rt.jar.If you import correctly then You should see those file's paths under Classpath. Now click Finish (You can skip creating Module).
image

Now expand your project from the sidebar and right-click on src then Create a new class

image

If everything is done correctly a Canvas window will pop up after running your JOGL code!

image

💖 💪 🙅 🚩
shawon
Shawon Saha

Posted on March 27, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Run Java OpenGL (JOGL) on Linux
linux Run Java OpenGL (JOGL) on Linux

March 27, 2021