Frustrated Beginner - How to import a jar file, package does not exist
807599Mar 16 2007 — edited Apr 5 2007Hi folks. I have spent hours and hours researching this and cannot get it to work. Believe me, I have read all about the classpath and search paths and such, but I am stuck.
I need to write an OpenGL program for my job and need to learn some Java. I'm planning on doing my work using the JOGL libraries. I have downloaded the JOGL implementation and followed all their instructions, and when I try to compile some of their example programs, I get the following error message:
package net.java.games.jogl does not exist
I understand that the net.java.games part corresponds to a folder structure, so I created that folder structure under the root of my classpath and dropped jogl.jar into the lowest folder. I've tried everything to get this to work, but it wouldn't.
I have written a Hello World program that compiles and runs, and then I added the following line to the top of the file:
import jogl.*;
I have placed the jogl.jar file into the same folder as the HelloWorld.java file (/home/jeff/code/big_project/) and tried compiling with both of the commands listed below along with a few variations of them. Neither worked.
javac -classpath . HelloWorld.java
javac -classpath /home/jeff/code/big_project/jogl.jar
I don't think it gets more basic than that, does it? Can anyone tell me why I keep getting the "package does not exist" error?
Many thanks.