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

30
LINES

< > BotCompany Repo | #1005010 // classicNohupJavaxWithChdir

JavaX fragment (include)

1  
static void classicNohupJavaxWithChdir(String javaxargs) {
2  
  classicNohupJavaxWithChdir(javaxargs, "");
3  
}
4  
5  
static void classicNohupJavaxWithChdir(String javaxargs, String vmArgs) ctex {
6  
  int x = latestInstalledJavaX();
7  
  File xfile = new File(userHome(), ".javax/x" + Math.max(x, 30) + ".jar");
8  
  if (!xfile.isFile()) {
9  
    String url = "http://tinybrain.de/x30.jar";
10  
    byte[] data = loadBinaryPage(url);
11  
    if (data.length < 1000000)
12  
      fail("Could not load " + url);
13  
    saveBinaryFile(xfile.getPath(), data);
14  
  }
15  
  String jarPath = xfile.getPath();
16  
  if (javaxargs.startsWith("#")) javaxargs = javaxargs.substring(1);
17  
  
18  
  S progID = onlyUntilSpace(javaxargs);
19  
  File progDir = programDir(progID);
20  
  mkdir(progDir);
21  
  print("ProgDir: " + platformQuote(f2s(progDir)));
22  
  S javaCmd = "java " + vmArgs + " -jar " + platformQuote(jarPath) + " " + javaxargs;
23  
  S cmds;
24  
  if (isWindows())
25  
    cmds = "(cd " + platformQuote(f2s(progDir)) + " & " + javaCmd + ")";
26  
  else
27  
    cmds = "/bin/bash -c " + platformQuote(
28  
      "cd " + platformQuote(f2s(progDir)) + " ; " + javaCmd);
29  
  nohup(cmds);
30  
}

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