问题
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