mhulse / vagrant-latmp

Vagrant LA(T)MP Stack: CentOS 7 + Apache HTTP + Apache Tomcat + MySQL + PHP + Python + Ruby + Node.js
Apache License 2.0
3 stars 3 forks source link

Java EE 8 #101

Open sirpoisonivy opened 6 years ago

sirpoisonivy commented 6 years ago

Hi Mr. Hulse,

I've been looking at the vast array of Java versions available and I notice that the VM uses the standard opensdk that ships with CentOS. Would it be possible to swap that out for the official Java Enterprise Edition v8 instead? I don't think it's a critical issue now but I know the opensdk lacks even some features which are available in the Standard Edition of Java.

http://www.oracle.com/technetwork/java/javaee/downloads/java-ee-sdk-downloads-3908423.html

Thank You,

ji

mhulse commented 6 years ago

That sounds like a great idea! I was not aware of the lack of features of the standard opensdk.

As it stands currently, I have java installed when I install Tomcat (as it is a dependency for Tomcat):

https://github.com/mhulse/vagrant-latmp/blob/382ca7463570f751a1f39d258cb4936c7b9640ba/bootstrap/tomcat.sh#L7-L8

It's looking like I need to move Java installation into it's own bootstrap script.

I'll do some research to figure out how do install the Java Enterprise Edition v8. Thanks for the tip/suggestion. I'll try to look at this sometime this week/weekend. 👍

Let me know if you have any further suggestions, I really appreciate it!

mhulse commented 6 years ago

Found this guide:

Looks like I'll just need to modify the version numbers to match the later versions of Java.

This is also interesting to know:

The two installations (OpenJDK and JEE) can happily coexist.

https://www.centos.org/forums/viewtopic.php?t=52269#p221357

I'm going to create a bootstrap shell script for java specifically.

mhulse commented 6 years ago

There's a nice bash method here to check if java is outdated:

https://www.centos.org/forums/viewtopic.php?p=221446#p221446

#!/bin/bash
isUpToDate() {
    URL=http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
    NEW=$(/usr/bin/wget -qO - $URL |grep ^downloads |head -1 |grep -Eo 'jdk-....')
    NEWVER=`echo $NEW |grep -Eo [0-9].* |grep -Eo '[0-9]*'`
    read -a NEWARR <<< $NEWVER
    OLD=$(javac -version 2>&1 |grep -Eo [0-9].*)
    read -a OLDARR <<< `echo $OLD |grep -Eo '[0-9]{1,2}'`
    return $([ ${NEWARR[0]} -eq ${OLDARR[1]} -a ${NEWARR[1]} -eq ${OLDARR[3]} ])
}
if isUpToDate
then
    echo "Java is up to date"
else
    echo "Java needs to be updated"
fi
mhulse commented 6 years ago

Looks like SDKman can install java:

$ sdk install java

Something to look into.