Happy Coding

Hello World Java/Eclipse Tutorial: Error on running

Hi happy coders,

I’m just getting started and trying to follow the Hello World tutorial on using Java in Eclipse. Unfortunately on clicking the Run button I am getting this error.

Error occurred during initialization of boot layer
java.lang.LayerInstantiationException: Package jdk.internal.jimage in both module jrt.fs and module java.base

As an Eclipse noob, I have no clue what is wrong or how to fix it so would appreciate any help you experts could offer :grinning:

Phil.

What code are you trying to run?

I’ve never seen this error before, but a quick google of the error message suggests is might be related to installing OpenJFX?

Maybe try updating your Java to the latest version and trying again?

Hi Kevin,

It is just the most basic hello world code!

public class HelloWorld {
public static void main(String[] args) {
System.out.println(“Happy Codng!”);
}
}

I don’t think I have installed OpenJFX and I usually ensure my Java is always the latest version.

image

Java 8 is quite old. I would try updating to the latest version of Java (Java 16). Other than that, the best thing you can do is paste your error message into google and see if other folks have had the same issue!

1 Like

Thanks for the suggestion Kevin but Java 8 is what Oracle offers when I go to the download page:

I have got it running! I had to go into Run>Run Configurations… , create a new configuration and set the main class to HelloWorld:

1 Like

Ah that’s great, I’m glad you got it figured out!

I wonder if it’s showing you the Java 8 update because it somehow detects that you have Java 8 installed.

When I go here, I see Java 16. But hey, whatever works!

1 Like

That could be Kevin. I will do a little more research!

Phil.