Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for JDK 9+. #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ INCLUDE_DIRECTORIES(${JAVA_INCLUDE_PATH2})

add_library(perfmap SHARED src/c/perf-map-agent.c src/c/perf-map-file.c)

find_package(Java REQUIRED)
find_package(Java COMPONENTS Development)
if (Java_Development_FOUND)
message("Java development tools found.")
else()
message(FATAL_ERROR "Java development tools not found.")
endif()
include(UseJava)

set(CMAKE_JAVA_INCLUDE_PATH ${JAVA_INCLUDE_PATH}/../lib/tools.jar)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed then?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, if running Java 8 or earlier. Does not hurt with newer, just references a non-existing file.

Expand Down
10 changes: 8 additions & 2 deletions bin/create-java-perf-map.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,17 @@ fi
[ -d "$JAVA_HOME" ] || (echo "JAVA_HOME directory at '$JAVA_HOME' does not exist." && false)


if [ -f "$JAVA_HOME/lib/tools.jar" ]; then
JAVA_CLASSPATH="-cp $JAVA_HOME/lib/tools.jar"
else
JAVA_CLASSPATH="--add-modules jdk.attach"
fi

if [[ "$LINUX" == "1" ]]; then
sudo rm $PERF_MAP_FILE -f
(cd $PERF_MAP_DIR/out && sudo -u \#$TARGET_UID -g \#$TARGET_GID $JAVA_HOME/bin/java -cp $ATTACH_JAR_PATH:$JAVA_HOME/lib/tools.jar net.virtualvoid.perf.AttachOnce $PID "$OPTIONS")
(cd $PERF_MAP_DIR/out && sudo -u \#$TARGET_UID -g \#$TARGET_GID $JAVA_HOME/bin/java $JAVA_CLASSPATH -jar $ATTACH_JAR_PATH $PID "$OPTIONS")
sudo chown root:root $PERF_MAP_FILE
else
rm -f $PERF_MAP_FILE
(cd $PERF_MAP_DIR/out && $JAVA_HOME/bin/java -cp $ATTACH_JAR_PATH:$JAVA_HOME/lib/tools.jar net.virtualvoid.perf.AttachOnce $PID "$OPTIONS")
(cd $PERF_MAP_DIR/out && $JAVA_HOME/bin/java $JAVA_CLASSPATH -jar $ATTACH_JAR_PATH $PID "$OPTIONS")
fi