Jenkins installtion using java 1.6 - java

I am trying to install Jenkins on a Solaris 5.10 machine and the Java version 1.6.0_161. I executed
"java -jar jenkins.war"
to install Jenkins but got the following log.
$ java -jar jenkins.war
Jenkins requires Java8 or later, but you are running 1.6.0_161-b13
from /usr/jdk/instances/jdk1.6.0/jre
java.lang.UnsupportedClassVersionError: 50.0
at Main.main(Main.java:124)
Its an Int server and we cannot upgrade java. Please let me know how to install jenkins in this using java 1.6.0_163

Please let me know how to install jenkins in this using java 1.6.0_163
The error message tells you already Jenkins requires Java8 or later. Why do you believe there would be a way to run in with Java 6?
If it would be enough to install Java for a specific user you could download the JDK/JRE from [1] and follow the installation instruction [2].
[1] http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html
[2] https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html#A1012444

Related

Upgrading Jenkins Java version from 8 to 11

I'd like to upgrade java from 8 to 11 as recommended for Jenkins 2.303.1, I'm reading the guide in https://www.jenkins.io/doc/administration/requirements/upgrade-java-guidelines/, but I don't know what to do in step:
Use a package manager to install the new JVM. Make sure the default
JVM is the newly installed version. If it is not, use the correct java
command in the Jenkins startup scripts (/etc/default/jenkins or
/etc/init.d/jenkins).
does it mean install Java 11 and set java 11 is default one?
Note: since June 2022, you do not have a choice anymore.
JDK 11 will need to be the one running Jenkins.
It does not have to be the "default" on your system. Only the one selected in the command use to run Jenkins.
Jenkins requires Java 11 (Basil Crow)
Beginning with Jenkins 2.357 (released on June 28, 2022) and the forthcoming September LTS release, Jenkins requires Java 11.
Additionally, beginning with Jenkins 2.355 (released on June 14, 2022) and Jenkins 2.346.1 LTS (released on June 22, 2022), Jenkins supports Java 17.
Plugins have already been prepared in JENKINS-68446.
Use the Plugin Manager to upgrade all plugins before and after upgrading to Jenkins 2.357.
Warning regarding JAXB
Prior to Java 11, Java Architecture for XML Binding (JAXB) was part of the Java Platform, and one could use it without adding a third-party dependency.
Beginning with Java 11, JAXB is no longer a part of the Java Platform and requires adding a third-party dependency.
Thanks to work done several years ago by Baptiste Mathus and others, a JAXB Jenkins plugin is available, which provides the JAXB library to Jenkins plugins in the form of a plugin-to-plugin dependency.
The vast majority of plugins have already been prepared to support Java 11 via the JAXB plugin in JENKINS-68446.
Jenkins users need only upgrade plugins to compatible versions as documented in the Released As field in Jira.
It is critical to use the Plugin Manager to upgrade all plugins before and after upgrading to Jenkins 2.357.
Failure to upgrade plugins to compatible versions may result in ClassNotFoundException, NoClassDefFoundError, or other low-level Java errors.
Upgrade
Docker
The official Jenkins Docker images have been based on Java 11 for many months, with Java 8 available as a fallback and Java 17 available in preview mode.
Beginning with Jenkins 2.357, the Java 8 images will be retired and the Java 17 images will transition from preview to general availability (GA). Users of the official Jenkins Docker images need not install or configure Java on their own, as it comes preinstalled in the image.
OS packages
Users of the official Jenkins OS packages for Debian, Red Hat, and SUSE Linux distributions should note that these packages are agnostic to the Java vendor. >
In other words, you must bring your own Java package. One straightforward way to do this is to install Java 11 from your Linux distribution, as described on the package download site
Recommenced Garbage collection options
-XX:+AlwaysPreTouch
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=${PATH}
-XX:+UseG1GC
-XX:+UseStringDeduplication
-XX:+ParallelRefProcEnabled
-XX:+DisableExplicitGC
-XX:+UnlockDiagnosticVMOptions
-XX:+UnlockExperimentalVMOptions
-Xlog:gc*=info,gc+heap=debug,gc+ref*=debug,gc+ergo*=trace,gc+age*=trace:file=${PATH}/gc.log:utctime,pid,level,tags:filecount=2,filesize=100M
-XX:ErrorFile=${PATH}/hs_err_%p.log
-XX:+LogVMOutput
-XX:LogFile=${PATH}/jvm.log
Agents
For best results, it is recommended to run agents with the same version of Java as the version used on the controller.
Use the Versions Node Monitors plugin to verify that agents are running a compatible version of Java.
Running the Jenkins remoting process on an agent with Java 11 or 17 does not imply that you need to run your builds with the same version of Java.
You can continue to use any desired version of Java for individual builds.
I opted to not install Java on the system, and followed the below approach:
Go to Java 11 Downloads (registration on oracle.com required)
Download the latest Java 11 Compressed Archive (zip) file. At the time of writing: jdk-11.0.15_windows-x64_bin.zip
Unzip this on your build server, keep the path where you extracted to for step 5
Backup Jenkins Home, especially your jenkins.xml file (same folder as jenkins.war).
In Jenkins.xml, update Executable to extracted path, e.g. C:\Java\jdk-11.0.11\bin\java.exe
Restart Jenkins Service
However you have (OpenJDK) 11 installed, as long as you have either JAVA_HOME=/path/to/jdk11 and PATH=$JAVA_HOME/bin:$PATH or explicitly run /path/to/jdk11/bin/java -jar jenkins.war or if you type java -version and it returns "11", you are fine.
Note: that is to launch jenkins. You can set the JDK available to your jenkins jobs from within Manage | Global Tools Configurationtion.
2nd Note (updated): the documentation has been updated (2021-09-16) ... The default Docker image jdk as of 2.303.1 is now 11, so you don't need to append ”-jdk11", rather users must append "-jdk8" if users want to stick to 8.
if you have Centos you can do the following(i have done this for Centos7 and Jenkins 2.367)
sudo yum install java-11-openjdk
yum install output
if have issues with repos and you want do this manually
you get the rpm's that you want and then :
first update the dependency .
sudo rpm -Uvh tzdata-java-2020a-1.el7.noarch.rpm
and then
sudo rpm -Uvh java-11-openjdk-headless-11.0.8.10-1.el7.x86_64.rpm
sudo rpm -Uvh java-11-openjdk-11.0.8.10-1.el7.x86_64.rpm
then you can give
sudo update-alternatives --config java
to find the java path of java 11 --> /usr/lib/jvm/java-11-openjdk-11.0.8.10-1.el7.x86_64/bin/java
it should not be the default, if you don't want to ,you can just copy it
and use it to jenkins nodes Java path at configure nodes
jenkins JavaPath
You have two options: You can globally install Java 11 on your system, for example using a package manager like apt. You would then make Java 11 your default Java.
The other option is to manually install Java, for example OpenJDK, and extract it to, for example, /opt/java and adjust the Jenkins startup script to use that specific Java installation.
I just upgraded a Jenkins installed from apt packages (from: http://pkg.jenkins-ci.org/debian/) with the following steps (inspired by: https://www.jenkins.io/doc/book/installing/linux/)
First, install java 11:
sudo apt install openjdk-11-jre
Then check java -version
which may still show openjdk version "1.8.[x]"
If so, do choose a java-11 alternative with:
update-alternatives --config java
Then java -version should show openjdk version "11.0.[x]"
Then you can do:
systemctl restart jenkins
docker exec -it <container_id> /bin/bash
If permission denied error, then,
docker exec -u 0 -it <container_id> /bin/bash
sudo apt-get update
sudo apt-get install openjdk-11-jdk
export PATH=$JAVA_HOME/bin:$PATH
java -version

Could not create the Java Virtual Machine Error

I'm trying to run this command on my linux machine:
java -noverify -Xbootclasspath/p:burp-loader-keygen-2020_2.jar -jar burpsuite_pro_v2020.2.jar
and i keep getting these errors:
-Xbootclasspath/p is no longer a supported option.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I tried to install again these versions:
sudo apt update
sudo apt install default-jdk -y
sudo apt install default-jre -y
But i kept getting the same error over and over, any solution or help or suggestion?
You are running the Burp Suite JAR file the wrong way.
If this is an older version of Burp Suite, you must use Java 8 which still supports the -Xbootclasspath option. Note it is not sufficient to simply install Java 8. You need to make sure that java -version says it is Java 8, or use the full path to the Java 8 version of the java
command.
This won't work with Burp Suite 2020.4 or later.
Conversely, if you are using Burp Suite 2020.4 or later, then you need to use Java 9 or later, and you need to run like this:
java -jar -Xmx4g /path/to/burp.jar
Source:
Burp Suite Releases: Professional / Community 2020.4
Launching Burp Suite from the command line (as of the time of writing this answer).

Not able to run JMeter 5.0 through java exec command in console mode

I am not able to run JMeter through Java exec command in console mode whereas it is working fine on Version 3.1.
Refer below command i am using.
Process pro = null;  
pro = Runtime.getRuntime().exec("jmeter.bat -n -t test.jmx");
Your question doesn't have enough information therefore we will not be able to answer.
Blind shot: your Java Runtime version is too low to run JMeter 5.0. Starting from JMeter 3.2 it is required to have Java 8 or higher in order to be able to run JMeter so if you're sitting on previous Java version - you will have to upgrade your Java installation.
You can check your current Java version by running java -version command in terminal

java returns VM error after upgrade in centos 6.5

I want to upgrade my jdk on a centos server, after some simple searches i found some solutions.
from this link you can see that the instructions are simple:
jdk 7 installation guide for centos
-install your jdk from rpm package or from source
-do some alternatives
-check the practical version (java -version)
and i go easy with the first two steps but in check version step i get this error:
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
i have also checked alternatives --config java and simbolic links.
i have also tried which command to find out what java is actually running and this was the link directoins.
/usr/bin/java -> /etc/alternatives/java -> /usr/java/jdk-1.8.0_40/bin/java
the weird point is when i run /usr/bin/java -version it is OK and it returns the version but when i run java without any prefix i got that error.
so what is the problem?
you may need to setup CLASSPATH variable so that jvm could load needed libraries.
see this post https://docs.oracle.com/javase/tutorial/essential/environment/paths.html

jenkins install fail in suse,java>=1.6 is needed

the environment is:
suse linux enterprise server 11 x86_64
jenkins-1.563-1.2.noarch
I have manually download and installed jdk 1.6.0_45 64bit,command "java -version" succeed show the jdk version.
but when i try to install jenkins,it shows:
error failed dependencies:
java >=1.6 is needed by jenkins-1.563-1.2.noarch
anyone can help to resolve it?
You either have to install the java package which comes with Suse, or (if that's not available) install Jenkins manually.

Categories

Resources