javac calling problem when creating client in DynamicClientFactory ------------------------------------------------------------------
Key: CXF-2567 URL: https://issues.apache.org/jira/browse/CXF-2567 Project: CXF Issue Type: Improvement Environment: linux Reporter: Wilson Lam Priority: Minor When there are multiple JDK on a machine, DynamicClientFactory is currently not supported to switch javac executable since CXF always call default javac. The problem comes from compileJavaSrc: Class - org.apache.cxf.endpoint.dynamic.DynamicClientFactory Method - compileJavaSrc() [ Code segment ] ... javacCommand[0] = "javac"; javacCommand[1] = "-classpath"; javacCommand[2] = classPath; javacCommand[3] = "-d"; javacCommand[4] = dest; javacCommand[5] = "-target"; javacCommand[6] = "1.5"; ... return javaCompiler.internalCompile(javacCommand, 7); There is no mechanism in Complier.internalCompile() to detect JAVA_HOME and execute the desired javac command. Another Complier method "compileFiles()" is better in this way: Class - org.apache.cxf.common.util.Complier Method - compileFiles() [ Code segment ] ... if (new File(System.getProperty("java.home") + fsep + platformjavacname).exists()) { // check if java.home is jdk home javacstr = System.getProperty("java.home") + fsep + platformjavacname; } else if (new File(System.getProperty("java.home") + fsep + ".." + fsep + "bin" + fsep + platformjavacname).exists()) { // check if java.home is jre home javacstr = System.getProperty("java.home") + fsep + ".." + fsep + "bin" + fsep + platformjavacname; } ... It is possible to add this JAVA_HOME checking in Complier.internalCompile() or DynamicClientFactory. compileJavaSrc() ? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.