• Post Reply Bookmark Topic Watch Topic
  • New Topic

import statement  RSS feed

 
thomas wilson
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have problem with the import statement which gave error "package wow does not exist". I tried to change the name of the package or created new folder to make it a package in the directory where 'test.java' was in, but it still didnt work. When I commented out the import statement, it compiled without problem. I use WindowXP Pro and j2sdk1.4.2_04. Please help

=========
import wow.*;

public class test
{
public static void main(String args[]) throws Exception
{

System.out.println("testing");

}
}
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is in package wow? Just putting a .java file in the subfolder wow isn't quite enough. You also need to add the following line at the top of the source code:

Also, you don't need to import any classes from the package where a class lives. In otherwords, if you add the above line to the code you gave, you don't need the import statement at all. The import statement is used to find classes in other packages.

HTH

Layne
 
thomas wilson
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you. I got it running
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!