Jack M
Jack M

Reputation: 6025

How can I run a JHipster app on Ubuntu with Java 11?

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).

Upvotes: 7

Views: 9863

Answers (4)

Manolo de la Vega
Manolo de la Vega

Reputation: 333

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

Upvotes: 1

SDReyes
SDReyes

Reputation: 9954

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

Upvotes: 2

mtbadi39
mtbadi39

Reputation: 448

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

Upvotes: 6

uruemu
uruemu

Reputation: 635

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/

Upvotes: -2

Related Questions