Archived Forum Post

Index of archived forum posts

Question:

Java class file has wrong version 52.0, should be 50.0

Dec 21 '16 at 11:56

I got this error when trying to test the Chilkat Java API straight out of the box..

Test.java:6: cannot access com.chilkatsoft.CkCrypt2
bad class file: comchilkatsoftCkCrypt2.class(comchilkatsoft:CkCrypt2.class)
class file has wrong version 52.0, should be 50.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
import com.chilkatsoft.CkCrypt2;
                      ^
Error: Could not find or load main class Test


Answer

This is caused when your Java runtime version is 1.8, but your compiler version (javac) is 1.6.

For example, you can verify by checking the version of each (by running the following two commands)

java -version
javac -version

Here's sample output:

C:\ckUnitTest\java\testHashBytes>javac -version
javac 1.6.0_45

C:\ckUnitTest\java\testHashBytes>java -version java version "1.8.0_111" Java(TM) SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot(TM) Client VM (build 25.111-b14, mixed mode)

C:\ckUnitTest\java\testHashBytes>