Specify the default JAVA_HOME used in buildship

Note because it was jammed

problem

--Installed Java - jre 10.0.2 (Windows x64) - jdk 10.0.2 (Windows x64)

Now when I try to compile Java from the Gradle task view in Eclipse, I use the JRE and can't compile.

Working directory: C:\~~
Gradle User Home: C:\Users\~\.gradle
Gradle distribution:Gradle wrapper from target build
Gradle version: 4.9
Java home: C:\Program Files\Java\jre-10.0.2
JVM argument:None
Program arguments:None
Build Scans Enabled: false
Offline Mode Enabled: false
Gradle task: :compileJava

> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 0s
1 actionable task: 1 executed

It can be done by specifying the Java home from the Eclipse execution configuration, but it is troublesome because it needs to be set for each project / task. You can write the settings in gradle.properties in your project, but I don't want to do that because the repository gets polluted with the local path.

Measure

It seems that you can set what to decide JAVA_HOME based on Gradle setting of Eclipse.

--Java_HOME http://umetyuu.hatenablog.com/entry/2015/04/14/011833 by Gradle in Eclipse

However, I don't know why, but I don't have that setting (though I think it happened when I was using Gradle for STS).

image.png

I gave up here because I want to operate only with gradlew without installing Gradle.


To specify the JRE when using gradlew:

~/.gradle/gradle.properties


org.gradle.java.home=C:\\Program Files\\Java\\jdk-10.0.2

This is also referred to when the corrected part jumps to the user home and gradlews normally, but since I plan to use Gradle only from Eclipse, I compromised with this for the time being.

Recommended Posts

Specify the default JAVA_HOME used in buildship
Specify the java location in eclipse.ini
Expression used in the fizz_buzz problem
Use the JDK used in Android Studio in the terminal
Specify the default value with @Builder of Lombok
[Java] Let's declare variables used in the loop in the loop [Variables in the block]
I tried to organize the cases used in programming
Source used to get the redirect source URL in Java
Personal summary of the guys often used in JUnit 4
How to specify the resource path in HTML import
Specify VS Code as the default editor for jshell
Review because I used the collection_check_boxes method in the Ralis portfolio
[Java] ArrayList → Should I specify the size in array conversion?
The case that @Autowired could not be used in JUnit5
[Question] Can nullif be used in the count function in JPQL?