Linux atom installer on AWS throws java.lang.ArrayIndexOutOfBoundsException

Document created by aarthi_sridhar Employee on Sep 12, 2017
Version 1Show Document
  • View in full screen mode

Steps to install a local atom in linux is here Installing alocal Atom on Linux 
Pre-requisites to install local atom in linux is here Atom installationchecklist (Linux) 

Atom installation in Linux is different from that of a windows system. Assuming that you are trying to install atom in Linux Red hat 7.4 version running on AWS EC2 instance , there would be exception occurred while attempting to run atom installer. Assume it is a 64 bit installer and you are not using Amazon Linux, rather choosing to use Red Hat Linux 7.4 , there could be some jar level changes to be done in Linux java home. 

Environment

  • Operating System: Red Hat Enterprise Linux version 7.4

Exception message:

java.lang.ArrayIndexOutOfBoundsException: 0 at sun.font.CompositeStrike.getStrikeForSlot(CompositeStrike.java:75) at sun.font.CompositeStrike.getFontMetrics(CompositeStrike.java:93) at sun.font.FontDesignMetrics.initMatrixAndMetrics(FontDesignMetrics.java:359) at sun.font.FontDesignMetrics.<init>(FontDesignMetrics.java:350) at sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:302) at sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:1113) at javax.swing.JComponent.getFontMetrics(JComponent.java:1626) at javax.swing.text.WrappedPlainView.updateMetrics(WrappedPlainView.java:318) at javax.swing.text.WrappedPlainView.updateChildren(WrappedPlainView.java:297)

 

Cause

RHEL v7.4 (upgraded from v7.3 or fresh install) comes with package stix-fonts. When this package is installed, the default font changed from Utopia to STIX. For whatever reason, the STIX fonts do not seem to play well with java and cause exceptions.

 

Steps to handle exception: 

The Exception message states that there is sun.font.* jar which is missing its way onto atom installation steps. As AWS provides open jdk and Redhat 7.4 does not support the required font in Open JDK, we need to overwrite the setting by creating local font configuration file.   Open the  fonts.dtd and change the stix font to default font Uthopia.  Or follow the steps below:

  • Create a file name /etc/fonts/local.conf
  • Insert the following configuration into the file in order to force back Utopia as the default font, used by java.

 

<?xml version='1.0'?><!DOCTYPE fontconfig SYSTEM 'fonts.dtd'><fontconfig>  <alias>    <family>serif</family>    <prefer><family>Utopia</family></prefer>  </alias>  <alias>    <family>sans-serif</family>    <prefer><family>Utopia</family></prefer>  </alias>  <alias>    <family>monospace</family>    <prefer><family>Utopia</family></prefer>  </alias>  <alias>    <family>dialog</family>    <prefer><family>Utopia</family></prefer>  </alias>  <alias>    <family>dialoginput</family>    <prefer><family>Utopia</family></prefer>  </alias></fontconfig>

Download the installer and run sh ./atom_install64.sh . The atom will now get installed in linux. If there is any other new exception occurring related to a particular jar in Linux java_home then try to edit the install64.sh in Notepad++ by adding !/bin/sh -x in first line. This will enable installer level debug mode and you will see exceptions.  

 

Reference links: 

java - Upgrade RHEL from 7.3 to 7.4: ArrayIndexOutOfBoundsException in sun.font.CompositeStrike.getStrikeForSlot - Stack… 

https://bugzilla.redhat.com/show_bug.cgi?id=1479563 

 

Attachments

    Outcomes