diff --git a/.idea/misc.xml b/.idea/misc.xml
index 4444df8..a9010cc 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -6,9 +6,9 @@
+
-
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77313a6..1baa15e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,7 +9,8 @@ project(SchokoVM)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
-find_package(Java 1.8 REQUIRED)
+find_package(Java 11 EXACT REQUIRED COMPONENTS Runtime Development)
+find_package(JNI 11 EXACT REQUIRED)
include(UseJava)
find_package(libzip)
@@ -102,6 +103,31 @@ else ()
target_link_libraries(SchokoVM zip)
endif ()
+
+#
+# OpenJDK
+#
+
+file(REAL_PATH ${Java_JAVAC_EXECUTABLE} JDK_HOME)
+get_filename_component(JDK_HOME ${JDK_HOME} DIRECTORY)
+get_filename_component(JDK_HOME ${JDK_HOME} DIRECTORY)
+message(STATUS "jdk: ${JDK_HOME}")
+
+set(JDK_BIN ${CMAKE_CURRENT_SOURCE_DIR}/jdk/bin)
+if(NOT IS_DIRECTORY ${JDK_BIN})
+ message(STATUS "Copying ${JDK_HOME} to ${JDK_BIN}")
+# file(COPY ${JDK_HOME} DESTINATION ${JDK_BIN})
+ # this renames the target folder:
+ execute_process(COMMAND cp -r "${JDK_HOME}" "${JDK_BIN}")
+endif()
+
+set(JDK_EXPLODED ${CMAKE_CURRENT_SOURCE_DIR}/jdk/exploded-modules)
+if(NOT IS_DIRECTORY ${JDK_EXPLODED})
+ message(STATUS "Exploding")
+ execute_process(COMMAND ${JDK_HOME}/bin/jimage extract --dir "${JDK_EXPLODED}" "${JDK_BIN}/lib/modules")
+endif()
+
+
#
# Tests
#
diff --git a/jdk/.gitignore b/jdk/.gitignore
index 4752f89..c4b6a46 100644
--- a/jdk/.gitignore
+++ b/jdk/.gitignore
@@ -1,3 +1,3 @@
+/bin/
/exploded-modules/
-/jdk/
-/jdk-11.0.11+9/
+/jdk/
\ No newline at end of file
diff --git a/jdk/cleanup.sh b/jdk/cleanup.sh
new file mode 100755
index 0000000..93cf6de
--- /dev/null
+++ b/jdk/cleanup.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+
+# clion doesn't want to delete the symlinks
+rm -rf bin
+rm -rf exploded-modules
diff --git a/jdk/download.sh b/jdk/download.sh
index 963f766..2117f0b 100755
--- a/jdk/download.sh
+++ b/jdk/download.sh
@@ -1,18 +1,6 @@
#!/bin/sh
-
set -e
-if [ -d "jdk-11.0.11+9" ]; then
- echo "Skipping download of jdk release"
-else
- ARCHIVE="OpenJDK11U-jdk_x64_linux_hotspot_11.0.11_9.tar.gz"
- wget "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.11%2B9/$ARCHIVE"
- tar -xf "$ARCHIVE"
- rm "$ARCHIVE"
-
- jimage extract --dir exploded-modules jdk-11.0.11+9/lib/modules
-fi
-
if [ -d "jdk" ]; then
echo "Skipping download of jdk sources"
else
diff --git a/src/zip.hpp b/src/zip.hpp
index 0ce4ca1..54aca96 100644
--- a/src/zip.hpp
+++ b/src/zip.hpp
@@ -2,6 +2,7 @@
#define SCHOKOVM_ZIP_HPP
#include
+#include
#include
#include