I have JDK 1.8 installed in my Linux server.
I want to deploy my Spring boot application that runs on JDK 11 to Linux server.
I cannot upgrade JDK version of my Linux server since there are other application running on the same Linux server and i don't want to disturb them.
For this reason i have Zipped JDK 11, copied it to Linux Server in a folder specific to my application(same place where my spring boot application jar resides) and un-zipped it.
I tried to start my application with the following command but it still runs JDK 1.8 by default and throws exception
java -cp test-api-0.0.1-SNAPSHOT.jar com.test.api.TestAPIApplication
How can i modify the above Linux command to make my application run on JDK 11
I cannot modify java path since it will affect other applications on same Linux server.
Sorry, but you can't:
You can't tweak the Java version via the -cp option.
You can't run a Java version that is not installed.
If you want to run a SpringBoot application that has dependencies on Java 11 (or later) features or APIs, then you must install Java 11 (or later).
The Java 11 libraries are compiled with to Java 11 classfile format. A Java 8 JVM won't understand them. Furthermore, the libraries (most likely) depend on native code methods (and other things) that are only available in a Java 11 (or later) java executable. This means that your idea of not installing Java 11 is technically infeasible.
But what you can do is install Java 11 alongside Java 8 on your server, and then select the version of Java you use either by using an absolute pathname for the java command or setting the PATH environment variable appropriately.
(On a typical Linux system, the package names for Java 8 and Java 11 are different. So there should be no difficulty installing either versions, or having both versions installed at the same time. Likewise, the Oracle Java installers install into different Java versions into different directories.)
(Likewise, environment variable settings are NOT shared in Linux. So you can set them differently for different applications. If you make the PATH or JAVA_HOME or whatever changes in the appropriate places, your new Java 11 application won't interfere with existing Java 8 apps. It is just "basic shell stuff".)
Related
It looks like Oracle removed Java Web Start from Java 8 for Solaris. javaws isn't available anymore in Java 8u51.
From the compatibility guide:
The 64-bit binaries do not contain deployment tools such as Java Web
Start and Java Plug-in, therefore desktop integration is no longer
required.
What do they mean with "required"? It's not possible anymore. It's not possible to launch a Web Start application on Solaris with Java 8.
Does anyone know an alternate way (standard, no 3rd party stuff) to start a Web Start application on Solaris with Java 8?
The "required" means that, as the build for the java 8 for solaris is only available in 64bit version; therefore, the Java Plug-in and Java Web Start is no longer required to be installed as those two things are not available for 64-bit version of Solaris (you can check the link here https://www.java.com/en/download/help/webstart_64bits.xml).
I'm afraid I cannot found any way to run Java Web Start in "standard" way on Java 8. The easiest workaround for this is, of course, to install the older version of 32-bit java such as version 7.
I built my NetBeans web project with Java 1.5 successfully, however; my linux server supports / uses Java 1.4 and Java 1.5 (as well as JBoss 4.0.2).
When I check the version of my project ( java -version ) it says that the current version is Java 1.4.2. However, I don't want to change the "JAVA_HOME" setting on the server because other projects need to use this version.
I want my project to use Java 1.5 from the server...
An idea as to how I should go about doing this? Is there a configuration that I can change?
I have this error:
java.lang.UnsoupportedClassVersionError: bad Version in .class file
You need Java 1.5 version installed in your Linux server.
Next, run the following set of commands in your terminal/command prompt:
JAVA_HOME="{fix-me}"
export JAVA_HOME
export PATH = $JAVA_HOME/bin:$PATH
In the place holder {fix-me} specify the path of Java 5 that is installed in the Linux machine.
This would only temporarily set the Java version to 5 until the terminal/command prompt session is alive. So you need not worry about disturbing other projects.
I have a bunch of webstart applications, which are programmed and tested under Java 1.6.0_11. For being sure that these applications run as intended, I start them using the javaws.exe of an installed JRE with version 1.6.0_11. This version is only used for starting these applications. The "standard" Java used on my System is always the newest version, in order to get all security updates (etc.).
With version 1.7.0_25 I am not able to call the javaws.exe from my 1.6.0_11 installation anymore. My applications simply do not start. It seems that the 1.7.0_25 webstart does not allow run applications which require an older version. So my problem is: How can I start my applications with the 1.6.0_11 java webstart?
My approach was to build a launcher application, which checks the required java version and calls the appropiate webstart via Runtime.exec(). But can I be sure that the called javaws.exe does not use any variables or resources of the installed 1.7.0_25 JRE? It is crucial to me to guarantee the flawless execution of these applications.
I have a Java desktop application for Mac, and we are porting Java along with the application. The issue, is that the Java we are using is strictly Java6 and not Java7 (Because Java7 does not have -d32 mode).
So I downloaded Java6 jdk from the apple developer site and have bundled it in the package. And it all works well. But when I try running on other Mac's, then it throws the following error:
/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin
$ ./java -version
dyld: Library not loaded: #rpath/libjli.jnilib
Referenced from: /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/./java
Reason: image not found
Trace/BPT trap: 5
As per this, it tries searching for the respective directory at /Library/Java/JavaVirtualMachines/ and not in the folder I ported along. How can I solve this issue?
How should I port Java6 along with the application.
Secondly, the Java6 I have used is jdk as I could not find the Jre of Java6. It will be appreciated if someone can provide or share Jre6.
Does Apple licensing even allow their JRE to be redistributed with a third-party app?
I think you are making things harder than they need to be. If a user does not have Java 6 installed (possible in OS X 10.7 and 10.8), the Mac OS will automatically prompt the user to download and install it the first time a Java application tries to run. It will then automatically continue launching your app once it's installed.
Just make sure you are bundling your app appropriately for Java 6 (e.g., using the old Mac Jar Bundler app or manually creating an equivalent Info.plist) and not Java 7 (e.g., using the new Oracle appbundler.jar).
What exactly is the purpose of JDK - running java programs or developing?
There seems to be too many packages that include java and jdk/sdk in their title. Which one should I install if I want to develop Java applications?
Who uses JAVA_HOME and what should I set it to be?
JDK is development environment. JVM is runtime environment.
You should download java installer from oracle web site or install it from repositiry manager
JAVA_HOME system variable usually is required for enterprice java software (application servers, DBs, development tools and so on). You should set JAVA_HOME variable to root directory of JDK or JVM(setting it to JDK always works, but maybe some software will run as expected with JAVA_HOME pointing to JRE). If you set JAVA_HOME right then $JAVA_HOME/bin/java -version command should pring version of java.
JRE means Java Runtime Environment. Most Java Software only needs a JRE to run.
JDK means Java Development Kit. A JDK allways includes a JRE. If you develop you most certainly allways use the JDK, since it contains source and docs of java's own Classes.
Also there is software (usually software for development) that uses tools of the JDK to run, e.g. this software needs the JDK as runtime environment (for example: ant).
JVM means Java Virtual Machine and is the program that runs your java program no matter if in JRE or JDK.
JAVA_HOME is the path to the JDK
JRE_HOME is the path to the JRE
JDK - Java Development Kit (in contrast to JRE - Java Runtime Environment).
If you don't know which version of Java you need, just get the latest (currently Java Platform (JDK) 7u5). Unless you already have a development tool, you might want the Netbeans bundle instead.
JAVA_HOME is used by some software that depends on Java - ant, which is a build tool, is one that comes to mind. It should be set to the directory which contains the bin directory, which in turn contains the java executables.