You are not logged in.

#1 2017-02-04 10:52:33

oowinnetouoo
Member
Registered: 2012-11-29
Posts: 18

JAVA_HOME not set

Hello,

I am trying to install bazel, but this gives me following error:

$ pacaur -S bazel
[...]
which: no javac in (/home/philipp/.local/bin:/usr/lib/colorgcc/bin/:/usr/lib/ccache/bin/:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/cuda/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
readlink: missing operand
Try 'readlink --help' for more information.
INFO: You can skip this first step by providing a path to the bazel binary as second argument:
INFO:    ./compile.sh compile /path/to/bazel
?  Building Bazel from scratch
ERROR: JDK not found, please set $JAVA_HOME.
==> ERROR: A failure occurred in build().
    Aborting...
:: failed to build bazel package(s)

Any suggestions how to fix this?
Thanks in advance!

Last edited by oowinnetouoo (2017-02-04 10:52:44)

Offline

#2 2017-02-04 11:02:33

ayekat
Member
Registered: 2011-01-17
Posts: 1,611

Re: JAVA_HOME not set

Have you checked whether javac exists on your system? It's supposed to be /usr/bin/javac → /usr/lib/jvm/default/bin/javac. Both of them appear to be in your $PATH, so there is no need to set $JAVA_HOME.


pkgshackscfgblag

Offline

#3 2017-02-04 12:54:31

Stewart Little
Member
From: England, UK
Registered: 2017-01-18
Posts: 120

Re: JAVA_HOME not set

If you have installed the jdk8-openjdk, jre8-openjdk, java-openjfx and icedtea-web packages it should work all the files should be included in those packages - do have these installed on your system?


“Great minds discuss ideas; average minds discuss events; small minds discuss people.” -Eleanor Roosevelt
“It is our choices, that show what we truly are, far more than our abilities.” -J. K Rowling
-----
How to Ask Questions the Smart Way

Offline

#4 2017-02-04 13:00:34

sl1pkn07
Member
From: Spanishtán
Registered: 2010-03-30
Posts: 371

Re: JAVA_HOME not set

add in this before ./compile.sh

export JAVA_HOME=/usr/lib/jvm/default

Offline

#5 2017-02-04 14:39:31

oowinnetouoo
Member
Registered: 2012-11-29
Posts: 18

Re: JAVA_HOME not set

After installation of  jdk8-openjdk, jre8-openjdk, java-openjfx and icedtea-web:

ayekat wrote:

Have you checked whether javac exists on your system? It's supposed to be /usr/bin/javac → /usr/lib/jvm/default/bin/javac. Both of them appear to be in your $PATH, so there is no need to set $JAVA_HOME.

$ ls /usr/lib/jvm/default/bin/
java  keytool  orbd  pack200  policytool  rmid  rmiregistry  servertool  tnameserv  unpack200

No javac in there sad

Offline

#6 2017-02-04 14:51:07

oowinnetouoo
Member
Registered: 2012-11-29
Posts: 18

Re: JAVA_HOME not set

With Java 7:

$pacman -S jdk7-openjdk
$archlinux-java set java-7-openjdk
INFO: You can skip this first step by providing a path to the bazel binary as second argument:
INFO:    ./compile.sh compile /path/to/bazel
?  Building Bazel from scratch
ERROR: JDK version (1.7) is lower than 1.8, please set $JAVA_HOME.
==> ERROR: A failure occurred in build().
    Aborting...

Obvious not working, but Java 8 also fails:

archlinux-java set java-8-openjdk
src/main/java/com/google/devtools/build/lib/server/signal/InterruptSignalHandler.java:17: warning: Signal is internal proprietary API and may be removed in a future release
import sun.misc.Signal;
               ^
src/main/java/com/google/devtools/build/lib/server/signal/InterruptSignalHandler.java:18: warning: SignalHandler is internal proprietary API and may be removed in a future release
import sun.misc.SignalHandler;
               ^
src/main/java/com/google/devtools/build/lib/server/signal/InterruptSignalHandler.java:17: warning: Signal is internal proprietary API and may be removed in a future release
import sun.misc.Signal;
               ^
src/main/java/com/google/devtools/build/lib/server/signal/InterruptSignalHandler.java:18: warning: SignalHandler is internal proprietary API and may be removed in a future release
import sun.misc.SignalHandler;
               ^
src/main/java/com/google/devtools/build/lib/server/signal/InterruptSignalHandler.java:17: warning: Signal is internal proprietary API and may be removed in a future release
import sun.misc.Signal;
               ^
src/main/java/com/google/devtools/build/lib/server/signal/InterruptSignalHandler.java:18: warning: SignalHandler is internal proprietary API and may be removed in a future release
import sun.misc.SignalHandler;
               ^
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f7e1183059e, pid=15805, tid=0x00007f7dfbc21700
#
# JRE version: OpenJDK Runtime Environment (8.0_121-b13) (build 1.8.0_121-b13)
# Java VM: OpenJDK 64-Bit Server VM (25.121-b13 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x60659e]
#
# Core dump written. Default location: /home/philipp/.cache/pacaur/bazel/src/core or core.15805
#
# An error report file with more information is saved as:
# /home/philipp/.cache/pacaur/bazel/src/hs_err_pid15805.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
/home/philipp/.cache/pacaur/bazel/PKGBUILD: line 22: ./output/bazel: No such file or directory
==> ERROR: A failure occurred in build().
    Aborting...
:: failed to build bazel package(s)

BTW:

$JAVA_HOME

was not set by any of

archlinux-java

commands.

I have also exported the JAVA_HOME enviroment variable,

export JAVA_HOME=/usr/lib/jvm/default

Compile warnings vanish, but segfault is still there.

Last edited by oowinnetouoo (2017-02-04 14:55:37)

Offline

#7 2017-02-04 15:00:07

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,945

Re: JAVA_HOME not set

that folder /usr/lib/jvm/default/bin/ needs a lot more files, looks like something went wrong with your installation .

$ pacman -Qo /usr/bin/javac
/usr/bin/javac is owned by java-environment-common 2-2
$

please post pacman -Qs java

Last edited by Lone_Wolf (2017-02-04 15:00:56)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#8 2017-02-04 15:14:34

oowinnetouoo
Member
Registered: 2012-11-29
Posts: 18

Re: JAVA_HOME not set

Lone_Wolf wrote:

that folder /usr/lib/jvm/default/bin/ needs a lot more files, looks like something went wrong with your installation .

$ pacman -Qo /usr/bin/javac
/usr/bin/javac is owned by java-environment-common 2-2
$

please post pacman -Qs java

Here you go:

local/ca-certificates-utils 20160507-1
    Common CA certificates (utilities)
local/geos 3.5.0-2
    C++ port of the Java Topology Suite
local/icedtea-web 1.6.2-2
    Free web browser plugin to run applets written in Java and an implementation of Java Web Start
local/java-environment-common 2-2
    Common files for Java Development Kits
local/java-openjfx 8.u76-2
    Java OpenJFX 8 client application platform (open-source implementation of JavaFX)
local/java-runtime-common 2-2
    Common files for Java Runtime Environments
local/jdk 8u121-1
    Oracle Java Development Kit
local/jdk7-openjdk 7.u111_2.6.7-1
    OpenJDK Java 7 development kit
local/jdk8-openjdk 8.u121-1
    OpenJDK Java 8 development kit
local/jre 8u121-1
    Oracle Java Runtime Environment
local/jre7 7u79-3
    Oracle Java 7 Runtime Environment (public release - end of support)
local/jre7-openjdk 7.u111_2.6.7-1
    OpenJDK Java 7 full runtime environment
local/jre7-openjdk-headless 7.u111_2.6.7-1
    OpenJDK Java 7 headless runtime environment
local/jre8-openjdk 8.u121-1
    OpenJDK Java 8 full runtime environment
local/jre8-openjdk-headless 8.u121-1
    OpenJDK Java 8 headless runtime environment
local/js 24.2.0-4
    JavaScript interpreter and libraries
local/js17 17.0.0-4
    JavaScript interpreter and libraries (legacy)
local/qt5-declarative 5.8.0-1 (qt qt5)
    Classes for QML and JavaScript languages
local/qt5-webchannel 5.8.0-1 (qt qt5)
    Provides access to QObject or QML objects from HTML clients for seamless integration of Qt applications with HTML/JavaScript
    clients

I have also tried Oracle's Java, but got this error:

$ archlinux-java set java-8-jdk
.WARNING: /tmp/bazel_3MOyOSVY/out/external/bazel_tools/WORKSPACE:1: Workspace name in /tmp/bazel_3MOyOSVY/out/external/bazel_tools/WORKSPACE (@io_bazel) does not match the name given in the repository's definition (@bazel_tools); this will cause a build error in future versions.
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f9a2a5a9cb5, pid=24024, tid=0x00007f99fd5f6700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_121-b13) (build 1.8.0_121-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.121-b13 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x437cb5]  ciObjectFactory::get_unloaded_klass(ciKlass*, ciSymbol*, bool)+0x45
#
# Core dump written. Default location: /home/philipp/.cache/pacaur/bazel/src/core or core.24024
#
# An error report file with more information is saved as:
# /home/philipp/.cache/pacaur/bazel/src/hs_err_pid24024.log
INFO: Loading package: src
#
# Compiler replay data is saved as:
# /home/philipp/.cache/pacaur/bazel/src/replay_pid24024.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
scripts/bootstrap/compile.sh: line 311: 24024 Aborted                 (core dumped) "${JAVA_HOME}/bin/java" -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -Dfile.encoding=ISO-8859-1 -XX:HeapDumpPath=${OUTPUT_DIR} -Djava.util.logging.config.file=${OUTPUT_DIR}/javalog.properties ${JNI_FLAGS} -jar ${ARCHIVE_DIR}/libblaze.jar --batch --install_base=${ARCHIVE_DIR} --output_base=${OUTPUT_DIR}/out --install_md5= --workspace_directory=${PWD} --nofatal_event_bus_exceptions ${BAZEL_DIR_STARTUP_OPTIONS} ${BAZEL_BOOTSTRAP_STARTUP_OPTIONS:-} $command --ignore_unsupported_sandboxing --startup_time=329 --extract_data_time=523 --rc_source=/dev/null --isatty=1 --ignore_client_env --client_cwd=${PWD} "${@}"

Last edited by oowinnetouoo (2017-02-04 15:22:16)

Offline

#9 2017-02-04 15:25:04

ayekat
Member
Registered: 2011-01-17
Posts: 1,611

Re: JAVA_HOME not set

The first one tells you that the application requires JDK 1.7, so you need to compile it with Java 8 (jdk8-openjdk)'s compiler. That seems reasonable so far.

The second one is a bit odd - I just built the `bazel` package on my own system, and noticed the following:

  • From a quick glance (I've lost the full output), there appears to be no Java source file being compiled - are you building the same package as I was?

  • It creates directories in my home directory (notably ~/.cache, despite my $XDG_CACHE_HOME being set to a different value) - that's not a problem with the package, but rather with whatever is running as part of the build process - and it's definitely not polite to create files outside the build directory, so I would already advise against its use just on principle.

Also, no, there is no need to set $JAVA_HOME - that's only if you want to set a temporary installation location for the JRE/JDK. What's the output of this command?

pacman -Qkk jdk8-openjdk

pkgshackscfgblag

Offline

#10 2017-02-04 15:36:02

oowinnetouoo
Member
Registered: 2012-11-29
Posts: 18

Re: JAVA_HOME not set

ayekat wrote:

The first one tells you that the application requires JDK 1.7, so you need to compile it with Java 8 (jdk8-openjdk)'s compiler. That seems reasonable so far.

The second one is a bit odd - I just built the `bazel` package on my own system, and noticed the following:

  • From a quick glance (I've lost the full output), there appears to be no Java source file being compiled - are you building the same package as I was?

  • It creates directories in my home directory (notably ~/.cache, despite my $XDG_CACHE_HOME being set to a different value) - that's not a problem with the package, but rather with whatever is running as part of the build process - and it's definitely not polite to create files outside the build directory, so I would already advise against its use just on principle.

Also, no, there is no need to set $JAVA_HOME - that's only if you want to set a temporary installation location for the JRE/JDK. What's the output of this command?

pacman -Qkk jdk8-openjdk

I have unsetted the JAVA_HOME, this works now!

Offline

Board footer

Powered by FluxBB