GlassFish5 w/JDK8 under MacOS JDK11 install - java

Need to run GlassFish5 on MacOS. Current version installed are JDK11.02 and JDK1.8.0_144.
>echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home
>which java
/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin/java
>java -version
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
I have appended the last line in file glassfish5/bin/asenv.bat with
AS_JAVA=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
And I still get a NPE Exception when starting up GlassFish:
>asadmin start-domain
Exception in thread "main" java.lang.NullPointerException
What am I missing?
Or is running GlassFish w/JDK 8 (u144) on MacOS with a JDK11 not possible?

Instead of setting AS_JAVA variable in asenv.bat, you need to set AS_JAVA in glassfish5/config/asenv.conf.
AS_JAVA=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home

Related

How to set JDK 8 for Jenkins and JDK 14 for build job?

I am use Jenkins 2.222.4 on Windows 2016 server.
How to set JDK 8 for Jenkins and JDK 14 for build job?
Thank you! Because I really need this type of configuration.
C:\Users\Administrator>java -version
Java version "14.0.1" 2020-04-14
Java(TM) SE Runtime Environment (build 14.0.1+7)
Java HotSpot(TM) 64-Bit Server W (build 14.0.1+7, mixed mode, sharing)
C:\Users\Administrator>javac -version
javac 14.0.1
C:\Users\Administrator>

Why cant i run Jar file in Windows?

I am trying to run a javaFx jar in windows cmd with java -jar filename.jar but i get this error:
Error: JavaFX runtime components are missing, and are required to run this application.
In intellij works the programm fine but i cant run it in Windows. Any Ideas?
This is my Java Version
java version "11.0.5" 2019-10-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.5+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.5+10-LTS, mixed mode)

elasticsearch command is not working with java 11

i am unable to start my elasticsearch server when i doelasticsearch i got this message
Unrecognized VM option 'UseParNewGC'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
i am using elasticsearch-1.6 and
java-version is
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
Os->Ubuntu 18.04.2 LTS
when i have java 1.8 elasticsearch was working fine how can i resolve this issue?

elasticsearch won't start because it can't find java 8

I'm trying to run an instance of elasticsearch version 1.8 on an ubuntu machine.
When i elasticsearch I get:
es#ubuntu-mwa-flask:/root/elasticsearch-5.4.0$ ./bin/elasticsearch
Error: Could not find or load main class org.elasticsearch.tools.JavaVersionChecker
Elasticsearch requires at least Java 8 but your Java version from /usr/bin/java does not meet this requirement
I've checked which java version I have:
es#ubuntu-mwa-flask:/root/elasticsearch-5.4.0$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
What am I doing wrong? I've installed elasticsearch on afew machines before, why doesn't this one work?
edit1: since someone asked:
es#ubuntu-mwa-flask:/root/elasticsearch-5.4.0$ /usr/bin/java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
mixed mode)
edit2:
es#ubuntu-mwa-flask:/root/elasticsearch-5.4.0$ javac -version
javac 1.8.0_131
Probably you don't have right permissions. Try to set them to 774 and check again:
sudo chmod 774 -R elasticsearch-6.3.2/

How to install Java 8 on machine with other Java versions

I installed Java 8 (jdk-8u60-windows-x64.exe) on machine with several other versions.
After installation I see the following message
d:\Userprofiles\user>java -version
Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'
has value '1.8', but '1.7' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
I can change JAVA_HOME to the new location but this does not fix the above message.
When I edit the registry and change 1.8 in serveral registry keys to 1.7 I have a working configuration again. But this is still 1.7.
Changing JAVA_HOME does not seem to have any effect. When I change it to my new installed JDK
d:\Userprofiles\user>java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
d:\Userprofiles\user>echo %JAVA_HOME%
D:\Program Files\Java\jdk1.8.0_60
What do I need to do to have 1.8 working on my machine? JAVA_HOME seems obsolete now, should I change the registry? What should I do to change registry so that picks up the 1.8 version?
It's not enough just to introduce the value for %JAVA_HOME% (actually, Java doesn't care if there is or there isn't such environment variable).
What you have to do is to append %JAVA_HOME%/bin directory to the Path environment variable, so that you get the java.exe that matches the %JAVA_HOME% version, without having to write the full path to the java.exe executable that you want to trigger.
So, either do this:
set a value for the %JAVA_HOME% environment variable
append %JAVA_HOME%/bin to the Path environment variable
or just
append <the-java-home-directory>/bin to the Path variable.
Personally, I would prefer to maintain a value for JAVA_HOME, as it is needed by tools like Maven, Hadoop, etc.
You can have as many JDK's installed as you want, and you don't even need them in the PATH, or to set JAVA_HOME.
The first one found in the PATH will be the default one. Remember to only install the JDK, not the JRE that always comes with the JDK, i.e. unselect the 3rd option when installing.
I have 9 JDK's installed, and I can run all of them without changing anything. All you have to do is qualify the executable:
C:\>prog\java32\jdk1.4.2_19\bin\java.exe -version
java version "1.4.2_19"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_19-b04)
Java HotSpot(TM) Client VM (build 1.4.2_19-b04, mixed mode)
C:\>prog\java32\jdk1.5.0_22\bin\java.exe -version
java version "1.5.0_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
Java HotSpot(TM) Client VM (build 1.5.0_22-b03, mixed mode)
C:\>prog\java32\jdk1.6.0_45\bin\java.exe -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode, sharing)
C:\>prog\java32\jdk1.7.0_79\bin\java.exe -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) Client VM (build 24.79-b02, mixed mode, sharing)
C:\>prog\java32\jdk1.8.0_51\bin\java.exe -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) Client VM (build 25.51-b03, mixed mode, sharing)
C:\>prog\java64\jdk1.5.0_22\bin\java.exe -version
java version "1.5.0_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_22-b03, mixed mode)
C:\>prog\java64\jdk1.6.0_45\bin\java.exe -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
C:\>prog\java64\jdk1.7.0_79\bin\java.exe -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
C:\>prog\java64\jdk1.8.0_51\bin\java.exe -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
That was the output in a single Command Prompt, without ever setting the PATH.

Categories