| Author |
Howto Import Class
|
Sam Benry
Ranch Hand
Joined: Mar 21, 2008
Posts: 89
|
|
Im using Eclipse, and I want to import StdDraw.java how to do that I tries import StdDraw import StdDraw.java import StdDraw.class all are not working, how to import the class?
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16695
|
|
Originally posted by Sam Benry: Im using Eclipse, and I want to import StdDraw.java how to do that I tries import StdDraw import StdDraw.java import StdDraw.class all are not working, how to import the class?
You need to specify the class, not the file where the class is in. Open the file, and note the package that the StdDraw class is in. Let's say that it's in some.package, then import via... import some.package.StdDraw; Just change some.package to the actual package that StdDraw is in. Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16695
|
|
A couple more points.... First, with Eclipse it is easier than that -- you don't need to open the file. Eclipse will list the package that the java file is in via the package explorer. Second, if the class that you want to import is in a different project, don't forget to have your project refer to the other project. Henry
|
 |
 |
|
|
subject: Howto Import Class
|
|
|