access java jarfile_java: “Unable to access jarfile …”

在Linux Mint 12上尝试运行RoboMind时遇到'Unable to access jar file'的问题。通过直接在命令行输入.sh文件中的命令可以成功运行,但.sh脚本执行时出错。解决方案是使用'dos2unix'命令转换.sh文件,之后脚本就能正常运行。
摘要由CSDN通过智能技术生成

问题

Newbee to java

I have downloaded RoboMind (http://robomind.net) and try to make it run on a Linux Mint12

Knowing that Min12 is not the newest release, I still would like it to run...

When I use the .sh file that comes in the pack I get an error:

"Unable to access jarfile ..."

if I type the exact same command at the same prompt, in the same directory, it works:

here is a copy paste from the commanline:

magnus@martin-HP-625 ~/Downloads/RoboMind $ ./robomind.sh

Unable to access jarfile RoboMind.jar

magnus@martin-HP-625 ~/Downloads/RoboMind $ cat ./robomind.sh

java -jar -Djava.ext.dirs=lib -Dsun.java2d.ddscale=true -Dsun.java2d.noddraw=true RoboMind.jar

magnus@martin-HP-625 ~/Downloads/RoboMind $ java -jar -Djava.ext.dirs=lib -Dsun.java2d.ddscale=true -Dsun.java2d.noddraw=true RoboMind.jar

java.lang.reflect.InvocationTargetException

at java.awt.EventQueue.invokeAndWait(EventQueue.java:1076)

at java.awt.EventQueue.invokeAndWait(EventQueue.java:1053)

at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1347)

at robo.RoboMind.startGui(RoboMind.java:168) ...

Now it works ... ?

Whats the difference?

I messed around with javapath etc. as suggested in other posts, but nothing makes any difference to the situation illustrated above.

Why can't the .sh script find the .jar file when the exact same command at the prompt have no problems?

Best regards

Martin

回答1:

I'll give you the "solution", and I will let you discover "why".

Just launch:

# dos2unix robomind.sh

..after then it will work. If you do not have dos2unix installed, apt-get install dos2unix

来源:https://stackoverflow.com/questions/18943728/java-unable-to-access-jarfile

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值