无效文件(错误幻数):执行格式错误 [英] invalid file (bad magic number): Exec format error

查看:686
本文介绍了无效文件(错误幻数):执行格式错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试设置classpath时,我遇到了以下错误。我正在使用CentyOS。我试图在命令提示符中编译一个java文件,因为我正在设置类路径。在Intellij中执行相同的java程序时,运行正常。在命令提示符下执行相同操作时,它会显示缺少jar的错误,因此我将类路径添加到看到错误的lib上。

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

任何建议都会有所帮助。我是java和linux的新手,谢谢!!

Any suggestions will be helpful. I am new in both java and linux, thanks!!

推荐答案

在unix环境中,classpath的分隔符为所以将其更改为:

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 

; 是命令分隔符。

这篇关于无效文件(错误幻数):执行格式错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆