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?

Comment actions Permalink

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!


Please sign in to leave a comment.