Invalid file (bad magic number): Exec format error

I get below errors when I try to set the classpath. I am using CentyOS. I am trying to execute a java file on the command line so that I am setting the classpath. When running the same java program in Intellij, it works fine. Performing the same from the command line, it shows an error for missing jars, so for this I added the path to this library, where the error is visible.

[root@a admin]# export CLASSPATH=/home/admin/TagAPI/lib/org.json-20120521.jar ;/home/admin/TagAPI/lib/testng-6.8.21.jar 
invalid file (bad magic number): Exec format error

Any suggestions would be helpful. I am new to java and linux, thanks!

+4
source share
1 answer

In a unix environment, the separator is for the class path :, so change it to:

export CLASSPATH=/home/admin/TagAPI/lib/org.json-20120521.jar:/home/admin/TagAPI/lib/testng-6.8.21.jar 

; - .

+12

All Articles