![JMagick 无法找到 Java 目录](https://linux22.com/image/70785/JMagick%20%E6%97%A0%E6%B3%95%E6%89%BE%E5%88%B0%20Java%20%E7%9B%AE%E5%BD%95.png)
我正在尝试配置我的JMagick
安装,但是当我运行时./configure
,我收到一条错误消息,指出“无法找到 Java 目录:”
./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for a BSD-compatible install... /usr/bin/install -c
checking for getconf... /usr/bin/getconf
checking whether large file support needs explicit enabling... no
checking for X... libraries , headers
configure: error: 'Unable to locate Java directories'
我知道 正在configure
寻找java
、javac
、jar
和gcc
。当我输入whereis
这些项目中的每一个时,我发现它们都在我的$PATH
输入中/usr/bin
(我什至将每个项目单独添加到路径中):
PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/bin/java:/usr/bin/javac:/usr/bin/jar:/usr/bin/gcc
whereis java javac jar gcc
java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java /usr/share/man/man1/java.1.gz
javac: /usr/bin/javac /usr/share/man/man1/javac.1.gz
jar: /usr/bin/jar /usr/share/man/man1/jar.1.gz
gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz
根据我所能找到的,我相信我需要设置一个JAVA_HOME
环境变量。所以我做了:
JAVA_HOME=/usr/bin/java
尽管如此,我仍然收到Unable to locate Java directories
错误。
VM 上运行的各种技术的当前版本是:
java version "1.7.0_09-icedtea"
OpenJDK Runtime Environment (rhel-2.3.4.1.el6_3-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
javac 1.7.0_09
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
答案1
JAVA_HOME 变量应设置为 JDK 安装的文件夹。在您的情况下,它被设置为二进制可执行文件。
所以替换为
JAVA_HOME=/usr/bin/java
与实际文件夹。要找到该文件夹,请尝试
ls -lh /usr/bin/java # 这应该是指向实际文件的符号链接
编辑:将命令从更改ln
为ls