[英]ACM Library simple example not working with jdk 1.7.0_79
Hi All java Experts!大家好Java专家!
When I tried a little example of acm library当我尝试 acm 库的一个小例子时
import acm.program.*;
class prog extends ConsoleProgram {
public void run() {
int number = readInt("?");
println("You entered: " number);
}
}
It compiled successfully.它编译成功。 I used commandline like this:
我使用这样的命令行:
javac -cp acm.jar; javac -cp acm.jar; main.java
主程序
java -cp acm.jar; java -cp acm.jar; prog
编
But I got this error:但我收到了这个错误:
Exception in thread "main" java.lang.UnsatisfiedLinkError: acm.util.DOSCommandLi
ne.getLine()Ljava/lang/String;
at acm.util.DOSCommandLine.getLine(Native Method)
at acm.util.DOSCommandLine.getCommandLine(JTFTools.java:1627)
at acm.util.JTFTools.getCommandLine(JTFTools.java:439)
at acm.util.JTFTools.getMainClass(JTFTools.java:464)
at acm.program.Program.main(Program.java:1320)
What does it mean... I think the JDK version problem.... however I am using JDK 'jdk1.7.0_79'这是什么意思...我认为是 JDK 版本问题.... 但是我使用的是 JDK 'jdk1.7.0_79'
In my opinion It is throwing exception only for this JDK version.在我看来,它仅针对此 JDK 版本抛出异常。 Request to try you and give feedback.
请求试用并提供反馈。 Thanks...
谢谢...
Solved!解决了!
It doesn't require any native library... What I had to do was to Use main entry as:它不需要任何本机库......我必须做的是将主条目用作:
public static void main(String[] args) {
new prog().start(args);
}
Adding after 'run' method it works now.在“运行”方法之后添加它现在可以工作了。 Note: this line 'new prog().start(args);'
注意:这一行'new prog().start(args);'
This solution found here: http://www.dreamincode.net/forums/topic/240789-acmjar-package-problem-class-wasnt-find-in-project/这个解决方案在这里找到: http : //www.dreamincode.net/forums/topic/240789-acmjar-package-problem-class-wasnt-find-in-project/
Thanks Choppy谢谢 波涛汹涌
But it took me considerable time Hushhhhh.....但是我花了相当长的时间 Hushhhhh.....
UnsatisfiedLinkError
at Native Method
means that there is no native library (for windows it would be dll) loaded which could be called for your acm.util.DOSCommandLine.getLine()
method. UnsatisfiedLinkError
Native Method
UnsatisfiedLinkError
意味着没有加载本机库(对于 Windows,它将是 dll)可以为您的acm.util.DOSCommandLine.getLine()
方法调用。
With your library there should be native packages, which will contain native libraries for your system architecture.您的库应该有本机包,其中将包含您的系统架构的本机库。 You have to put one of these into your classpath folder.
您必须将其中之一放入类路径文件夹中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.