I have found out (the hard way) that on Unix tools.jar is not included in the classpath, while in our Windows test envionment, it is. I need the java compiler accessible for a 3rd-party library, coincidently called Jasperreports. Since the documentation states that tools.jar _is_ available, I would ask that it is made so by correcting setclasspath.sh, which only puts tools.jar in the classpath for the 'debug' and 'javac' commands. That is nt consistent with the behavior of setclasspath.bat on Windows, which always adds tools.jar. Thanks!
Created attachment 18029 [details] patch for setclasspath.bat to make it consistent with the .sh version Here is a patch to setclasspath.bat to make it consistent with Remy's changes he made to setclasspath.sh some 14 months ago.
I'm hesitant to always include tools.jar now that we don't strictly need a JDK, and I'm not sure what the unix version does it. Consistency is a good goal but in this case I think we may need to go the other way, i.e. remove tools.jar from one script instead of adding it to the other. Please bring this up on the tomcat dev mailing list for discussion.
Created attachment 18120 [details] Patch to setclasspath.sh that fixes the bug. This patch fixes the bug in my 5.5.16 installation such that I can then start Tomcat with: $CATALINA_HOME/bin/catalina.sh javac start and it will use the Ant Java compiler to compile JSPs without copying tools.jar anywhere. I believe this bug affects the latest source, and this patch fixes it, at least on the non-windows OSs.
This has been fixed in trunk along with a handful of other script niggles. All the fixes have been proposed for 5.5.x and 6.0.x
The fixes for the niggles have been applied and will be in 5.5.28 and 6.0.21. The main fix was veto'd due to the incomplete implementation of the javac option and lack of documentation about what it was supposed to do. A new patch has been proposed which removes the javac option. tools.jar can be added to the classpath using the setenv script.
This has been fixed in 6.0.x and 5.5.x and will be in 6.0.21 and 5.5.28 onwards.