Repository navigation
Closed
Description
Description of the problem / feature request:
Cannot build Java targets on Google Cloud Shell
Feature requests: what underlying problem are you trying to solve with this feature?
Trying to make a tutorial that utilizes bazel
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
$ cat > BUILD << EOF
java_binary(
name="main",
srcs=["Main.java"],
main_class='com.example.Main'
)
EOF
$ cat > Main.java << EOF
package com.example;
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
EOF
$ touch WORKSPACE
$ bazel build //:main
INFO: Analysed target //:main (0 packages loaded).
INFO: Found 1 target...
ERROR: missing input file '@local_jdk//:jre/lib/resources.jar'
ERROR: /home/vmax0770/example/BUILD:1:1: //:main: missing input file '@local_jdk//:jre/lib/resources.jar'
Target //:main failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /home/vmax0770/example/BUILD:1:1 1 input file(s) do not exist
INFO: Elapsed time: 0.372s, Critical Path: 0.01s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
What operating system are you running Bazel on?
$ uname -a
Linux cs-6000-devshell-vm-e30028a8-d952-44be-bf5f-f01806facc02 4.14.33+ #1 SMP Sat Jul 28 01:03:28 PDT 2018 x86_64 GNU/Linux
What's the output of bazel info release?
release 0.16.0
Have you found anything relevant by searching the web?
Found a similar issue that was closed with no solution by the author: #2533
Any other information, logs, or outputs that you want to share?
The error I get here is flaky. For example, after running bazel clean --expunge; bazel build //:main I was able to get (notice charsets.jar instead of resources.jar:
INFO: Analysed target //:main (15 packages loaded).
INFO: Found 1 target...
ERROR: missing input file '@local_jdk//:jre/lib/charsets.jar'
ERROR: /home/vmax0770/example/BUILD:1:1: //:main: missing input file '@local_jdk//:jre/lib/charsets.jar'
Target //:main failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /home/vmax0770/example/BUILD:1:1 1 input file(s) do not exist
$ update-java-alternatives --list
java-1.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64
$ echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64/jre
Metadata
Metadata
Assignees
Labels
No labels
Activity
jyksnw commentedon Aug 6, 2018
I am having the same or similar problem.
Description of the problem/feature request:
Cannot build Java targets on Ubuntu 18.04
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Same setup posted by @vmax
What operating system are you running Bazel on?
Ubuntu 18.04
What's the output of
bazel info release?Have you found anything relevant by searching the web?
This bug along with #2533
Any other information, logs, or outputs that you want to share?
buchgr commentedon Aug 6, 2018
@cushon any ideas?
cushon commentedon Aug 6, 2018
This sounds related to #5744
jyksnw commentedon Aug 6, 2018
Even though java and javac are Java 8, JAVA_HOME appears to be set to Java 10. I had to update /etc/environment to point to the correct JAVA_HOME which corrected my problem. I was able to figure this out by reading through #5744
cushon commentedon Aug 7, 2018
The
--javabasediscovery usesJAVA_HOMEandwhich javac, in that order (I don't know what the rationale for the order was):bazel/src/main/cpp/blaze_util_linux.cc
Line 172 in ac69da0
The issue with Bazel not supporting JDK > 8
--javabases, and defaulting to using the embedded JDK 10 as the--javabaseifJAVA_HOMEis unset, will be tracked by /issues/5744.buchgr commentedon Aug 10, 2018
We have created a 0.16.1 release candidate and are planning on releasing this as 0.16.1 on Monday. Please give it a spin https://releases.bazel.build/0.16.1/rc2/index.html
vmax commentedon Aug 11, 2018
@buchgr thanks for the tip, seems upgrading actually resolved the issue 🙂