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

1  
// TODO: use actualUserHome()?
2  
// (there was a problem with onLocallyInferiorJavaX() always triggering inside #1013896)
3  
4  
static File pathToJavaxJar() {
5  
  ifndef NoJavaXJar
6  
    ifndef NoResourceLoader
7  
    IResourceLoader rl = vm_getResourceLoader();
8  
    if (rl != null)
9  
      ret rl.pathToJavaXJar();
10  
    endifndef
11  
    
12  
    ret pathToJavaxJar_noResourceLoader();
13  
  endifndef
14  
  ifdef NoJavaXJar
15  
    ret null;
16  
  endifdef
17  
}
18  
    
19  
static File pathToJavaxJar_noResourceLoader() ctex {
20  
  ifndef NoJavaXJar
21  
    int x = latestInstalledJavaX();
22  
    File xfile = new File(userHome(), ".javax/x" + Math.max(x, 30) + ".jar");
23  
    if (!xfile.isFile()) {
24  
      print("Saving " + f2s(xfile));
25  
      String url = x30JarServerURL();
26  
      byte[] data = loadBinaryPage(url);
27  
      if (data.length < 1000000)
28  
        fail("Could not load " + url);
29  
      saveBinaryFile(xfile.getPath(), data);
30  
    }
31  
    ret xfile;
32  
  
33  
  endifndef
34  
  ifdef NoJavaXJar
35  
  ret null;
36  
  endifdef
37  
}

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