7

I'm trying to run an app generated by JHipster 5.7. When I try to run the mnvw file, I get:

[WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
You are running an incompatible version of Java. JHipster requires JDK 1.8

followed by a string of errors and a failure to run. I am indeed using JDK version 11. I've found some seemingly relevant information online but it's very difficult for me to really understand what any of it means, or even be entirely sure if it's relevant to my problem.

To avoid an XY problem I'm just going to ask my question in the most general, nooby way possible: how can I run a JHipster 5 app on Ubuntu (18.10) when I have JDK 11 installed? (If the answer is to install a different version of Java this is fine, but I don't know how to do this or how to tell JHipster to use that version).

Jack M
  • 4,769
  • 6
  • 43
  • 67
  • t's too early for JHipster on JDK 11 (see https://github.com/jhipster/generator-jhipster/issues/8683) there are few dependencies that don't work yet. Stay with JDK 8. – Gaël Marziou Nov 27 '18 at 22:23
  • @GaëlMarziou How do I do that? Also, why do you say JDK 8 when the error message says 1.8? – Jack M Nov 28 '18 at 05:29
  • 1.8 means 8, ask Oracle for details :) You specify version to install using apt-get, nothing specific to JHipster, only usual java stuff on Ubuntu – Gaël Marziou Nov 28 '18 at 12:22

4 Answers4

6

Am testing my generated app with Java 11 and it works without problems.

Just update the pom like this :

  1. Java version : <java.version>11</java.version>
  2. Spring Boot version : <spring-boot.version>2.1.2.RELEASE</spring-boot.version>
  3. Add jaxb dependencies :

    <dependency>
         <groupId>org.glassfish.jaxb</groupId>
         <artifactId>jaxb-runtime</artifactId>
         <version>2.3.2</version>
    </dependency>
    
  4. Comment or Remove maven-enforcer-plugin requireJavaVersion rule.

  5. mvn clean build

My Env : Windows 10 64-bit, OpenJDK 11.0.1 64-bit, Apache Netbeans 10, Maven 3.5.2, Spring Boot 2.1.2.RELEASE

mtbadi39
  • 448
  • 6
  • 18
2

if you're using jenv, you may experience some problems with maven, you need to include these plugins to make it work:

$ jenv enable-plugin maven

$ jenv enable-plugin export

restart your terminal and you're done.

BONUS: how do you know if this solution is for you: you're using jenv, jenv local 1.8, java -version shows you're using java 1.8, but still maven says you're not

SDReyes
  • 9,798
  • 16
  • 53
  • 92
1

I had the same problem, I resolved it by updating also my JAVA_HOME env variable. Usually I don't use it, and I switch version using update-alternatives but JHipster seems to use JAVA_HOME and not the version called by the system

-2

I had the same issue when running Jhipster on WSL Ubuntu 18.04. You just need to install java 8 and set as default. Steps can be found here http://tipsonubuntu.com/2016/07/31/install-oracle-java-8-9-ubuntu-16-04-linux-mint-18/

uruemu
  • 607
  • 6
  • 12