All Projects → michaelklishin → Jdk_switcher

michaelklishin / Jdk_switcher

A yet another Ubuntu/Debian-specific tool that makes switching between multiple JDK versions a one liner

Programming Languages

java
68154 projects - #9 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to Jdk switcher

Linux face unlock
A face authentication system for Ubuntu that works while logging in and running "sudo" commands with a friendly CLI to operate it.
Stars: ✭ 55 (-20.29%)
Mutual labels:  ubuntu, debian
Hardware
The devices I have, what runs on them, their configurations, issues, solutions, and associated projects
Stars: ✭ 67 (-2.9%)
Mutual labels:  ubuntu, debian
Fileshare
Debian/Ubuntu applet for screenshots and images sharing using popular online services
Stars: ✭ 35 (-49.28%)
Mutual labels:  ubuntu, debian
Server Manager
This repository holds the IntISP Interface. It can be rebuilt to interface with any other hosting panel.
Stars: ✭ 31 (-55.07%)
Mutual labels:  ubuntu, debian
Debootstick
Generate a bootable live image from any Debian/Ubuntu filesystem tree.
Stars: ✭ 48 (-30.43%)
Mutual labels:  ubuntu, debian
Debbuild
Build deb packages from rpm specifications
Stars: ✭ 32 (-53.62%)
Mutual labels:  ubuntu, debian
Adoptopenjdk Deb Installer
Creates Ubuntu/Debian installer packages for AdoptOpenJDK builds using their API
Stars: ✭ 39 (-43.48%)
Mutual labels:  ubuntu, debian
Ansible Role Docker
Ansible Role - Docker
Stars: ✭ 845 (+1124.64%)
Mutual labels:  ubuntu, debian
Ansible Wordpress
Ansible role to set up (multiple) wordpress installations in Debian-like systems (using wp-cli)
Stars: ✭ 58 (-15.94%)
Mutual labels:  ubuntu, debian
Rtinst
seedbox installation script for Ubuntu and Debian systems
Stars: ✭ 1,029 (+1391.3%)
Mutual labels:  ubuntu, debian
Spotify Linux Installer
Install latest Spotify on Linux
Stars: ✭ 28 (-59.42%)
Mutual labels:  ubuntu, debian
Certbot Install
Install the latest Certbot in a breeze. Great for Ubuntu Focal 20.04, and other Linux/Mac.
Stars: ✭ 50 (-27.54%)
Mutual labels:  ubuntu, debian
Ansible Keepalived
Ansible role to set up keepalived in Debian-like systems
Stars: ✭ 21 (-69.57%)
Mutual labels:  ubuntu, debian
Ansible Supervisor
Ansible role to set up (the latest or a specific version of) supervisor in Debian-like systems
Stars: ✭ 32 (-53.62%)
Mutual labels:  ubuntu, debian
Ufw Docker
To fix the Docker and UFW security flaw without disabling iptables
Stars: ✭ 878 (+1172.46%)
Mutual labels:  ubuntu, debian
Hostapd
Script for compiling, patching and packing hostapd from sources
Stars: ✭ 36 (-47.83%)
Mutual labels:  ubuntu, debian
Debian Server
Complete Debian/Ubuntu Web Application Server Installation
Stars: ✭ 22 (-68.12%)
Mutual labels:  ubuntu, debian
Sysadmintools
Acorn's Server, Workstation, & VM Cluster Automation & Documentation
Stars: ✭ 7 (-89.86%)
Mutual labels:  ubuntu, debian
Crouton
Chromium OS Universal Chroot Environment
Stars: ✭ 7,941 (+11408.7%)
Mutual labels:  ubuntu, debian
Ansible Mariadb Galera Cluster
Stars: ✭ 49 (-28.99%)
Mutual labels:  ubuntu, debian

What JDK switcher is

This is a yet another Ubuntu/Debian-specific script that switches between multiple JDK versions (including those that may not have been installed via apt).

It is meant to be used in the travis-ci.org CI environment but may be useful in other environments, too.

Usage

Install one or more JDKs that register themselves with the update-java-alternatives tools by installing a .jinfo file under /usr/lib/jvm.

Then source jdk_switcher.sh in the repository root and use the jdk_switcher function it two arguments, a command and the JDK to use:

. ./jdk_switcher.sh

jdk_switcher home oraclejdk10

jdk_switcher  use openjdk7

jdk_switcher home ibmjdk8

Commands

  • use: switches active JDK (updates PATH alternatives and exports JAVA_HOME)
  • home: prints JAVA_HOME value for the specified JDK. Does not change anything in the environment.

JDK aliases

Supported aliases are:

  • oraclejdk10
  • oraclejdk8
  • oraclejdk7
  • openjdk7
  • openjdk6
  • ibmjdk8

How Does it Work?

The switcher uses update-java-alternatives (see also this intro) under the hood to update /etc/alternatives/* symlinks for java, javac, javap and other JDK tools. As such, the switcher itself primary handles aliasing of JDKs (update-java-alternatives aliases are too hard to remember) and updating JAVA_HOME value.

JAVA_HOME changes is the reason why jdk_switcher is implemented as a function.

Why was this tool necessary?

JAVA_HOME updates is the key reason for it to exist: update-java-alternatives and related Debian tools in general do a great job of managing alternatives but won't touch or even define JAVA_HOME. Even though most JVM ecosystem tools (from Leiningen to Elastic Search, HBase and Cassandra) will try hard to detect JAVA_HOME value but unfortunately, Maven 3 does it in a way that is heavily biased towards OpenJDK 6.

For travis-ci.org to support multiple JDKs for Clojure, Groovy, Java, Scala and JRuby, it is crucially important that all the tools we provision will use the JDK version specified for a build. We cannot let Maven always use OpenJDK 6.

License & Copyright

MIT LICENSE

Copyright (c) 2012-2019 Michael S. Klishin and Travis CI Development Team

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].