invalid file (bad magic number): Exec format error

主宰稳场 提交于 2019-12-21 10:49:39

问题


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!!


回答1:


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.



来源:https://stackoverflow.com/questions/29139321/invalid-file-bad-magic-number-exec-format-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!