public static synchronized void load()

in shared/java/impl/Library.java [62:109]


    public static synchronized void load() {
        if (_loaded) return;

        String version = readResource(_resourcePath + "skija.version");
        File tempDir = new File(System.getProperty("java.io.tmpdir"), "skija_" + (version == null ? "" + System.nanoTime() : version));
        File library;
        
        switch (Platform.CURRENT) {
        case WINDOWS:
            _extract(_resourcePath, "icudtl.dat", tempDir);
            library = _extract(_resourcePath, "skija.dll", tempDir);
            System.load(library.getAbsolutePath());
            break;
        case LINUX:
            library = _extract(_resourcePath, "libskija.so", tempDir);
            System.load(library.getAbsolutePath());
            break;
        case MACOS_X64:
            library = _extract(_resourcePath, "libskija_x64.dylib", tempDir);
            System.load(library.getAbsolutePath());
            break;
        case MACOS_ARM64:
            library = _extract(_resourcePath, "libskija_arm64.dylib", tempDir);
            System.load(library.getAbsolutePath());
            break;
        default:
            throw new RuntimeException("Unexpected Platform.CURRENT = " + Platform.CURRENT);
        }

        if (tempDir.exists() && version == null) {
            Runtime.getRuntime().addShutdownHook(new Thread(() -> {
                try {
                    Files.walk(tempDir.toPath())
                         .map(Path::toFile)
                         .sorted(Comparator.reverseOrder())
                         .forEach((f) -> {
                            Log.debug("Deleting " + f);
                            f.delete();
                         });
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
            }));
        }
        
        _loaded = true;
        _nAfterLoad();
    }