Hi, during my testing of the protected sample I found some interesting aspects of choosing the JDK for compiling/running Cocoon that some of you might not know:
Question: If Cocoon compiles with JDK 1.3 and JDK 1.4 without any problems, does this mean that a version compiled with JDK 1.4 also runs with JDK 1.3? Answer: No (!) - At first, I was a little bit surprised by this, as Cocoon compiles with both versions, so Cocoon does not use any method of JDK 1.4 which is not in JDK 1.3. So it should be compatible! But exactly the above statement is wrong. Let's have a look at an example: <CODE> StringBuffer a = new StringBuffer("a"); StringBuffer b = new StringBuffer("b"); a.append(b); </CODE> Now, JDK 1.3 has only a method "append( Object )" whereas JDK 1.4 offers a new method "append( StringBuffer )". So, if you compile the above with JDK 1.4 a reference to the method "append( StringBuffer )" is in the compiled code. And when you run it with JDK 1.3 you get a NoSuchMethodException. But of course, the above compiles with JDK 1.3 as well, as the method "append( Object )" is used then. And this works with JDK 1.3 and JDK 1.4 as well. That's nice, isn't it? So, I learn from this that the JDK used for compilation should be the same used for running Cocoon. If you follow this rule, nothing bad could happen... ...but what about all the other projects we use (Avalon, FOP, Batik, Xalan, Xerces - to name only a few)? With which version are they compiled? Do they use code like the one above? I would really like to know if Sun has an answer on this one! Or did I miss something? Carsten Carsten Ziegeler Chief Architect Open Source Group, S&N AG ------------------------------------------------------------------ Cocoon Consulting, Training and Projects ------------------------------------------------------------------ mailto:[EMAIL PROTECTED] http://www.s-und-n.de http://ziegeler.bei.t-online.de --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]