hi all

    when I do cactus:test I meet this problem(Couldn't find tools.jar (needed 
for JSP compilation)).Vincent say it's a bug of cactus then I see the source 
code of cactus1.7 i use.
find code in AbstractJavaContainer.java from line 184~201
//--------------------------------------------------------------------------------------------
    /**
     * Returns the file containing the JDK tools (such as the compiler). This
     * method must not be called on Mac OSX as there is no tools.jar file on
     * that platform (everything is included in classes.jar).
     * 
     * @return The tools.jar file
     * @throws FileNotFoundException If the tools.jar file could not be found
     */
    protected final File getToolsJar() throws FileNotFoundException
    {
        String javaHome = System.getProperty("java.home"); 
        File toolsJar = new File(javaHome, "../lib/tools.jar");
        if (!toolsJar.isFile())
        {
            throw new FileNotFoundException(toolsJar.getAbsolutePath());
        }
        return toolsJar;
    }
//--------------------------------------------------------------------------------------------
this is a simple test code for getToolsJar()
//---------------------------------TestGetTool.java-----------------------------------------------------
/**
 *sheep test cactus's getToolsJar (temp delete when test over)
 */
import java.io.File;
import java.io.FileNotFoundException;
public class TestGetTool
{

 protected  File getToolsJar() throws FileNotFoundException
 {
  String javaHome = System.getProperty("java.home"); 
  System.out.println("java.home:" + javaHome);
     File toolsJar = new File(javaHome, "../lib/tools.jar");
     
     if (!toolsJar.isFile())
     {
       throw new FileNotFoundException(toolsJar.getAbsolutePath());
     }
     return toolsJar;
 }
 //sheep: a simple test for getToolJar
 public static void main(String[] args) throws FileNotFoundException
 {
  //System.out.println("getProperty(java.home):" + 
System.getProperty("java.home"));
         
  System.out.println(new TestGetTool().getToolsJar());
 }
}
//--------------------------------------------------------------------------------------------
the result is:
//--------------------------------------------------------------------------------------------
java.home:C:\Program Files\Java\jre1.5.0_02
Exception in thread "main" java.io.FileNotFoundException: C:\Program 
Files\Java\jre1.5.0_02\..\lib\tools.jar
        at TestGetTool.getToolsJar(TestGetTool.java:19)
        at TestGetTool.main(TestGetTool.java:28)
//--------------------------------------------------------------------------------------------
here cactus want to find tools.jar in C:\Program 
Files\Java\jre1.5.0_02\..\lib\tools.jar
but the real path is : C:\Program Files\Java\jre1.5.0_02\..\lib\tools.jar


cactus plug for maven is the latest.. : maven plugin:download 
-DartifactId=cactus-maven -DgroupId=cactus -Dversion=1.7
what should I do for this problem?
                                                                                
                                thanks
                                                                                
                                    sheep

Reply via email to