0

How do I solve this error Exception in thread "main" java.lang.NoClassDefFoundError: javax/crypto/SecretKey

import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.RefreshHandler;
import java.io.IOException;
import java.net.URL;

public class veriçekmek {

    public static void main(String[] args) throws Exception {

        WebClient web=new WebClient();
        HtmlPage sayfa=web.getPage("http://www.idefix.com");

When I run this program I get an error like this

 Exception in thread "main" java.lang.NoClassDefFoundError: javax/crypto/SecretKey
Kurt Van den Branden
  • 11,995
  • 10
  • 76
  • 85
  • Possible duplicate of [Why am I getting package javax.crypto does not exist](http://stackoverflow.com/questions/14935447/why-am-i-getting-package-javax-crypto-does-not-exist) – ozOli Feb 16 '17 at 13:09

2 Answers2

0

javax.crypto package is included in jce.jar, which can be found under the "lib" folder of your JRE. Add it to your classpath, and you should be fine.

For more information about classpath, see: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html

Yoav Gur
  • 1,366
  • 9
  • 15
0

I solved this by installing a new reference jdk from https://jdk.java.net.

For whatever reason, these builds include the crypto jars that were missing from the oracle builds.

Adrian C
  • 71
  • 3