| 58 | } |
| 59 | |
| 60 | void compileAndRun(String path) { |
| 61 | if (!open(path, "Compile and Run Plugin...")) |
| 62 | return; |
| 63 | if (name.endsWith(".class")) { |
| 64 | runPlugin(name.substring(0, name.length()-1)); |
| 65 | return; |
| 66 | } |
| 67 | if (!isJavac()) { |
| 68 | if (IJ.debugMode) IJ.log("Compiler: javac not found"); |
| 69 | if (!checkForUpdateDone) { |
| 70 | checkForUpdate("/plugins/compiler/Compiler.jar", "1.48c"); |
| 71 | checkForUpdateDone = true; |
| 72 | } |
| 73 | Object compiler = IJ.runPlugIn("Compiler", dir+name); |
| 74 | if (compiler==null) { |
| 75 | boolean ok = Macro_Runner.downloadJar("/plugins/compiler/Compiler.jar"); |
| 76 | if (ok) |
| 77 | IJ.runPlugIn("Compiler", dir+name); |
| 78 | } |
| 79 | return; |
| 80 | } |
| 81 | if (compile(dir+name)) |
| 82 | runPlugin(name); |
| 83 | } |
| 84 | |
| 85 | private void checkForUpdate(String plugin, String currentVersion) { |
| 86 | int slashIndex = plugin.lastIndexOf("/"); |