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

30
LINES

< > BotCompany Repo | #1005010 // classicNohupJavaxWithChdir

JavaX fragment (include)

static void classicNohupJavaxWithChdir(String javaxargs) {
  classicNohupJavaxWithChdir(javaxargs, "");
}

static void classicNohupJavaxWithChdir(String javaxargs, String vmArgs) ctex {
  int x = latestInstalledJavaX();
  File xfile = new File(userHome(), ".javax/x" + Math.max(x, 30) + ".jar");
  if (!xfile.isFile()) {
    String url = "http://tinybrain.de/x30.jar";
    byte[] data = loadBinaryPage(url);
    if (data.length < 1000000)
      fail("Could not load " + url);
    saveBinaryFile(xfile.getPath(), data);
  }
  String jarPath = xfile.getPath();
  if (javaxargs.startsWith("#")) javaxargs = javaxargs.substring(1);
  
  S progID = onlyUntilSpace(javaxargs);
  File progDir = programDir(progID);
  mkdir(progDir);
  print("ProgDir: " + platformQuote(f2s(progDir)));
  S javaCmd = "java " + vmArgs + " -jar " + platformQuote(jarPath) + " " + javaxargs;
  S cmds;
  if (isWindows())
    cmds = "(cd " + platformQuote(f2s(progDir)) + " & " + javaCmd + ")";
  else
    cmds = "/bin/bash -c " + platformQuote(
      "cd " + platformQuote(f2s(progDir)) + " ; " + javaCmd);
  nohup(cmds);
}

Author comment

Began life as a copy of #1000838

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005010
Snippet name: classicNohupJavaxWithChdir
Eternal ID of this version: #1005010/1
Text MD5: d9553be5dd9f64463a6a0e19f7d9819d
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-09-25 17:47:33
Source code size: 1124 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 597 / 630
Referenced in: [show references]