简体   繁体   English

ACM 库简单示例不适用于 jdk 1.7.0_79

[英]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.

相关问题 使用JDK 1.7.0_79的Play Framework 2.2.2发行问题 - Play Framework 2.2.2 with JDK 1.7.0_79 Starting issue libphonenumber Jar文件与Java JRE 1.7.0_79兼容 - libphonenumber Jar File Compatible with Java JRE 1.7.0_79 Java版本“1.7.0_79”的SSL握手失败 - SSL Handshake failure with Java version “1.7.0_79” JDK1.7.0_79如何安装/配置iText7 - Jdk1.7.0_79 how to install/configure iText7 WIX-MSI:如何从系统中的多个JRE版本(1,8、1.7.0_80、1.7.0_79和1.6.0_45)检查jre 1.7的最高版本-直到1.6 - WIX - MSI: How to check highest version of jre 1.7 - till 1.6 from multiple version of JRE (1,8, 1.7.0_80, 1.7.0_79 and 1.6.0_45) in the system setInitialFileName在jdk 1.7.0更新中不起作用25 - setInitialFileName is not working in jdk 1.7.0 update 25 javadoc for jdk1.7.0_06不在eclipse中工作 - Javadoc for jdk1.7.0_06 not working in eclipse JDK 1.4的简单Web服务示例 - Simple webservice example for JDK 1.4 错误:任务执行失败:ExecException:进程'命令'C:\\ Program Files \\ Java \\ jdk1.7.0_79 \\ bin \\ java.exe''以非零退出值2结束 - Error:Execution failed for task: ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 2 升级到jdk1.7.0_79和80(仅Linux)后,获取java.lang.Exception:输入的不是X.509证书:keytool错误 - After upgrading to jdk1.7.0_79 and 80 (linux only) getting java.lang.Exception: Input not an X.509 certificate :keytool error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM