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

21
LINES

< > BotCompany Repo | #609 // mainAdder in JavaX (adds "class main" and psvm, shortened)

JavaX translator [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (118L/2K/5K).

1  
!592 // auto-import
2  
!629 // standard functions
3  
4  
public class main {
5  
  static String prelude =
6  
    "public class main {\n" +
7  
    "  public static void main(String[] args) throws Exception {\n";
8  
  static String postlude = "\n" +
9  
    "  }\n" +
10  
    "}\n";
11  
12  
  public static void main(String[] args) throws IOException {
13  
    String code = loadTextFile("input/main.java", null);
14  
    if (code == null)
15  
      throw new RuntimeException("Nothing to do (no input/main.java)");
16  
      
17  
    code = prelude + code + postlude;
18  
    code = moveImportsUp(code);
19  
    saveTextFile("output/main.java", code);
20  
  }
21  
}

Author comment

Began life as a copy of #563

Now improved, can handle imports correctly.

download  show line numbers  debug dex  old transpilations   

Relations

Travelled to 22 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gkwdfizivqfm, gwrvuhgaqvyk, hxnwyiuffukg, ishqpsrjomds, jtubtzbbkimh, kajysqoxcvfe, lpdgvwnxivlt, mqqgnosmbjvj, nrtiiiyxqhmw, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, qbtsjoyahagl, teubizvjbppd, tslmcundralx, tvejysmllsmz, ugbnzuvxksoj, vouqrxazstgt

Comments [hide]

ID Author/Program Comment Date
195 #1000604 (pitcher) 2015-08-18 00:50:38
180 #1000610 (pitcher) 2015-08-18 00:50:03

add comment

Snippet ID: #609
Snippet name: mainAdder in JavaX (adds "class main" and psvm, shortened)
Eternal ID of this version: #609/1
Text MD5: fc392c60d13a8e8d5dd7f11b0bf808ad
Transpilation MD5: 9ecab3636a94325db1d9da1fedf8c749
Author: stefan
Category:
Type: JavaX translator
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-08-17 19:01:06
Source code size: 612 bytes / 21 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 1167 / 3769
Referenced in: [show references]