Eclipse closes automatically when Using 'System.out.println'

Hello everyone,

I’m experiencing an issue with Eclipse where it closes automatically when I use ‘System.out.println’.

Environment :
Eclipse Version: eclipse 2024-03 is the latest version of Eclipse today I reinstalled it.
I downloaded Eclipse from the official Eclipse Foundation website at Eclipse Downloads | The Eclipse Foundation.

JDK version : java 22.0.1 2024-04-16
Java™ SE Runtime Environment (build 22.0.1+8-16)
Java HotSpot™ 64-Bit Server VM (build 22.0.1+8-16, mixed mode, sharing)

Operating System: Ubuntu Ubuntu 22.04.4 LTS

Problem Description: Whenever I run a simple Java program that uses System.out.println. Eclipse hung and closed automatically without getting any error messages.

What I’ve Tried:

  1. Checked the console for any error messages before Eclipse closes, but didn’t find any.
  2. Reinstalled Eclipse.
  3. Updated to the latest JDK version.
  4. Created a new workspace in Eclipse.
  5. Checked system resources (CPU, memory usage) while running the program.
    Additional Information:
  6. Other simple programs without System.out.println run fine.
  7. I have no plugins installed other than the default ones.
  8. when I use vs code or intellij or cmd prompt it runs normally and I get the output

Questions:

  1. Has anyone else experienced this issue with Eclipse?
  2. Can I check any log files to understand why Eclipse is crashing?
  3. Could this be related to a specific configuration in Eclipse or my system setup?
  4. Any suggestions on how to fix or further troubleshoot this issue?

Thank you in advance for your help!

1 Like

inside eclipse, go to window → Perference → java → installed JREs.
sceen shot and sent that page .

1 Like

I fix this issue

Hi everyone,

I recently encountered a problem with Eclipse. when I upgraded Ubuntu 20 to Ubuntu 22 then some applications did not work properly . After some troubleshooting, I discovered that switching from Wayland to X11 resolved the issue. Here’s how you can do it:

How to Switch from Wayland to X11 on Ubuntu

If you’re experiencing issues with Wayland and want to switch back to X11, follow these steps:

Turn off Wayland and switch back to X11.

  1. Log out of Ubuntu.
  2. Start to log in again and click the icon that has appeared at the bottom right of the screen - that gives you the option to disable Wayland.
  3. Switch back to Xorg.

Switching to X11 fixed the issues I was having, so I hope this helps anyone experiencing similar problems. Let me know if you have any questions or need further assistance!

1 Like