I'm writing a spring boot app where I am required to fetch the Linux distribution version within a function.
For example, if my app is running on an Ubuntu-16.04 machine, then I would like to know this version within my method. Or if I'm working on CentOS 6.9, then the method should return this.
I found that jvm stores some system properties which has os name, version and architecture. But the problem is that I have no way of determining the distribution from the kernel version number.
There is also the method of reading /etc/os-release, but this file is not present in older versions of centos.
I also found that /proc/version is not always present.
Is there a generic way to obtain this distribution value?
Related
I am using Elasticsearch which uses Java 8. I also want to install kafka on the same machine but kafka uses java 11. Both services are to be run in parallel. Can anyone tell how can I run both java versions at same time?
Manually download and unpack Java
https://adoptium.net/releases.html?variant=openjdk11
https://www.azul.com/downloads/?version=java-17-lts&os=windows&architecture=x86-64-bit&package=jre
Instead of simply starting java with the
java -args commandline,
you can start it via /install/path/to/java/bin/java -args
or, for windows, use C:\install\location\bin\java.exe -args
You might want to make some start scripts / batch files for that, depending on the exact requirements of your system and Elasticsearch and kafka and possibly other software.
That's it.
one little addition:
If you can NOT directly call java, or the software starts more java apps via the 'default' java, you can also use scripts to manipulate the PATH variables of your system before starting the app. Then you (and your apps) can simply call java -args again.
Once you download different versions of JRE(java runtime environment) to your local, if you use Eclipse IDE, you can checkout different projects in single workspace & specify Java Build Path with JRE version you want.
This way, you can run multiple applications having different versions of Java.
I think other java IDEs also have this kind of support.
First of all, I would like to say that I'm not a programmer and I am not experienced in the field. I was trying to set up a Minecraft server in the Google Compute Engine and I set it up successfuly. However, when I tried to switch it to a different version I could not open it because the server was running java 11. I removed it and tried a bunch of things to install Java 8 but I couldn't do it. Is there a way that i can reliably use to install java 8 to my server?
As you just pointed out, Debian 10's default and only officially supported java runtime is openjdk-11-jre.
Oracle provides their guide to download java on their website (https://java.com/en/download/help/linux_x64_install.html#download), which you can download, extract, and run.
I also found a nvidia-openjdk-8-jre package in the non-free repository of debian buster / bullseye. It exists for compatibility reasons and it's not recommendeded, but it might work.
I'm looking for any kind of API or method of finding what the newest version of Windows is for a specified version. Is there any method to get this information?
As far as I know there is not a dedicated API supplying latest builds per Windows versions. There are several resources on the web supplying this information, you could compile these into a data set and create an API for your own use.
For example: https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
I have searched the forum for my question but have not found the precise info i need..
I have two web start applications that uses 2 different versions of java.. How is it possible for these to work on the same computer one app using version 1.6.0_30 and the other 1.8.
Inside the .jnlp file you will find attribute spec. Value assigned to it inform what Java Web Start is required to use the application.
Java is backword compatible so having only version 8 you will be able to run something dedicated to version 6.
Java allows to have multiple versions on single machine and also mange them.
I've implented a simple webapp that transforms XML based on an XSTL stylesheet. It works fine on all the Windows servers I've deployed it on (to Tomcat), but on all Linux systems, I get a compile error on the XSLT.
As best I can tell, it's because Java 1.6 isn't using the same processor behind javax.xml.transform. On the one Linux system, it's org.apache.xalan.xslt, version 2.4.
What I can't figure out is how to generically figure out what any given system is using behind javax.xml.transform.
Or, if anyone has any hints on what else I might do to figure out the problem, that'd be good, too.
Since jdk1.4 Java itself comes along with XML API implementation. Which would be used unless you specifically endorse and instruct jvm to use "Xalan" or any other XML API implementation.
My guess is that in your linux system you r jdk installation is either having Xalan and xml-api jars in the jre/lib/endorsed folder or when you start your server you given the vm argument -Djava.endorsed.dirs... to the path where Xalan jar exists. Or in your web application you flipped the order of class loading to look at local classes first and Xalan is in your web application class path.
You can override the XML implementation given by default by jre using one of the approaches and it seems most likely one of them is true for your linux environment.