java.lang.String not found with IBM JDK

I use the IBM JDK 1.6. Ever since I had to rebuild my IDEA project, I have been dogged by a problem where java.lang.String was not recognized by IDEA. Even though I tried deleting and recreating the SDK definition multiple times, cleaned out the IDEA cache, etc., I still had the same problem. The weird thing was that other java.lang classes (e.g. StringBuffer) were found. I finally realized that something was up when I opened another class and noticed that IDEA couldn't find java.math.BigDecimal, either. At that point, I decided to look at the rt.jar that comes with the IBM JDK - surprisingly, neither of these classes are in that jar. I finally found them in a different jar: jre/bin/default/jclSC160/vm.jar (rt.jar is at jre/lib/rt.jar). I added that jar explicitly to the SDK definition (you can add jars by opening the SDK definition and clicking the plus sign on the right), and bingo - the problem went away.

I have no idea why the IBM JDK ships those classes in a different JAR. Anyway, can JetBrains please look to add that jar automatically when the JDK is from IBM?

2
5 comments

Hi Jim,

I have faced the same problem and fixed it using your solution. But there's another thing bothers me, that is, I always get a problem says "can't cast 'java.lang.Object' to 'org.dom4j.Element'" or "Incompatible types: Requred java.lang.Throwable".
Do you have any idea how to fix it?

Although I can compile my project and run it, but getting too many red wave lines really bothers me!



Attachment(s):
intellij_error.png
0
Avatar
Permanently deleted user

've create the issue: http://youtrack.jetbrains.com/issue/IDEA-90661
Thanks for reporting

0

Jim Babka's solution helped me 9 years later!

Added  jre/bin/default/jclSC180/vm.jar

0

Jim Babka's solution still valid in 2022!

0

Me too, it helped me for IBM JDK 1.7 !!! :-)

0

Please sign in to leave a comment.