Library import not working

899 Views Asked by At

I am unable to use stdlib commands in Java in Eclipse even though I have added the library files to the same project.

Please see the problem:

image

2

There are 2 best solutions below

0
On

I had the same problem and after a deep search I found the reason. You have to use a different stdlib.jar file. Download this stdlib-package and add import edu.princeton.cs.introcs.StdDraw;on the top of your .java file. (you can change StdDraw, Draw, StdIn, etc on top, your compiler will probably help you to import the right libraries)

0
On

You’ve done most things right, you added stdlib to the build path, and @Ralf Kleberhoff is right, you shouldn’t need an import. But the class you’re trying to use is called draw, not StdDraw. Try using Draw instead of StdDraw, and eclipse will probably do the rest automatically.