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

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:
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
use most recent Eclipse, jdk, spring3
-> fast and have less problems but I assume I'll have tons of compatibility problems
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:
Of the three ways listed above, which would you suggest me try?
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
Additions2:
I decided to install the relatively new Eclipse(2022-03), using jdk11. so far its working fine, without any compatibility issues

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)

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.

Related

JDK and JRE version confusion

I've been working with Java for a bit now and the JDK/JRE version has given me quite a bit of trouble lately. I am developing using the Intellij IDEA IDE and it of course uses the latest version of the JDK, 14. However when I attempt to execute software compiled with JDK 14 outside the IDE, I get an error that the JRE isn't new enough to run this software. So I updated Java on my computer and another machine and attempt to run again without any success. After some digging, I tweaked my machine to use the JRE included in the JDK 14 which is compatible.
However it is kind of odd that I had to do that, one would think that the latest version of java should of been enough to run applications made with the latest version of the JDK (14). Right now Java is version 8 build 251 and says there is no newer update available. If JDK 14 is out for a while now, why would they not update the version of Java they ship?
The problem is partially solved, as only the machine I am using for development is capable of executing the created applications. Other people I've sent them to have been unable to run them, despite having the latest version of java. Also it is a pain to get the latest JDK, especially when having limited experience on how to get rid of old versions, change path point to the latest version, get the right package (open/oracle JDK) and do that for windows and several distrubutions of linux. What is going on? Did I get Java from the wrong place and everyone else as well? Why are oracle doing this and why are there no java updates since clearly there exists a newer version?
Starting with Java-11, separate JRE does not exist anymore. In other words, if you are using Java-11 or above, you should care about JDK only.
You should uninstall JRE-8 from your machine and make sure your JDK-14 bin folder in the PATH variable. Some application even requires JAVA_HOME to work and therefore you should make sure that your system has an environment variable called JAVA_HOME and its value set to the root folder of JDK-14 (i.e. one level above your JDK bin).
Q: What should my clients do to run my application compiled on JDK-14?
Ans: Your clients must install JDK-14. Also, check this thread for some alternatives.
You're confusing how IntelliJ or JDK are used on the OS. IntelliJ, now, often comes with its JDK binaries (but even this can be configured, IntelliJ can be configured to use any JDK/JRE build you'll provide to it); however, if you run your Java application out of IntelliJ, most likely you're using Java installed locally on your OS, which might be referenced via your JAVA_HOME environment variable.
I'd suggest to:
Check java -version in your shell (and hence you'll see what JVM instance your OS spins up when you run a Java application);
Check where java (on Windows, or which - on Linux) in your shell, to see all the Java binaries available on your OS.
Try to uninstall Java SE Development Kit and Java JRE(if you have both in your machine) and reinstall both again, JDK and JRE both, I am sharing my google drive link where you can find the latest version of both JDK and JRE and when you are done installing, add there bin folder path in the Environment Variables of your machine.

How to fix error while installing NetBeans?

I have installed Java and am trying to install NetBeans 11.3 on my Windows 10 but after I ran the exe. installer, an error message popped up:
An unexpected exception happened in thread main
java.lang.NoClassDefFoundError java/util/jar/Pack200
NetBeans have problems with the jdk-14, because I suppose that you have install the jdk-14 so uninstall it and try it with the jdk-13.0.2.
Sorry, but in my opinion is to install an old version from Java no solution, just because it works. When someone has problems with his Firewall, simply disable the Firewall would also be no solution.
https://www.java.com/en/download/faq/other_jreversions.xml
We highly recommend users remove all older versions of Java from your
system. Keeping old and unsupported versions of Java on your system
presents a serious security risk. Removing older versions of Java from
your system ensures that Java applications will run with the most
up-to-date security and performance improvements on your system.
The "real" solution would be a reprogramming of the NetBeans installer.
This used function was suggested for deprecated on 2018-04-04, which was done on 2018-08-23.
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8200752
The removal was suggested on 2019-10-08, which was done on 2019-12-18.
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8232022
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8232022
We assume that developers who rely on Pack200 have had enough notice about its proposed removal to make alternative arrangements. … We assume that developers who use pack200 to shrink application JARs can switch to either the jlink tool or the jpackage tool to create application-specific runtimes with an optimized form factor.
edit: I solved it this way.
uninstalled JDK 14
installed JDK 13.0.2
installed Apache NetBeans
installed JDK 14
open C:\Program Files\NetBeans\netbeans\etc\netbeans.conf and changed path to JDK
uninstalled JDK 13.0.2
Now NetBeans runs with the JDK 14.
Yes, I got it working as follows from cmd, when referring to older version:
Apache-NetBeans-11.3-bin-windows-x64.exe --javahome "C:\Program Files\Java\jdk-12.0.2"
The https://netbeans.apache.org/download/nb113/nb113.html site now has this
memo:
The installers will not run under JDK 14 because usage is made of the Pack200 Tools and API, for packing and unpacking, which is removed in JDK 14, see JEP 367.
If several JDK versions are installed, then you need to define the environment variable "JAVA_HOME" where to set the path to JDK-12.
Details are described here. (Only in Russian)
An alternate way to Andy's.
(Windows)
1) Right click on "Apache-NetBeans-11.3-bin-windows-x64" installer and select "Create shortcut".
2) Right click on the created shortcut and select "Properties".
3) In the "target" textbox, add your under 14 JDK version path at the end, here is how mine looks like:
C:\Users\userfoldername\Desktop\Apache-NetBeans-11.3-bin-windows-x64.exe --javahome "C:\Program Files\Java\jdk-13"
4) Press Ok when done, double-click on the shortcut and it should install fine now.
Switching to openJDK 12 worked for me too. But instead of uninstalling JDKs or manually changing the env, I use Sdkman.io which works like Node version manager if you have used that. It manages your JDKS for you and offers downloads of different versions (Open, Zulu, Graals) and will switch between them with with just a quick command.
I found a nice solution in 3 steps:
check all versions of the JDK path in Environment variables, if there is an outdated path please remove it and keep the latest version of the Java JDK bin path.
after the second step, please uninstall the Netbeans and re-install the latest version.
Netbeans will found the latest JDK path in case it was jdk14 and choose JDK latest version path for NetBeans.
solved
Just install JRE from oracle. Everthing will run fine. I have the same issue

Codename one missing from NetBeans plugins on Ubuntu

I am on Ubuntu 16.04 with NetBeans 8.1 - fresh install provided by Ubuntu SW center + OpenJDK - default with Ubuntu.
When I follow the video manual on codename one web site: https://www.codenameone.com/download.html
I do not get option to install codename one plugin.
To be precise, there is not a single available plugin listed.
In Windows 7 this works fine however.
I don't even know, who should I attribute this problem to:
Ubuntu 16.04 ? - which sucks and behaves weird compared to earlier Ubuntu versions (now for instance does not close the open and frozen NetBeans - had to kill -9 it)
Net Beans 8.1 ? which runs just fine with Win7
codename one ? Which I rather doubt :)
or even me ? :)
Please give me any hints, if anyone ran into similar troubles, how do I fix it ?
We need to the official Java 8 JDK for install since we need access to Java FX for things such as web browser/media support. If OpenJDK will ever work with Java FX properly then it should work fine with Codename One.
Here is the solution:
Part of the story is, that you should use original JDK from Oracle, not the pre-installed OpenJDK. Similarly, Android Studio will complain about incompatible JDK.
But secondly ! Using the NetBeans installation provided by Ubuntu SW center results in incomplete, or not updatable version. Simply you get no available plugins listed. Only those pre-installed. Moreover, this IDE freezes much too often. What the heck !?
Instead download and install NetBeans from their site:
I went for the full version.
For this and many other reasons I think I am done with Ubuntu 16.04
Every day it convinces me it does not YET deserve to occupy my disk space. I will probably step back to 14.04 LTS, until 16.04 LTS it reaches some mature state.

Unable to install Java on Windows 10 (1603 Error)

I tried to download Java on my laptop (which has windows 10) but i keep getting a 1603 error. My computer used to have windows 8.1 and it did not work back then either
I appreciate any advice to solve or work around this problem
I have had this problem. I was able to fix it thanks to a co-worker. The problem started happening after I installed HP Unified Functional Testing (UFT, aka QTP). Installing this product changes the Windows environment variables used by Java. He told me the following: "So change the names of JAVA_OPTIONS, IBM_JAVA_OPTIONS, JAVA_TOOL_OPTIONS to something else (both in system and user variables) and delete any Java folder(in Program Files (x86) or Program Files) which gets installed despite the error. Restart the system and then try installing Java."
Actually, all I did was rename the environment variables and run the installer. This worked.
My answer is not related to win 10, but might help someone who is having similar problem in windows 7 machine and not able to install jre 32 bit version.
the work around to this is once you downloaded the jre, copy the path "C:\Program Files (x86)\Java\jre1.8.0_121\bin\javaw.exe" and paste it under java runtime environment settings which is found -Java Control panel>java>view
I think you downloaded the wrong version. If your laptop support x64 bit software you should download Java 1.8 x64 version.
Here is the link.
https://www.java.com/en/download/manual.jsp
I had this problem for a month now. I tried everything on my windows 8, but I couldn't get the latest java on it. When I tried to install java on an empty computer, the 64 bit version did not go through (error 1603) and I realized the problem didn't come from an old java install and I install 32 bit. it worked on the new computer with windows 7 and on my computer running 8.1.
note: I had deleted all the java versions before going through with it.
To fix java 1603 error you have to follow few simple steps.
First of all remove all old java version.
Then remove some windows update file which might be reason of this
error. Like KB2918614 update.
After that download and Install latest version of java and activate
java in browser. Now everything will be fine you can test the java
version on java website...
For explained and easy solution to java 1603 error follow this link: http://protechguides.com/java-error-code-1603-solved/
I encountered this error on Windows 8.1 and when I checked with Oracle web site, they said that is is not yet resolved, and under investigation. They also showed a link for off-line installation as an alternative arrangement. However, upon investigation of my system, i found out that the available space in C drive was only about 20 MB or so. I cleared my system and provided enough space. When I tried with the extra space, I didn't encounter any error. May be, you could try with a better free space...
First you should close the browser because if any webpage will use Java, it will cause conflict. Then do custom installation, i.e. install in some other folder other than default folder and point environment variable to newly installed Java location. It will resolve your issue.

Eclipse on win64

Is anyone successfully using the latest 64-bit Ganymede release of Eclipse on Windows XP or Vista 64-bit?
Currently I run the normal Eclipse 3.4 distribution on a 32bit JDK and launch & compile my apps with a 64bit JDK. Our previous experience has been that the 64bit Eclipse distro is unstable for us, so I'm curious if anyone is using it successfully.
We are using JDK 1.6.0_05.
I'm using Eclipse with a 64bit VM. However I have to use Java 1.5, because with Java 1.6, even 1.6.0_10ea, Eclipse crashed when changing the .classpath-file. On Linux I had the same problems and could only get the 64bit Eclipse to work with 64bit Java 1.5.
The problem seems to be with the just in time compilation, since with vmparam -Xint eclipse works -- but this is not a sollution, because it's slow then.
Edit:
With 1.6.0_11 it seems to work.
1.6_10 final might work as well as mentioned in the comment, but I've not tested that.
I've been successfully using it on Vista x64 for some light Java work. Nothing too involved and no extra plugins, but basic Java coding has been working without any issues. I'm using the 3.4M7 build but it looks like the 3.4 stable build supports Vista x64 now.

Categories

Resources