Re: javac error when using jar file : cannot find symbol
On Mar 18, 3:53 pm, lord.zol...@gmail.com wrote:
public class DeriveKeyDemo
{
public static void main(String[] args)
{
try
{
keyDerivator = MyWrapperData.getInstance("DES=
",
"MyJCEProvider");
keyDerivator.initialize(keyGen, 1024);
// ...
}
}
}
CLASSPATH is setup as below:
$ export CLASSPATH=/home/powah/jdk1.6.0_06/jre/lib/ext/MyJCASP.jar:/
home/powah/jdk1.6.0_06/jre/lib/ext/MyJCESP.jar
$ javac DeriveKeyDemo.java
^
DeriveKeyDemo.java:94: cannot find symbol
symbol : method getInstance(java.lang.String,java.lang.String)
location: class com.mycomp.cryptox.MyWrapperData
keyDerivator = MyWrapperData.getInstance("DES=
",
^
DeriveKeyDemo.java:95: cannot find symbol
symbol : method initialize(javax.crypto.KeyGenerator,int)
location: class com.mycomp.cryptox.MyWrapperData
keyDerivator.initialize(keyGen, 1024);
^
2 errors
Where did you declare keyDerivator and keyGen?
They are declared as follows:
//////////////////////////////
// DeriveKeyDemo.java
//////////////////////////////
import java.io.*;
import java.util.*;
import java.security.*;
import java.security.cert.*;
import javax.crypto.*;
import javax.crypto.spec.*;
import javax.crypto.interfaces.*;
import com.mycomp.cryptox.*; // Load MyJCEProvider classes
import com.mycomp.crypto.*; // Load MyJCAProvider classes
public class DeriveKeyDemo
{
public static void main(String[] args)
{
KeyGenerator keyGen = null;
Key desKey = null;
try
{
keyGen = KeyGenerator.getInstance("DES");
desKey = keyGen.generateKey();
// ...
}
catch (Exception e)
{
System.out.println("Exception during Key Generation - " +
e.getMessage());
System.exit(1);
}
MyWrapperData keyDerivator = null;
try
{
keyDerivator = MyWrapperData.getInstance("DES",
"MyJCEProvider");
keyDerivator.initialize(keyGen, 1024);
// ...
}
catch (Exception e)
{
System.out.println("Exception during Key Derivation - " +
e.getMessage());
System.exit(1);
}
}
}