问题
Actually I am getting an error:
Exception in thread "main" java.lang.NoClassDefFoundError:sun/io/CharToByteConverter
This is because in Java 8, the CharToByteConverter class has been removed as it was deprecated.
Now I want to know of any alternative which would replace this package/class and provide its functionality without throwing the exception mentioned above.
This class is used in the SQLJ's
Translator.jar
and inside it it is in
sqlj.util.io.OracleOutputStream.class
Edit: If I replace the CharToByteConverter class with the java.nio.charset class, still the SQLJ might not be able to detect it. Please correct me if I am wrong. And let me know if replacing the CharToByteConverter with java.nio.charset might fix the issue?
回答1:
This is an old issue, but WAS an issue for me until today as well. So maybe others may benefit from the information, that Oracle has a bug #21315718 for that, containing the solution: "Translator.jar and runtime12.jar were not compatible with JDK 8. The issue is reported in unpublished Bug 21315718 - sqlj translator does not work with jdk 8." After upgrading these two jars, SQLJ did not raise the above error for me.
回答2:
The javadoc comment says it all:
Deprecated! Replaced - by java.nio.charset
Look for a replacement class/method in the java.nio.charset package.
Note that using classes in the JDK that are not part of the officially documented API is a bad idea in the first place
来源:https://stackoverflow.com/questions/36260631/is-there-any-java-8-supported-release-of-sqlj