Mac – cannot execute binary file in Mac Terminal

eclipsejavamacbook

I am trying to run IBM java on Mac terminal but which is giving error,

>./java -version

-bash: ./java: cannot execute binary file

Here is the terminal detail

uname -a

Darwin Devendras-MacBook-Pro.local 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64

Also, the java version as seen in a RHEL server, is,

./java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build pxa6470sr9fp50-20160720_02(SR9fp50))
IBM J9 VM (build 2.6, JRE 1.7.0 Linux amd64-64 Compressed References 20160630_309948 (JIT enabled, AOT enabled)
J9VM – R26_Java726_SR9_20160630_1817_B309948
JIT – tr.r11_20160630_120374
GC – R26_Java726_SR9_20160630_1817_B309948_CMPRSS
J9CL – 20160630_309948)
JCL – 20160719_01 based on Oracle jdk7u111-b13

And I want to use this java on my Macbook, for eclipse or for testing. However, with the above error I cannot do anything.

Best Answer

Are you sure java is in your PATH environment? It seems like not. Can you try /bin/java or something like that:

/bin/java -version
Related Question