I've been attempting to import a class contained with in a .jar file. My my_package.jar
file resides in /Users/user/Library/Java/Extensions
and my ~/.bashrc
contains the following line export CLASSPATH = "$CLASSPATH:/Users/user/Library/Java/Extensions
. At the top of my program is a line that reads import my_package.MyClass;
. Whenever I try to compile the program using javac MyProgram.java
I get the package my_package does not exist
. I've done a bit of searching around online and found several possible fixes. One of which involved moving the .jar file to the current directory and invoking javac found here as follows.
javac -cp '.:my_package.jar' MyClass.java
This yields the same error.
I have also tried changing the CLASSPATH
to /Users/David_Johnson/Library/Java/Extensions/
and /Users/David_Johnson/Library/Java/Extensions/*
. They both yield the same error.
It appears as though I am missing something quite trivial. Any help in catching my mistake would be greatly appreciated.
I'm on Max OSX 10.8.5 using javac 1.7.0_07