jvm-profiling-tools / perf-map-agent

A java agent to generate method mappings to use with the linux `perf` tool
GNU General Public License v2.0
1.65k stars 260 forks source link

Problem building in Centos 6 #38

Closed mircea-vutcovici closed 8 years ago

mircea-vutcovici commented 8 years ago

When running make I receive the following error:

src/java/AttachOnce.java:25: cannot access com.sun.tools.attach.VirtualMachine
bad class file: com/sun/tools/attach/VirtualMachine.class(com/sun/tools/attach:VirtualMachine.class)
class file has wrong version 52.0, should be 50.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
import com.sun.tools.attach.VirtualMachine;
                           ^

Full output:

$ JAVA_HOME=/usr/java/jdk1.8.0_60/ cmake .
-- JNI_INCLUDE_DIRS=/usr/java/jdk1.8/include;/usr/java/jdk1.8/include/linux;/usr/java/jdk1.8/include
-- JNI_LIBRARIES=/usr/java/jdk1.8/jre/lib/amd64/libjawt.so;/usr/java/jdk1.8/jre/lib/amd64/server/libjvm.so
-- JAVA_INCLUDE_PATH=/usr/java/jdk1.8/include
-- JAVA_INCLUDE_PATH2=/usr/java/jdk1.8/include/linux
-- Configuring done
-- Generating done
-- Build files have been written to: /root/perf-map-agent
$ make
[ 20%] Building Java objects for attach-main.jar
src/java/AttachOnce.java:25: cannot access com.sun.tools.attach.VirtualMachine
bad class file: com/sun/tools/attach/VirtualMachine.class(com/sun/tools/attach:VirtualMachine.class)
class file has wrong version 52.0, should be 50.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
import com.sun.tools.attach.VirtualMachine;
                           ^
make[2]: *** [out/CMakeFiles/attach-main.dir/java_compiled_attach-main] Error 1
make[1]: *** [CMakeFiles/attach-main.dir/all] Error 2
make: *** [all] Error 2
$

I run a strace -fe file make and it is finding tools.jar file:

[pid  2128] open("/usr/java/jdk1.8/include/../lib/tools.jar", O_RDONLY) = 5
src/java/AttachOnce.java:25: cannot access com.sun.tools.attach.VirtualMachine
bad class file: com/sun/tools/attach/VirtualMachine.class(com/sun/tools/attach:VirtualMachine.class)
class file has wrong version 52.0, should be 50.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
import com.sun.tools.attach.VirtualMachine;
                           ^
[pid  2154] +++ exited with 0 +++
mircea-vutcovici commented 8 years ago

Adding $JAVA_HOME/bin in the path fixed the issue.

PATH=/usr/java/jdk1.8.0_60/bin:$PATH JAVA_HOME=/usr/java/jdk1.8.0_60/ cmake .
make
jrudolph commented 8 years ago

Great you found a solution to your issue. Closing, feel free to reopen if some problem persists.