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

25
LINES

< > BotCompany Repo | #1022670 // javaXStandalone_init

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3242L/19K).

1  
sbool javaXStandalone_init_runArbitraryPrograms = true;
2  
3  
// returns true if you should exit
4  
// idempotent
5  
sbool javaXStandalone_init(S[] args, O... _) {
6  
  if (javax() != null) false;
7  
  getJavaXDirectly((Runnable) optPar beforeInit(_));
8  
  
9  
  // forward to JavaX if arguments start with a program ID
10  
  if (javaXStandalone_init_runArbitraryPrograms && isInteger(first(args)))
11  
    ret true with call(javax(), 'goMain, new O[] {args});
12  
13  
  call(javax(), 'initHelloMessage); // TODO: fix security (user check)
14  
  call(javax(), 'loadMyClasses); // for when jar file is modified while program is running
15  
  callOnLoadMethods(mc());
16  
  
17  
  call(javax(), 'redirectSystemOutAndErr);
18  
  
19  
  // always make console to get the log, show it optionally
20  
  setOpt(javax(), consoleOn := !boolPar noConsole(_));
21  
  call(javax(), 'tryToOpenConsole, args);
22  
  
23  
  print("javax=" + javax() + ", console=" + getOpt(javax(), 'console));
24  
  false;
25  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022670
Snippet name: javaXStandalone_init
Eternal ID of this version: #1022670/15
Text MD5: f984ae5cb905d440319cbfc3d342984b
Transpilation MD5: facc0043f636b8665b45812617aa6b40
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-24 13:26:24
Source code size: 936 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 351 / 490
Version history: 14 change(s)
Referenced in: [show references]