I am trying to call some terminal commands from Java using the Java ProcessBuilder with an M1 Mac that uses arm64. However, even though that I am using arm64 compatible JVM (Zulu 11, 17..) that identify arm64 chips, whenever I try to use the Java ProcessBuilder, it seems that the terminal is using Rosetta.
For example, the following command returns x86_64
instead of the expected arm64
.
ProcessBuilder pb = new ProcessBuilder();
pb.command(new String[] {"bash", "-c", "uname -m"});
Process proc = pb.start();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String text = "";
String line;
while ((line = input.readLine()) != null) {
text += line + System.lineSeparator();
}
bufferedReader.close();
System.out.println(text);
Do you know if there is any other way to execute terminal commands from Java using acutally the arm64 chip instead of the emulated Intel one?
Regards,
Carlos