/** * Prepare java compiler before starting Android tools * * @param jdkPath path to JDK */ public void copyJdkTools(String jdkPath) { File targetDir = new File(settings.getInstallDirectory() + "\\Resources\\lib"); File tools_jar = new File(jdkPath + "\\lib\\tools.jar"); if (tools_jar.exists() && targetDir.exists()) { try { new FileHandler().copyFileToDir(tools_jar, targetDir); } catch (IOException ex) { java.util.logging.Logger.getLogger(AndroidApplicationModel.class.getName()) .log(Level.SEVERE, null, ex); } } }
/** Check for java compiler accessable in classpath or from external jar-file */ private boolean isToolsJarInWebSDK() { boolean toolsJarAvailable = false; try { // just check whether this throws an exception Class.forName("com.sun.tools.javac.Main"); toolsJarAvailable = true; } catch (Exception e) { try { Class.forName("sun.tools.javac.Main"); toolsJarAvailable = true; } catch (Exception e2) { // ignore } } if (toolsJarAvailable) { return true; } else { File toolsJar = new File(settings.getInstallDirectory() + "\\Resources\\lib\\tools.jar"); return toolsJar.exists(); } }