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

37
LINES

< > BotCompany Repo | #1009052 // pathToJavaxJar

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

Libraryless. Click here for Pure Java version (6681L/39K).

// TODO: use actualUserHome()?
// (there was a problem with onLocallyInferiorJavaX() always triggering inside #1013896)

static File pathToJavaxJar() {
  ifndef NoJavaXJar
    ifndef NoResourceLoader
    IResourceLoader rl = vm_getResourceLoader();
    if (rl != null)
      ret rl.pathToJavaXJar();
    endifndef
    
    ret pathToJavaxJar_noResourceLoader();
  endifndef
  ifdef NoJavaXJar
    ret null;
  endifdef
}
    
static File pathToJavaxJar_noResourceLoader() ctex {
  ifndef NoJavaXJar
    int x = latestInstalledJavaX();
    File xfile = new File(userHome(), ".javax/x" + Math.max(x, 30) + ".jar");
    if (!xfile.isFile()) {
      print("Saving " + f2s(xfile));
      String url = x30JarServerURL();
      byte[] data = loadBinaryPage(url);
      if (data.length < 1000000)
        fail("Could not load " + url);
      saveBinaryFile(xfile.getPath(), data);
    }
    ret xfile;
  
  endifndef
  ifdef NoJavaXJar
  ret null;
  endifdef
}

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, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009052
Snippet name: pathToJavaxJar
Eternal ID of this version: #1009052/15
Text MD5: ec0cdf68c761aadbfe03b268447c2b7c
Transpilation MD5: 05821c30de161ddacb9859fecd9b8a86
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-07 05:39:09
Source code size: 987 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 629 / 793
Version history: 14 change(s)
Referenced in: [show references]