Menu

#244 hfst-ol.jar fails on machines running Java 1.6 and below

future
closed
nobody
hfst-ol.jar (3)
5
2014-05-19
2014-05-19
No

The pre-compiled hfst-ol.jar fails on machines which run Java 1.6 and older, with the message

java.lang.UnsupportedClassVersionError: net/sf/hfst/HfstOptimizedLookup : Unsupported major.minor version 51.0

This is unfortunate because the users often do not have the option to upgrade the server installation and must make do with what they have. Support for Java 1.6 would be important.

A solution would be to set the target of javac to a bit older version (1.6? 1.5?).

http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html#crosscomp-options

Discussion

  • Sam Hardwick

    Sam Hardwick - 2014-05-19

    This is a good suggestion. I implemented it, though am unable to test it on older Javas right now.

     
  • Sam Hardwick

    Sam Hardwick - 2014-05-19
    • status: open --> closed
     
  • Filip Ginter

    Filip Ginter - 2014-05-19

    Sorry, the new file has the same problem as the previous one.

    $ java -jar LIBS/hfst-ol.jar Exception in thread "main" java.lang.UnsupportedClassVersionError: net/sf/hfst/HfstOptimizedLookup : Unsupported major.minor version 51.0

     
  • Filip Ginter

    Filip Ginter - 2014-05-19

    I googled around a bit, and here is a way to check the byte code version:

    $ jar xf hfst-ol.jar 
    $ file net/sf/hfst/ByteArray.class
    net/sf/hfst/ByteArray.class: compiled Java class data, version 51.0
    

    51 is java 7, 50 is java 6, 49 is java 5,...

    http://stackoverflow.com/questions/10382929/unsupported-major-minor-version-51-0

     
  • Sam Hardwick

    Sam Hardwick - 2014-05-19

    Are you sure you got the newest version? I tried downloading just now and get:

    $ jar xf hfst-ol.jar
    $ file net/sf/hfst/Transducer.class
    net/sf/hfst/Transducer.class: compiled Java class data, version 49.0 (Java 1.5)
    
     
  • Filip Ginter

    Filip Ginter - 2014-05-19

    Yes, I am sure. Tested again and it died. Digging into this further, different class files in the .jar have different versions:

    $ file net/sf/hfst/Transducer.class
    net/sf/hfst/Transducer.class: compiled Java class data, version 49.0 (Java 1.5)
    
    $ file net/sf/hfst/HfstOptimizedLookup.class
    net/sf/hfst/HfstOptimizedLookup.class: compiled Java class data, version 51.0
    

    Running

    for f in net/sf/hfst/*.class ; do file $f ; done
    

    reveals a mixture of versions.

    Thanks for all the help so far! Much appreciated, Sam.

     
  • Sam Hardwick

    Sam Hardwick - 2014-05-19

    Ah, of course, I neglected to do ant clean first. Now all the .classes should be rebuilt.

     
  • Filip Ginter

    Filip Ginter - 2014-05-19

    Tested to work. Thank you!

     
MongoDB Logo MongoDB