aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Import Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Import" Watch "Import" New topic
Author

Import

Abhijeet Gholkar
Greenhorn

Joined: Jun 11, 2002
Posts: 25
File A.java
package my;
public class A
{
public String sayHi()
{
return "HI";
}
}
File B.java
import my.*;
class B
{
public static void main(String[] args)
{
A a = new A();
System.out.println(a.sayHi());
}
}
I compiled A.java using following command
javac -d . A.java
even then class A is not available in class B?
Jamal Hasanov
Ranch Hand

Joined: Jan 08, 2002
Posts: 411
Use
javac -d . -classpath . A.java
Jamal Hasanov
www.j-think.com
Jamal Hasanov
Ranch Hand

Joined: Jan 08, 2002
Posts: 411
and run class B with the same classpath parameter.
Jamal Hasanov
www.j-think.com
Abhijeet Gholkar
Greenhorn

Joined: Jun 11, 2002
Posts: 25
I forgot to mention that the code works when in B.java i say
import my.A;
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Import