Results 1 to 7 of 7
Thread: import statement
- 02-01-2011, 09:18 PM #1
Member
- Join Date
- Jan 2011
- Posts
- 32
- Rep Power
- 0
import statement
Greetings,
I am trying some sample code.
the import statements I see at the top of code - are those similar to the "include" statements for header files?
Should I be able to find a file corresponding to a name in the importstatement?
I am getting an error on one of my import statements stating the file does not exist.
Help?
Thanks
Sparky
- 02-01-2011, 09:44 PM #2
Member
- Join Date
- Jan 2011
- Location
- Gainesville, FL
- Posts
- 45
- Rep Power
- 0
Yes, they are similar.
You are importing the Scanner class, which is found in package java.util.Java Code:import java.util.Scanner;
A list of what packages come with Java's API can be found here: Java 2 Platform SE v1.4.2
- 02-01-2011, 09:54 PM #3
Member
- Join Date
- Jan 2011
- Posts
- 32
- Rep Power
- 0
The import statement that is "failing" is:
import org.jdom.JDOMException;
where should this file be located?
Thanks again
-Sparky
- 02-01-2011, 10:02 PM #4
Member
- Join Date
- Jan 2011
- Location
- Gainesville, FL
- Posts
- 45
- Rep Power
- 0
If you look at the link, you can browse through all packages and classes provided by Sun, the original API. Users can also create or download their own packages and classes for personal use.
Looking through the packages, Java does not come with org.jdom, which leads me to believe that it is something you need to find on your own before you can import it.
- 02-01-2011, 10:14 PM #5
Member
- Join Date
- Jan 2011
- Posts
- 32
- Rep Power
- 0
I have found it at a website and downloaded a *.zip file.
I am using NetBeans - I have tried (within NetBeans) to go: tools - JAVA Platform - JAVADOC - add zip file.
No luck with that attempt.
I do see the file burried several directories down within the zip file.
Thoughts?
Thanks
Sparky
- 02-02-2011, 12:43 AM #6
You need to add the file(s) to your classpath. This is a Netbeans problem, search the help feature. I'm not sure if netbeans can handle zip files so you may need to unzip it first.
- 02-02-2011, 08:30 AM #7
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
Similar Threads
-
How do you import?
By Gary20 in forum New To JavaReplies: 2Last Post: 01-28-2011, 06:12 PM -
Import
By gothrog in forum Java AppletsReplies: 2Last Post: 05-13-2010, 11:16 PM -
import statement.
By diRisig in forum New To JavaReplies: 2Last Post: 02-08-2008, 12:34 AM -
Statement or Prepared Statement ?
By paty in forum JDBCReplies: 3Last Post: 08-01-2007, 04:45 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks