• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

please help import pakage how

 
Sahil Ji
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
//first class in import folder


package importpackage;

public class HelloWorld {
public void show(){
System.out.println("This is the function of the class HelloWorld!!");
}
}


//second class immediately above importpackage folder


import importpackage.*;

class CallPackage{
public static void main(String[] args){
HelloWorld h2=new HelloWorld();
h2.show();
}
}

c:--->nisha---->CallPackage.java
|
|--->importpackage ---->HelloWorls.java


C:\nisha\importpackage>javac *.java

C:\nisha\importpackage>cd..

C:\nisha>javac CallPackage.java *****ERROR importpackage does not exist************



Please solve problem


Thanks in advance



 
Helen Ma
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:
C:\nisha>javac importpackage\CallPackage.java

In order to compile CallPackage under c:\nisha path, you need to specify where CallPackage.java is.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic