So I'm pretty sure I looked as well as I could before asking this question, so here goes. I am writing a Java class for RC4 encryption, I'd like to make use of the Files class in Google Guava. I am compiling using javac on the Ubuntu command line. I am trying to link the jar file, guava-10.0.1.jar" to my class to no success.
This is a snippet from the top:
import java.util.*;
import java.io.*;
import com.google.common.io.*;
class rc4 {
private static int S[] = new int[256];
private static int kLen;
public static void main(String[] args) {
...
The line specific to what I am calling is as follows, fully in a try block:
byte plain[] = Files.toByteArray(file);
I then compile using this:
$ javac -cp FULL/FILE/PATH/guava-10.0.1.jar rc4.java
It compiles, but when I try to run java rc4 with the options I defined to access the function, I get the error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/io/Files
at rc4.main(rc4.java:58)
Caused by: java.lang.ClassNotFoundException: com.google.common.io.Files
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 1 more
I've tried a few different calls, and have checked the jar to make sure its not a jar, in a jar, in a jar etc. I then tried using a manifest file:
Manifest-Version: 1.0
Created-By: me
Main-Class: rc4
Class-path: /FULL/FILE/PATH/guava-10.0.1.jar
And then create a jar as such:
jar cvf0m rc4.jar manifest.txt rc4.class
and then run it with:
java -jar rc4.jar
to which I get the same error as above, but it's saying "rc4" can not be found instead. So, I'm a little lost to what I'm missing. I am still a lil fresh to Java so if I'm missing some huge obviously basic necessity I sincerely apologize for the oversight, but if anyone can offer me some help in this, I would really appreciate it.