Results 1 to 3 of 3
Thread: Import
- 05-10-2010, 09:13 PM #1
Member
- Join Date
- May 2010
- Posts
- 6
- Rep Power
- 0
Import
All,
I'm having an issue trying to get my import to work. I'm a novice as a java developer.
The files are in the same directory, but if I type in this it doesn't work.
import myPackage.myClass;
It says it can't find the myPackage. Can someone help?
I'm not sure how to get it to know where the myPackage is.
Thanks,
Mike
- 05-11-2010, 04:43 AM #2
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0
I am not sure what is applet thread here about :confused:
But anyway...
Any package import means that package is on your main class level or lower.
Just create package (folder) next to your main source file and add a *.java file to it...
If you use an IDE you should read its documentation to find out how to create a new package in the frames of your project.If my answer helped you. Please click my "REP" button and add a comment
Have a Good Java Coding :)
- 05-13-2010, 11:16 PM #3
The import statement is a way to add paths for the compiler to find class definitions.
If the referenced classes are in the same directory as the source, then you shouldn't need an import statement. Unless the classes are in packages, in which case the class files will have to be in folder/paths that match the package name.
Could you give an example? Eg the filename, packages, classes referenced
Similar Threads
-
Import your own package
By Umi in forum New To JavaReplies: 4Last Post: 02-15-2010, 09:05 AM -
Can not import jxl.*
By AnnieDing in forum Java ServletReplies: 3Last Post: 01-22-2010, 03:52 PM -
Cant import RowSorter?
By ProgrammingPup in forum New To JavaReplies: 3Last Post: 11-17-2009, 09:52 PM -
import problem
By anki.gulsvart in forum NetworkingReplies: 9Last Post: 10-16-2009, 07:03 PM -
Import not working
By ribbs2521 in forum New To JavaReplies: 5Last Post: 12-16-2008, 06:14 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks