Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

invalid file (bad magic number): Exec format error

I am getting below error when i am trying to set classpath. I am using CentyOS. I am trying to complie a java file in command prompt for that i am setting the classpath. On executing the same java program in Intellij , it runs fine. On executing the same from command prompt it shows error for missing jars so for that i added the classpath to that lib on which the error is seen.

[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 will be helpful. I am new in both java and linux, thanks!!

like image 819
user3712016 Avatar asked Mar 19 '15 07:03

user3712016


1 Answers

In unix environment the delimiter for classpath is : so change it to:

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

; is the command delimiter.

like image 82
Jens Avatar answered Nov 20 '22 23:11

Jens