javaeclipsepathdebian

Eclipse IDE won't run / compile any java code on Debian 12


I recently installed Eclipse on my Debian machine and installed a JDK (22 to be specific). Whenever I try to run anything I get this error:

Syntax error: word unexpected (expecting ")")

The code is a simple hello world print, so I know for sure the syntax is not the problem, since I've written it by hand and copied it and the same error occurs, so I'm fairly certain I did something wrong while making the project file or installing the IDE/JDK.

In case I've made a mistake, this is the code I'm trying to run:

package bunajava;

public class HelloJava {
    public static void main(String[] args) {
        System.out.println("Hello Java");
    }
}

I've tried changing the class name to the module name, and that solved part of the problem, now I only have this issue, and I couldn't find anything on here...

I've also got more errors relating to file paths, though I couldn't understand them.. Here is one of the errors:

/home/manole/Documents/SDK/jdk-23_linux-aarch64_bin/jdk-23/bin/java: 1: �h�������������: not found.

I'm new to java and I have no idea what the problem could be..

Thanks in advance.


Solution

  • An aarch64 system would be something like a Raspberry Pi or an ARM Chromebook, meaning that's the wrong architecture for a Java installation on most conventional Linux systems which are now x86-64. Aarch64 binaries can't be run on x86/x86-64 systems without significant and intentional steps for emulation. You need a x86-64 Java runtime instead, and to make sure that's what your Installed JREs preference page includes and your project refers to. Then the java executable within it will be runnable and able to run your application.