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

31
LINES

< > BotCompany Repo | #642 // isJavaCompilable

JavaX source code - run with: x30.jar

1  
!636
2  
!quickmain
3  
!auto-import
4  
!standard functions
5  
!class _x14
6  
7  
import java.security.MessageDigest;
8  
import java.security.NoSuchAlgorithmException;
9  
import java.lang.reflect.*;
10  
11  
main {
12  
  psvm {
13  
    String text;
14  
    if (args.length != 0)
15  
      text = loadSnippet(args[0]);
16  
    else
17  
      text = loadTextFile("input/main.java", null);
18  
    if (text == null)
19  
      throw new IOException("No input.");
20  
      
21  
    File srcDir = _x14.TempDirMaker_make();
22  
    saveTextFile(new File(srcDir, "main.java").getPath(), text);
23  
    File classesDir = _x14.TempDirMaker_make();
24  
    List<File> libraries = new ArrayList<File>();
25  
    
26  
    String javacOutput = _x14.compileJava(srcDir, libraries, classesDir);
27  
    boolean isCompilable = _x14.didCompile(classesDir);
28  
    System.out.println("Compilable: " + isCompilable);
29  
    saveTextFile(isCompilable ? "output/is-compilable" : "output/is-not-compilable", "x");
30  
  }
31  
}

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: #642
Snippet name: isJavaCompilable
Eternal ID of this version: #642/1
Text MD5: 79f64f1aa95e8e1f3861a7fc64ec1838
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-06-25 20:33:33
Source code size: 923 bytes / 31 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 829 / 718
Referenced in: [show references]