I want to encrypt a string, but the standard java libraries are too complicated for me. So i turned to JASYPT, Its pretty simple to use and understand, However when i import the library to Eclipse 3.6 and when i try encrypt a string like "Hello" with the password "123". It always comes up with an error. I'm not sure what im doing wrong but i think it also happens when i use other libraries in eclipse.
Source
import org.jasypt.util.text.BasicTextEncryptor;
public class eMain {
static BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
public static void main(String[] args) {
System.out.println("Hello World");
textEncryptor.setPassword("123");
System.out.println(textEncryptor.encrypt("Hello World"));
}
}
the error: i.imgur.com/vBe8p.png
Eclipse consle:
java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jasypt.util.text.BasicTextEncryptor.<init>(BasicTextEncryptor.java:67)
at eMain.<clinit>(eMain.java:4)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 14 more
imported library i.imgur.com/t9AM9.png