# GraalVM Environment

An environment providing the Graal Java Virtual Machine

This notebook creates a **[reusable environment](https://nextjournal.com/nextjournal/environments)** with the [Graal JVM](https://graalvm.org/). Nextjournal uses the the Graal JVM [Community Edition](https://github.com/graalvm/graalvm-ce-builds/). Note that the GraalVM version and installation directory are set as environment variables on the runtime. [reference][nextjournal#reference#57e139fb-1a5e-43c3-b551-c1546ecb95b5] Download the install tarfile. ```bash id=22f34710-72c9-46d3-bc78-b80130eec66c file="graalvm-ce-java${JAVA_VERSION}-linux-amd64-${GRAAL_VERSION}.tar.gz" path="graalvm/graalvm-ce-builds/releases/download/vm-${GRAAL_VERSION}/${file}" url="https://github.com/${path}" wget --progress=bar:force -P /results $url ``` [graalvm-ce-java8-linux-amd64-20.0.0.tar.gz][nextjournal#output#22f34710-72c9-46d3-bc78-b80130eec66c#graalvm-ce-java8-linux-amd64-20.0.0.tar.gz] Extract to the installation dir. ```bash id=351460f8-8f6a-4327-8348-717f8bda3b6f mkdir $GRAAL_DIR tar -zxf [reference][nextjournal#reference#6afcc8f4-11dc-4de9-8e8d-f370ba41dd19] \ -C $GRAAL_DIR --strip-components=1 ``` And test. ```bash id=ddb404a8-852e-4539-b9fc-4910c9fc82c3 java -version ``` Install the Native Image executable. ```bash id=b08d71a1-411b-4850-b675-89479cd22b28 gu install native-image ``` [nextjournal#reference#57e139fb-1a5e-43c3-b551-c1546ecb95b5]: <#nextjournal#reference#57e139fb-1a5e-43c3-b551-c1546ecb95b5> [nextjournal#output#22f34710-72c9-46d3-bc78-b80130eec66c#graalvm-ce-java8-linux-amd64-20.0.0.tar.gz]: [nextjournal#reference#6afcc8f4-11dc-4de9-8e8d-f370ba41dd19]: <#nextjournal#reference#6afcc8f4-11dc-4de9-8e8d-f370ba41dd19>
This notebook was exported from https://nextjournal.com/a/MDqLuCwfPh9Y8ZyMtqqkD?change-id=CePrVFQtKPERW16QLbfhTp ```edn nextjournal-metadata {:article {:settings {:numbered? true, :sidebar? true, :subtitle? true}, :nodes {"22f34710-72c9-46d3-bc78-b80130eec66c" {:compute-ref #uuid "f2a86350-1aa1-4823-ac7e-7ab6771d4b63", :exec-duration 17956, :id "22f34710-72c9-46d3-bc78-b80130eec66c", :kind "code", :locked? false, :output-log-lines {:stdout 17}, :runtime [:runtime "4641de4c-67e7-4689-90f8-f22f1092707a"]}, "351460f8-8f6a-4327-8348-717f8bda3b6f" {:compute-ref #uuid "9ee91391-894c-4859-ba6a-e1710ef19fe3", :exec-duration 16690, :id "351460f8-8f6a-4327-8348-717f8bda3b6f", :kind "code", :output-log-lines {}, :runtime [:runtime "4641de4c-67e7-4689-90f8-f22f1092707a"]}, "4641de4c-67e7-4689-90f8-f22f1092707a" {:environment [:environment {:article/nextjournal.id #uuid "5b45e08b-5b96-413e-84ed-f03b5b65bd66", :change/nextjournal.id #uuid "5df5e18c-0be4-4d8d-b099-6ce55ca12cf4", :node/id "0ac0b628-8b41-44d3-9023-3a688335af14"}], :environment? true, :id "4641de4c-67e7-4689-90f8-f22f1092707a", :kind "runtime", :language "bash", :name "GraalVM", :type :nextjournal, :docker/environment-image "docker.nextjournal.com/environment@sha256:0b8e97c43b7021d116254a643df5d8df00f846533c539bfa0aad882c0f6a5d54", :runtime/environment-variables [{:name "GRAAL_VERSION", :value "20.0.0"} {:name "PATH", :value "/usr/local/graalvm/bin:/opt/conda/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"} {:name "GRAAL_DIR", :value "/usr/local/graalvm"} {:name "JAVA_VERSION", :value "8"}]}, "57e139fb-1a5e-43c3-b551-c1546ecb95b5" {:id "57e139fb-1a5e-43c3-b551-c1546ecb95b5", :kind "reference", :ref-id "4641de4c-67e7-4689-90f8-f22f1092707a"}, "6afcc8f4-11dc-4de9-8e8d-f370ba41dd19" {:id "6afcc8f4-11dc-4de9-8e8d-f370ba41dd19", :kind "reference", :link [:output "22f34710-72c9-46d3-bc78-b80130eec66c" "graalvm-ce-java8-linux-amd64-20.0.0.tar.gz"]}, "b08d71a1-411b-4850-b675-89479cd22b28" {:compute-ref #uuid "4fad24c1-9436-44e5-bd0d-46535c2167d2", :exec-duration 2958, :id "b08d71a1-411b-4850-b675-89479cd22b28", :kind "code", :output-log-lines {:stdout 5}, :runtime [:runtime "4641de4c-67e7-4689-90f8-f22f1092707a"]}, "ddb404a8-852e-4539-b9fc-4910c9fc82c3" {:compute-ref #uuid "94a46c0f-a961-4ac3-9e41-f6a5955ac8b3", :exec-duration 1154, :id "ddb404a8-852e-4539-b9fc-4910c9fc82c3", :kind "code", :output-log-lines {:stdout 4}, :runtime [:runtime "4641de4c-67e7-4689-90f8-f22f1092707a"]}}, :nextjournal/id #uuid "02d2c8c9-9f14-48cb-9f18-e37e7d566dba", :article/change {:nextjournal/id #uuid "5e4d20e8-a8f8-4d77-beb4-d0196ced0ae3"}}} ```