It seems like you added the JOCL JAR file to the classpath for the compilation, but not when actually running the sample. Are you using an IDE or the command line? On the command line (assuming that the .java-File and the JAR file are in the same directory) you should compile it with