This is my directory structure
e:\catalina.jar
e:\test.java
test.java is :
import org.apache.catalina;
import java.io.*;
public class test
{
public static void main(String [ ] args)
{
String filename = args[0];
}
}
my compilation batch file is :
%JDKPATH%\bin\javac -classpath catalina.jar test.java
The error message is :
E:\%26gt;C:\j2sdk1.4.2_08\bin\javac -classpath catalina.jar test.java
test.java:1: package org.apache does not exist
import org.apache.catalina;
^
1 error
Java : :Package does not exist?
That is not the way to import classes in Java.
Either you specify all possible classes from the package with the * wildcard:
import org.apache.catalina.*;
Or you specify only some class(es) from the package:
import org.apache.catalina.Server;
import org.apache.catalina.Session;
Regards
Reply:try passing the absolute path to the catalina.jar in your class path.
Reply:The error is occuring because , when you compile the code the jvm tries to get the class (or)interface name "catalina" from the package "org.apache" which is wil not present in the file "catalina.jar"
instead of specifying
import org.apache.catalina;
specify import org.apache.catalina.*;
now ur program wil executes.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment