如何使用64位Java JDK

时间:2015-12-11 19:00:26

标签: java tomcat tomcat7 solaris

我正在使用Solaris Sparc 64位计算机。我想使用64位版本的Java构建Tomcat本机。我根据JDK 7 Installation on the Oracle Solaris Operating System在我的Solaris盒子中安装了Java。

当我检查Java版本时:

/usr/jdk/jdk1.7.0_80/bin/java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) Server VM (build 24.80-b11, mixed mode)

我还导出JAVA_HOME

export JAVA_HOME=/usr/jdk/jdk1.7.0_80

我配置:

./configure --with-apr=/usr/local/apr/bin/apr-1-config --with-java-home=$JAVA_HOME \
--with-ssl=/usr/local/ssl --prefix=$CATALINA_HOME

我能够使用这个java 32位构建,但64位java存在于:

/usr/jdk/jdk1.7.0_80/bin/sparcv9/java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

如何告诉我的Tomcat本机配置使用64位java而不是32位java?

这里的问题是我可以使用32位java和tomcat构建。但是在生产中没有32位JRE,只有64位JRE。如果我使用相同的32位Tomcat本机库,则会产生:

wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)]

更新#1

INFO: Loaded APR based Apache Tomcat Native library 1.1.33 using APR version 1.5.2.
Dec 12, 2015 8:02:42 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Dec 12, 2015 8:02:42 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1p 9 Jul 2015)
Dec 12, 2015 8:02:43 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-0.0.0.0-8081"]
Dec 12, 2015 8:02:43 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-0:0:0:0:0:0:0:0-8081"]
Dec 12, 2015 8:02:43 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-0.0.0.0-8444"]
ld.so.1: java: fatal: relocation error: file /tomcat7/lib/libtcnative-1.so.0.1.33: symbol EC_KEY_new_by_curve_name: referenced symbol not found

APR,

 CFLAGS="-m64" ./configure

TC-天然的,

 CFLAGS="-m64" ./configure --with-apr=/usr/local/apr/bin/apr-1-config --with-java-home=/usr/jdk/instances/jdk1.7.0/ --with-ssl=/usr/local/ssl --prefix=/tomcat7

工作! ----------------------------------------------- ------------------------

构建openssl,

export KERNEL_BITS=64
./config shared
make 
make install

构建APR

CC="cc" CFLAGS="-m64" LDFLAGS="-m64" ./configure
make
make install

构建tc-native

CC="cc" CFLAGS="-m64 -fPIC" LDFLAGS="-m64" ./configure --with-apr=/usr/local/apr/bin/apr-1-config --with-java-home=/usr/jdk/jdk1.7.0_80/ --with-ssl=/usr/local/ssl --prefix=/tomcat
make 
make install

1 个答案:

答案 0 :(得分:0)

看起来不是指定64位sparc目标的选项。

也许构建系统会自己从编译器标志中找到它。

我会尝试:

CFLAGS="-m 64" ./configure ...