With SAP TechEd 2022 few days away and surely many of you have registered for virtual workshop session that requires installing Eclipse and ADT beforehand as a prerequisites. This is a breeze when you do it on Windows PC. However, that may not be the case for you if you are on MacOS on any of the current Apple products that comes shipped with Apple Silicon (M1, M2, etc.)
There is already a great
blog post for something similar by
philywu . If that worked for you, then this blog is not for you. This is for someone who come across some issues even after that (as evident from comments section of above mentioned blog). Being one of those user for whom the installation was not as smooth, I initially thought of adding it as a comment for anyone going through the same. However after some evaluation, blog post seemed like a better option.
Let me discuss the two problems that I faced and later on, I will list out the installation steps.
Problem 1: JCo initialisation failed
After installation of ADT, Restart of Eclipse. A popup comes up stating JCo initialisation has failed as shown below in the screenshot
This occurs because currently SAP doesn't support SAP Java Connector (JCo) for ARM based architecture as evident from download section of
product page . This may change in future as SAP starts rolling out support for ARM (evident from release of SAP GUI for Java 7.80 with ARM support)
Also one of the point to note from the error popup is, it tries to find
sapjco3 in Java Path. So the installed JDK may be the cause for this issue. I will install the JDK x86_64 in later section to remediate this.
NOTE: SAP clearly states in Installation Guide [Page 17, Section 3.3 ADT Support PAM] following:
"Architecture AArch64 (Apple silicon) is also supported, but you must use the x86_64 version of Eclipse."
Problem 2: After successful installation of Eclipse (x86_64) & SapMachineJDK (x86_64), Eclipse won't open on system restart.
So, let's say you have installed x86_64 version of Eclipse & SapMachineJDK and it works just fine. But you restart your MacOS and Eclipse stops working, Your Mac says "Code signature Invalid" as shown in image below.
MacOS Code Signature Invalid report dialog
This is very interesting issue and gave me an opportunity to understand a bit about gatekeeper component of MacOS. Let's understand the steps to reproduce the issue.
It seems changing
Info.plist or
eclipse.ini changes the package and MacOS considers it a threat and blocks the application which is good thing in itself. However, not applicable for this case since we know we have to make changes in either of this file to use custom JDK. To avoid this, we will perform a code sign of the Eclipse package as demonstrated in next section.
Installation Steps
I know this has been a long read on the problem itself. Now let's jump right into the action.
Following config & tools are used in this guide:
Eclipse: 4.5, 2022-09 (x86_64)
SapMachineJDK: 17.0.5 (x86_64)
OS: macOS Monterey (12.6)
Chip: Apple M1
Before we start, quick disclaimer: I will be working on a custom directory instead of changing anything in standard configuration e.g. JAVA_HOME variable, PATH variable to avoid any effect on other applications (non-SAP) which works with ARM based JDK.
Step 1: Prepare Custom directory
We will be using this directory to store our JDK & Eclipse executable. Open a terminal window, Create a directory anywhere that you wish to, I prefer one within the user directory.
$ cd ~
$ mkdir DEV_TOOLS
Step 2: Download & Install JDK
You can either directly use command line tool like cURL to download the file on to the path or download via. web browser on
https://sap.github.io/SapMachine/
Option 1: Download via. cURL
$ cd ~/DEV_TOOLS
$ curl -L https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.5/sapmachine-jdk-17.0.5_macos-x6... -o sapmachinejdk17.tar.gz
Option 2: Download with Web Browser
Visit website https://sap.github.io/SapMachine/ and download as shown in following screenshot:
Download Options for SapMachineJDK
Once you have downloaded & moved the
tar.gz file to directory we create in step 1. We will unpack the archive. Time to jump back to terminal.
$ tar -xvzf sapmachinejdk17.tar.gz
NOTE: Replace "sapmachinejdk17.tar.gz" with the filename you have downloaded
After unpack, a new directory
sapmachine-jdk-17.0.5.jdk created.
$ cd ~/DEV_TOOLS/sapmachine-jdk-17.0.5.jdk/Contents/Home/bin
$ echo $PWD"/java"
Copy the output of second command and keep a note of it. We will be needing the same while configuring Eclipse to use the JDK we downloaded in this step.
Step 3: Install Eclipse & Configure JRE
Step 3.1: Download & Install Eclipse
Download the Eclipse IDE for Java Developers package from https://www.eclipse.org/downloads/packages/ . Make sure, you download macOS x86_64 package as shown in the image below.
Eclipse Package for MacOS x86_64
Now you can double click on the
.dmg file you just downloaded and Copy the
Eclipse.app to ~/DEV_TOOLS via. MacOS Finder.
Double click on the Eclipse.app, so that application can start.
This is important because changing eclipse.ini without this would result in package being corrupt in some cases.
Step 3.2: Configuring Eclipse to use custom JDK instead of built-in or default system one
Now right click on
Eclipse.app and select "Show Package Contents" in MacOS Finder window. It should open a
Contents. Right click on the
eclipse.ini file and open with any text editor of your choice.
Replace the
-vm argument in the file to include the path we copied at the end of step 2. It should look something similar
Close the editor. We are set with Eclipse & JDK. Now let's shift gears to get actual ADT plugin. Finally!
Step 4: Install ADT
No rocket science here. Follow the steps mentioned in
https://tools.hana.ondemand.com/#abap
This is it! You can now restart your Eclipse and do your awesome ABAP thing.
Now before you close the tab. Try restarting your MacOS and see if you are able to start
Eclipse.app again. If not, you are facing what we discussed in
Problem 2. Try the next step and hopefully that resolves your issue as well.
Step 5: Code sign after Restart
Since we change
eclipse.ini file in Step 3.2, MacOS as part of it's security assumes that package has been tampered with and shouldn't be allowed to run, which is what we would want normally. However, for this case we need to use the changed package consciously. We will be signing the code again.
Now let's fire up the terminal again and run following commands:
$ cd ~/DEV_TOOLS/
$ codesign --force --deep --sign - Eclipse.app
Try running the Eclipse.app file and it should be running. Even after MacOS restart.
Bonus Tip:
If you feel the Eclipse font is very small and would appreciate a bigger fonts on Eclipse UI. Remove following lines from
eclipse.ini file.
-Dorg.eclipse.swt.internal.carbon.smallFonts
That is all! You should have your Mac system ready with Eclipse and ADT.
Please feel free to add your suggestions and questions in the comment section.
Follow
ABAP topic page for more such awesome content.
P.S. If Step 5 doesn't resolve the issue for you. Try reading through the bug ticket 573309 in Eclipse Bugzilla that may direct you to some workaround.