syshin
syshin

Reputation: 11

Installing eclipse 2020-03, jdk 1.8, spring3 on macbook m1

I'm relatively new to mac os, java, eclipse,, simply everything, and all the changes that are being made due to the revolutionary apple silicon is driving me crazy.

My co-workers and I are working on a java project based on Eclipse 2020-03, jdk 1.8, spring 3. and I'm having trouble installing the environment on my Macbook M1.

First, I've tried installing the open jdk1.8 and have managed to set the PATH in .zshrc Then I installed Eclipse 2020-03 and opened it using rosetta when it immediately crashed on me. It wouldn't even ask what workspace to open.

So I tried installing the new Eclipse 2022-06 (arm) and set jdk to 1.8. Eclipse worked fine until I tried making a new Spring MVC project when it gave me java.lang.exceptionininitializererror. I've searched for solutions to this error and only found 'upgrade your jdk' suggestions.

I decided to lower Eclipse version to 2021-12 (arm, because its the first arm supported), and install jdk11 + set Path in .zshrc (commented out jdk1.8 path). I still get java.lang.exceptionininitializererror when I try to create new spring legacy project.

tried:

with option 3 above, I could open spring-mvc-project set in a different PC and worked fine. but I still want to have my problem solved.

I've thought over and came up with three ways to get these problems sorted:

  1. Have exactly same Eclipse, jdk, spring version with my co-workers (option 1), try fixing start-eclipse problems. -> slow since im using rosetta but i wont have compatibility problems with my co-workers
  2. use most recent Eclipse, jdk, spring3 -> fast and have less problems but I assume I'll have tons of compatibility problems
  3. use relatively old but apple silicon-supported Eclipse(Option 3), jdk 11 -> fast, have some compatibility problems (if I solve 'java.lang.exceptionininitializererror' problem)

My questions are:

  1. Of the three ways listed above, which would you suggest me try?
  2. How can I solve the problem I face when trying that particular way?

Additionl: I couldn't find any related error on terminal, but I found this on my error log

caption of error

Additions2: I decided to install the relatively new Eclipse(2022-03), using jdk11. so far its working fine, without any compatibility issues

Upvotes: 0

Views: 4460

Answers (2)

Stijn de Witt
Stijn de Witt

Reputation: 42184

Unfortunately, it seems that Eclipse Adoptium / Temurin pointed to by rzwitserloot's answer either never had a JDK8 for MacOS aarch64, or has removed it. They have JDK11 and higher, but that's not what this question is about.

Eventually, I found that Azul offers a version of OpenJDK 8 compiled for MacOS ARM64 (Apple Silicon):

https://www.azul.com/downloads/?version=java-8-lts&os=macos&architecture=arm-64-bit&package=jdk

I have installed it and it seems to work fine.

java -version
openjdk version "1.8.0_345"
OpenJDK Runtime Environment (Zulu 8.64.0.19-CA-macos-aarch64) (build 1.8.0_345-b01)
OpenJDK 64-Bit Server VM (Zulu 8.64.0.19-CA-macos-aarch64) (build 25.345-b01, mixed mode)

Upvotes: 1

rzwitserloot
rzwitserloot

Reputation: 103763

You can get ARM mac versions of all JDKs including JDK8 from Adoptium.

Eclipse is highly backwards compatible. There is no sensible reason to use anything but the most recent stable release.

Eclipse itself runs on a JVM. There is no need for this JVM to be what your project standardized on, because any project in eclipse can be configured to run on whatever JVM you want. Thus, if it sounds like you need a newer JVM version to run eclipse on, just do that. It doesn't matter if your project won't run on that.

More generally getting an ExceptionInInitializerError is a wrapper exception. The real cause is inside it. Inspect the traces somewhat more rigorously; start eclipse from the command line (open a terminal, then run /path/to/Eclipse.app/Contents/MacOS/eclipse - now you can see the terminal output, that might help. "ExceptionInInitializerError" says almost nothing and has a billion causes. You want the exception that caused that, that'll be much more specific. It's somewhat unlikely to be related to running on an M1; very little stuff in the java ecosystem cares one iota about what chips you run it on.

More generally if rosetta is involved you're doing it wrong, there is no need for this. Everything relevant (which is really just the JVM, everything else runs on top of that) is available native.

Upvotes: 0

Related Questions