6

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?

Murtuza K
  • 165
  • 2
  • 10
  • Possible duplicate of http://stackoverflow.com/questions/10444129/java-class-chartobyteconverter-type-deprecated – Rahman Mar 28 '16 at 10:47

2 Answers2

0

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.

Galcoholic
  • 518
  • 2
  • 8
-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

P S M
  • 1,121
  • 12
  • 29
  • 1
    Instead of copy pasting an answer you should have marked it as duplicate :) – Rahman Mar 28 '16 at 10:46
  • I have already read this post which suggests what you have mentioned above. However, java.nio.charset is a replacement for the deprecated class CharToByteConverter.class However, I am looking for a replacement for the entire Translator.jar file. The reason being that even if I replace the CharToByteConverter class with charset, it will still cause errors while I use the translator.jar which SQLJ internally uses as a library. I am sorry as I probably wrote my question wrong. Ill edit it to provide a better view of my problem. – Murtuza K Mar 28 '16 at 12:23