Community
Participate
Working Groups
Build Identifier: 20100917-0705 The Java Cryptography Extension (JCE) is encountering runtime errors through Eclipse (Helios Release 1) on Mac. Using Mac OS X 10.6 64-bit, with Java 1.6 on the command line, I can load the "DH" algorithm from the JCE extension with no issues (see below). However, from a plain vanilla project in Eclipse, this same code will compile correctly but will throw a NoSuchAlgorithmException at runtime. import java.security.*; import javax.crypto.*; class JCETest{ public static void main(String[] arg){ try { KeyPairGenerator myKpairGen=KeyPairGenerator.getInstance("DH"); KeyAgreement myKeyAgree=KeyAgreement.getInstance("DH"); } catch(java.security.NoSuchAlgorithmException e) { System.out.println(e); } } } This problem largely precludes the use of this extension through Eclipse on Mac OSX (other common algorithms fail as well in the same way) - this example runs without error on Eclipse in Windows (Helios release 2) - is this a problem with Helios Release 1? Or with Mac OS X and its flavor of Java? On Mac, I have tried the following without success: (a) Under 'Installed JREs' in Eclipse preferences, altering the jce.jar location to its real location on disk (the automatically selected location from the Java frameworks was a linked file) (b) Added jce.jar as a runtime classpath library Reproducible: Always Steps to Reproduce: 1. On Mac OS X, Helios Release 1, create a new Java project 2. Create a JCETest class with the above contents 3. Run the program - code compiles, but the NoSuchAlgorithmException is encountered. This same class compiles and runs without error from the command line
(In reply to comment #0) > This same class compiles and runs without error from the command line Do you mean this compiles fine using javac or the eclipse compiler invoked from command line? Can you also please try with Helios SR2 on Mac, since it seems to work fine on Windows for you.
This code compiles and runs from the command line (javac/java) but not through the Eclipse IDE. Just tried this with 3.6.2 on Mac. This appears to be a problem with my workspace - this example in a fresh workspace runs correctly, but in my general development workspace does not, for both 3.6.1 and 3.6.2. I've created a new workspace and reconstructed my development environment step-by-step and the example continues to work. I will continue to test this and will post back if it happens again.
Did you try to refresh your installed JREs ? Moving to JDT/Debug as this seems to be a runtime issue when running the program.
(In reply to comment #3) > Did you try to refresh your installed JREs ? > Moving to JDT/Debug as this seems to be a runtime issue when running the > program. Just went to Preferences > Installed JREs > Edit, clicked "Restore Default", and it worked! Is this what you meant by "refresh your installed JREs"? Anyway, great tip, thanks!
(In reply to comment #4) > Just went to Preferences > Installed JREs > Edit, clicked "Restore Default", > and it worked! Is this what you meant by "refresh your installed JREs"? Anyway, > great tip, thanks! This is exactly what I meant. Glad it worked. Closing as NOT_ECLIPSE.