is not public in empty package; cannot be accessed from outside package
843810Apr 2 2003 — edited Apr 3 2003Hi all,
would you give me some pointers on this compilation error that I'm getting. Class A wants to instantiate objects belonging to Class T27.
The source code for A.java is:
package mypkg;
import T27;
public class A {
public A()
{
System.out.println("inside A:constructor");
}
public static void main(String[] args)
{
T27 b = new T27();
System.out.println("inside A:main");
}
}
The file T27.class is provided by a 3rd party company. T27.class is in both locations, same directory as A.java, and its parent directory.
The compilation output is:
C:\oracle\ora92\Apache\Apache\htdocs\WEB-INF\classes\com\isas\tempgui\mypkg>javac A.java
A.java:3: T27 is not public in empty package; cannot be accessed from outside package
import T27;
^
A.java:13: cannot access mypkg.T27
bad class file: C:\oracle\ora92\Apache\Apache\htdocs\WEB-INF\classes\com\isas\tempgui\mypkg\T27.class
class file contains wrong class: T27
Please remove or make sure it appears in the correct subdirectory of the classpath.
T27 b = new T27();
^
2 errors
Thanks!
soli Deo gloria,
HS