0

Hi All java Experts!

When I tried a little example of acm library

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; main.java

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'

In my opinion It is throwing exception only for this JDK version. Request to try you and give feedback. Thanks...

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
user3051677
  • 147
  • 14

2 Answers2

1

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);'

This solution found here: http://www.dreamincode.net/forums/topic/240789-acmjar-package-problem-class-wasnt-find-in-project/

Thanks Choppy

But it took me considerable time Hushhhhh.....

user2326448
  • 85
  • 1
  • 11
user3051677
  • 147
  • 14
0

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.

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.

MGorgon
  • 2,547
  • 23
  • 41