Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

20
LINES

< > BotCompany Repo | #1000401 // hotwire (OUTDATED)

JavaX fragment (include)

  // compile JavaX source, load classes & return main class
  // src can be a snippet ID or actual source code
  
  // requires class _x18
  
  static Class<?> hotwire(String src) tex {
    new List<File> libraries;
    File srcDir = _x18.transpileMain(src, libraries);
    
    File classesDir = _x18.TempDirMaker_make();
    String javacOutput = _x18.compileJava(srcDir, libraries, classesDir);
    System.out.println(javacOutput);
    URL[] urls = {classesDir.toURI().toURL()};
    
    // make class loader
    URLClassLoader classLoader = new URLClassLoader(urls);

    // load & return main class
    return classLoader.loadClass("main");
  }

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

Comments [hide]

ID Author/Program Comment Date
787 #1000604 (pitcher) 2015-08-18 00:07:22

add comment

Snippet ID: #1000401
Snippet name: hotwire (OUTDATED)
Eternal ID of this version: #1000401/1
Text MD5: 6811cbe9ef0d988e2a85e95992ec2c84
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-08-23 17:43:39
Source code size: 667 bytes / 20 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 878 / 814
Referenced in: [show references]