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

Time:04-20

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:

  • Option 1. Eclipse 2020-03 (macOS x86_64) jdk1.8 -> eclipse wont open

  • Option 2. Eclipse 2022-06 (AArch64) jdk1.8 -> java.lang.exceptionininitializererror when creating spring project

  • Option 3. Eclipse 2021-12 (AArch64) jdk11 -> java.lang.exceptionininitializererror when creating spring project

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?

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

caption of error

CodePudding user response:

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.

CodePudding user response:

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

  • Related