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).

!592 // auto-import
!629 // standard functions

public class main {
  static String prelude =
    "public class main {\n" +
    "  public static void main(String[] args) throws Exception {\n";
  static String postlude = "\n" +
    "  }\n" +
    "}\n";

  public static void main(String[] args) throws IOException {
    String code = loadTextFile("input/main.java", null);
    if (code == null)
      throw new RuntimeException("Nothing to do (no input/main.java)");
      
    code = prelude + code + postlude;
    code = moveImportsUp(code);
    saveTextFile("output/main.java", code);
  }
}

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: 1166 / 3768
Referenced in: [show references]