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

sbool javaXStandalone_init_runArbitraryPrograms = true;

// returns true if you should exit
// idempotent
sbool javaXStandalone_init(S[] args, O... _) {
  if (javax() != null) false;
  getJavaXDirectly((Runnable) optPar beforeInit(_));
  
  // forward to JavaX if arguments start with a program ID
  if (javaXStandalone_init_runArbitraryPrograms && isInteger(first(args)))
    ret true with call(javax(), 'goMain, new O[] {args});

  call(javax(), 'initHelloMessage); // TODO: fix security (user check)
  call(javax(), 'loadMyClasses); // for when jar file is modified while program is running
  callOnLoadMethods(mc());
  
  call(javax(), 'redirectSystemOutAndErr);
  
  // always make console to get the log, show it optionally
  setOpt(javax(), consoleOn := !boolPar noConsole(_));
  call(javax(), 'tryToOpenConsole, args);
  
  print("javax=" + javax() + ", console=" + getOpt(javax(), 'console));
  false;
}

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: 353 / 491
Version history: 14 change(s)
Referenced in: [show references]