This discussion is archived
3 Replies Latest reply: Jan 26, 2013 4:51 PM by EJP RSS

Import javax.crypto not found error

987338 Newbie
Currently Being Moderated
Hi,
I have just installed the JDK1.7 on a windows machine.

Whenever I try to compile my module, I get an error on the import javax.crypto line. It tells me that it can't the javax\Crypto\Cipher.class.

I have the jdk installed on d:\glassfish3 and am pointing the classpath to d:\glassfish3\jdk7 (also tried d:\glassfish3\jdk7\jre as well) with no luck.

Any help would be greatly appreciated.

Thanks,
Drew Nathanson
Technical Synergy, Inc.
  • 1. Re: Import javax.crypto not found error
    EJP Guru
    Currently Being Moderated
    I have the jdk installed on d:\glassfish3 and am pointing the classpath to d:\glassfish3\jdk7
    Wrong
    (also tried d:\glassfish3\jdk7\jre as well) with no luck.
    Also wrong.

    Try not setting it at all, or else set it to be a list of JAR files including lib/rt.jar.
  • 2. Re: Import javax.crypto not found error
    987338 Newbie
    Currently Being Moderated
    Thanks. Maybe I should explain a little better.

    I am using JBuilder 2006 to my IDE. This environment requires that you put in the path to the JRE/JDK.

    I have uninstalled and downloaded the jdk again and this time i'm getting a strange error:

    "test.java": cannot access javax.crypto.Cipher; bad class file: D:\Program Files\Java\jre7\lib\jce.jar\javax\crypto\Cipher.class, class file has wrong version 51.0, should be 49.0, Please remove or make sure it appears in the correct subdirectory of the classpath. at line 19, column 21

    Now this is strange because i'm using the right library.

    Is there something that I'm missing here?

    Again, thanks for your help.

    Drew Nathanson
  • 3. Re: Import javax.crypto not found error
    EJP Guru
    Currently Being Moderated
    This environment requires that you put in the path to the JRE/JDK.
    Certainly, but that's not the same thing as setting the CLASSPATH.
    class file has wrong version 51.0, should be 49.0
    The class file came from a later version of Java than is being used to compile the pRogram. you have two JDKs installed. Use the later one, maybe even remove the earlier one.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points