db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendle...@amberpoint.com>
Subject Curious error trying to build derby source with JDK 1.5 on Linux (Sun JDK)
Date Sat, 12 Nov 2005 06:43:02 GMT
As part of preparing to work on DERBY-666 I've been setting myself
up to be able to build and test Derby using JDK 1.5.

I may be going about this all wrong, but here's what I did:
  - I've installed the Sun 1.5.0_05 JDK on my RedHat Linux system.
  - I set JAVA_HOME to point to my 1.5 JDK
  - I set PATH to include $JAVA_HOME/bin at the start
  - I went to my 'trunk' and did 'ant clean', followed by 'ant'.

When I try to build Derby with my Java environment pointing to this
JDK, I get a very, very strange error message out of the compiler:

     [javac] Compiling 1 source file to 

cannot access java.lang.StringBuilder
     [javac] file java/lang/StringBuilder.class not found
     [javac]                                     detailMessage = 
t.getClass().getName() + ": " + detailMessage;

By looking at the output of "ant -verbose", and playing around
with things, I've been able to trim this down to an extremely
small reproducible test case: there seems to be something strange
about the interaction between the 1.3 JRE rt.jar that we put into
the "-classpath" argument and the 'empty.jar' that we put into
the "-bootclasspath" argument.

In particular, if I have the following contents of file 'x.java',
and I try to compile x.java with this JDK 1.5 command, I get this
strange error message. The same command works fine with JDK 1.4 on
my system, and if I remove either the -classpath or -bootclasspath
arguments, the problem goes away.

Here's my tiny Java source file, and the compile error I get:

-bash-2.05b$ cat x.java
public class x
     public static void main(String []args)
         String stuff = "some stuff";
         stuff = args.getClass().getName() + ": " + stuff;

-bash-2.05b$ javac -classpath /usr/local/lib/jdk1.3.1_16/jre/lib/rt.jar 

x.java:6: cannot access java.lang.StringBuilder
file java/lang/StringBuilder.class not found
         stuff = args.getClass().getName() + ": " + stuff;
x.java:4: Internal error: stack sim error on
public static void main(String[] args) {
     String stuff = "some stuff";
     stuff = args.getClass().getName() + ": " + stuff;

java.lang.StringBuilder is a brand new class in JDK 1.5.

I can imagine that Java is internally trying to use the StringBuilder
class to assist with the string concatenation, and that the presence
of the JDK 1.3 RT.jar in the class path is confounding it, but that's
about as far as my guessing game goes.

Can anybody help me understand what's going on, and put me on the
right path to trying to get a JDK 1.5 build environment operational
for Derby?



View raw message