JDK1.3.1 and JRE1.4.2
Hi I have a struts based app whose source code is compiled on JDK 1.3.1. It runs perfectly well on JRE1.3.1.I want to upgrade the JRE to something newer ( than what I already have ) like 1.4.2. If I change that, I get following error in the very 1st JSP in the app.
-
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
D:\firepond\iss\config\tomcat\work\Catalina\l93lm4c1\fsp\org\apache\jsp\index_jsp.java:8: cannot access java.lang.Object
Generated servlet error:
bad class file: jre\lib\rt.jar(java/lang/Object.class)
class file has wrong version 48.0, should be 47.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
-
Why is that ?Because the base product of my app is a third party vendor product, it is not possible to get all the source compiled on 1.4.2.
Is there any other way I can get this to work ?
I am running this app on Tomcat 5.0 .. How do I find out which compiler tomcat is using ? Is there a way to change it ? like path/classpath/libraries ?
Also If we somehow manage to change that compiler to 1.4.x and it starts compiling JSPs with 1.4.x, wouldn't it conflict with the source class files already compiled with 1.3.1 ? Would this combination work - java files compiled with 1.3.1 and JSPs compiled with 1.4.x ?
> I am running this app on Tomcat 5.0 .. How do I find
> out which compiler tomcat is using ? Is there a way
> to change it ? like path/classpath/libraries ?
>
> Also If we somehow manage to change that compiler to
> 1.4.x and it starts compiling JSPs with 1.4.x,
> wouldn't it conflict with the source class files
> already compiled with 1.3.1 ? Would this combination
> work - java files compiled with 1.3.1 and JSPs
> compiled with 1.4.x ?
1.4 can handle older class files.
Kaj
kajbja at 2007-7-12 14:53:47 >

I tried adding these parameters to tomcat web xml - under JSP servlet -
<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.4</param-value>
</init-param>
<init-param>
<param-name>compilerTargetVM</param-name>
<param-value>1.4</param-value>
</init-param>
<init-param>
But I am still getting the same error. Any thoughts ?
Hi All
I found out what the issue was. Tomcat uses "tools.jar" from sun's JRE to compile JSPs at runtime. This tools.jar file needs to be in the classpath and needs to be available at runtime. JRE does not bundle this jar file. I had an older version of tools.jar in classpath, that was causing the issue. I replaced it with the tools.jar from JDK 1.4.2_13 and things started to work.
Thanks for all your help and pointers.
Cheers.
Message was edited by:
developer@java