// compile JavaX source and load main class static Class<?> compileAndLoadMainClass(String src) ctex { O javax = getJavaX(); File srcDir = cast call(javax, "TempDirMaker_make"); File classesDir = cast call(javax, "TempDirMaker_make"); saveTextFile(new File(srcDir, "main.java"), src); new List<File> libraries; set(javax, "safeTranslate", true); File transpiledDir = cast call(javax, "topLevelTranslate", srcDir, libraries); String javacOutput = cast call(javax, "compileJava", transpiledDir, libraries, classesDir); System.out.println(javacOutput); URL[] urls = {classesDir.toURI().toURL()}; // make class loader URLClassLoader classLoader = new URLClassLoader(urls); // load main class Class<?> mainClass = classLoader.loadClass("main"); return mainClass; }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1000595 |
Snippet name: | compileAndLoadMainClass |
Eternal ID of this version: | #1000595/1 |
Text MD5: | c448ae451102854af320b5fc84fdc816 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-04-20 18:51:39 |
Source code size: | 812 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 680 / 928 |
Referenced in: | #1002427 - Accellerating 629 (SPIKE) #1006654 - Standard functions list 2 (LIVE, continuation of #761) #3000382 - Answer for ferdie (>> t = 1, f = 0) |