Last active
September 30, 2021 03:40
-
-
Save jynik/082d540a2d0aa5628cbeff8dfe2aba96 to your computer and use it in GitHub Desktop.
Workaround for MATLAB R2017a Installer TLS Connection Failure Issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Attempt to run MATLAB installer using system Java installation, rather than | |
# that bundled inside the installer, in an attempt to work around the | |
# activation/download connection error: | |
# | |
# https://www.mathworks.com/matlabcentral/answers/92634-why-do-i-get-a-connection-error-when-installing-or-activating-matlab-or-another-mathworks-product#answer_797409 | |
# | |
# Tested on Ubuntu 20.04.2 LTS with openjdk-8-jre: | |
# openjdk version "1.8.0_292" | |
# OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~20.04-b10) | |
# OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode) | |
# | |
# Note: OpenJDK >= 11 will not work due to java.xml.bind deprecation. | |
# See: https://stackoverflow.com/a/43574427 | |
# | |
# | |
# Permission to use, copy, modify, and/or distribute this software for any | |
# purpose with or without fee is hereby granted. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | |
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | |
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | |
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | |
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | |
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | |
# PERFORMANCE OF THIS SOFTWARE. | |
# | |
# CHANGE ME - Remove these two lines | |
echo "Please review this script and update items as needed." | |
exit 1 | |
# CHANGE ME | |
# Directory containing install script and other installer files | |
INSTALLER_DIR="${HOME}/path_to/matlab" | |
# CHANGE ME | |
# The NNNN value in shown in the mathworks_NNNN portion of JRE_LOC | |
# when you run `install -v` | |
PID="6124" | |
# CHANGE ME | |
SYSTEM_JAVA="/usr/lib/jvm/java-8-openjdk-amd64/bin/java" | |
#-------------- The remainder should, in theory, work as-is. --------------- | |
# Location that MATLAB installer unpacks to. | |
TMP_DIR="/tmp/mathworks_${PID}" | |
if [ ! -d "${TMP_DIR}" ]; then | |
echo "Error: Directory does not exist. Check the path from 'install -v'" >&2 | |
echo " ${TMP_DIR}" | |
exit 1 | |
fi | |
echo "Host information:" | |
if [ -f /etc/lsb-release ]; then | |
cat /etc/lsb-release | |
echo "" | |
fi | |
if [ ! -f "${SYSTEM_JAVA}" ]; then | |
echo "Error: Not found: ${SYSTEM_JAVA}" >&2 | |
exit 1 | |
fi | |
# Class path items | |
INSTALLER_CLASSPATH="${TMP_DIR}/java/config/professionalinstaller/pathlist.jar" | |
echo "INSTALLER_DIR: ${INSTALLER_DIR}" | |
echo "TMP_DIR: ${TMP_DIR}" | |
echo "INSTALLER_CLASSPATH:" | |
echo -e " ${INSTALLER_CLASSPATH}\n" | |
echo -e "Launching installer with system's Java installation" | |
echo "" | |
set -x | |
${SYSTEM_JAVA} \ | |
-Xmx512m \ | |
-cp "${INSTALLER_CLASSPATH}" \ | |
-splash:"${INSTALLER_DIR}/java/splash.png" \ | |
com/mathworks/professionalinstaller/Launcher \ | |
-root "${INSTALLER_DIR}" \ | |
-libdir "${TMP_DIR}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment