0

I want to test using tess4j in eclipse. After following the tutorial I still encounter the UnsupportedClassVersionError when run it. I am using jdk 1.6.0 and this error appears.

java.lang.UnsupportedClassVersionError: net/sourceforge/tess4j/TesseractException : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Exception in thread "main" 

From what I read the solution gives that I have to upgrade my jdk version. Is there other way so it still using the jdk version I have? How can I fix this to make it compatible with the existing jdk I have. or I have to use the previous version of this tess4j or else?

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
sayaTanya
  • 13
  • 8
  • You probably will need to upgrade your Java. See http://stackoverflow.com/questions/10382929/how-to-fix-java-lang-unsupportedclassversionerror-unsupported-major-minor-versi – nguyenq May 06 '16 at 00:16
  • You certainly can bring down the source and test compile using older JDK. – nguyenq May 06 '16 at 15:46
  • 'variable references non-existence resource:{workspace_loc:/ocr-tess4j-example}' this one appears when I run. How can I resolve this? – sayaTanya Jun 09 '16 at 04:07
  • Looks like something is incorrectly set up in your Eclipse project. See the [Tutorial](http://tess4j.sourceforge.net/tutorial/). – nguyenq Jun 19 '16 at 14:56
  • Does this answer your question? [How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version](https://stackoverflow.com/questions/10382929/how-to-fix-java-lang-unsupportedclassversionerror-unsupported-major-minor-versi) – 9ilsdx 9rvj 0lo Jun 07 '21 at 11:21

1 Answers1

0

Is there other way so it still using the jdk version I have?

  1. This is not recommended. If you are still using Java 7 or earlier, it is end-of-life. Indeed, it was end-of-life when this question was asked.

    I recommend that upgrade your Java install, and upgrade your application to use Java 8 ... or Java 11 because Java 8 is likely to be end-of-life in December 2020. The longer you put off upgrading, the worse this will get for you.

  2. You may be able to download the Tess4j source code tree, modify the POM file to use a different Java compiler level, and then build JAR files for Java 7 or earlier.

    Warning: this configuration will not be supported. However, according to the git history on the github project (https://github.com/nguyenq/tess4j) the POM was only updated to specify Java 8 a few months ago, so the chances are that that it will still work.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216