This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Package doesnot exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Package doesnot exist" Watch "Package doesnot exist" New topic

Package doesnot exist

feda alshahwan
Ranch Hand

Joined: Jul 26, 2008
Posts: 170
I am creatig a small client java program and i am importing some classes but i had errors during compilation, the error is that cannot find the package! How to find it ?where to put it?This is my code:

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;

public class Client {
public static void main(String [] args) {
try {
String endpointURL =

Integer in = new Integer(10);
Service service = new Service();
Call call = (Call) service.createCall();

new );
new QName("SilverService", "getIncrement") );

Object ret = call.invoke( new Object[] { in } );

System.out.println("Object = " + ret.getClass().getName());
System.out.println("Number Returned : " + ret.toString());
} catch (Exception e) {
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

It would be helpful if you could post the full error message. (And it is generally a good idea to do such when posting questions. - See the TellTheDetails tip for more information.)

Most likely your issue is that the package that is not being found in not on your classpath. So most likely you need to adjust your classpath. If its the org.apache.axis.client package not being found, you need to add the Apache Axis JAR to your classpath. (If you are not sure how to do that, let us know and we can show you.) But depending on the error message you are getting, there may be other things you may need to do.
[ August 04, 2008: Message edited by: Mark Vedder ]
Rob Spoor

Joined: Oct 27, 2005
Posts: 19649

You need to include the Axis JAR file in the classpath when compiling. javax.xml.namespace.QName won't be a problem if you're using Java 5.0 or higher.

How To Ask Questions How To Answer Questions
feda alshahwan
Ranch Hand

Joined: Jul 26, 2008
Posts: 170
Thank you for your response.I am using NetBeans. How to include a classpath using NetBeans?
When I used JDK1.5.0_16 from command line I got the following:

C:\tomcat50-jwsdp\tomcat50-jwsdp\webapps\axis\WEB-INF\classes>javac -cp %AXISCLA
SSPATH% %AXIS_HOME%\web-inf\classes\Client\src\client\
C:\TOMCAT50-JWSDP\TOMCAT50-JWSDP\WEBAPPS\AXIS\web-inf\classes\Client\src\client\ is already defined in a single-ty
pe import
import org.apache.axis.client.Service;
C:\TOMCAT50-JWSDP\TOMCAT50-JWSDP\WEBAPPS\AXIS\web-inf\classes\Client\src\client\ cannot find symbol
symbol : constructor Service()
location: class
Service service = new Service();
C:\TOMCAT50-JWSDP\TOMCAT50-JWSDP\WEBAPPS\AXIS\web-inf\classes\Client\src\client\ cannot find symbol
symbol : method createCall()
location: class
Call call = (Call) service.createCall();
3 errors

I agree. Here's the link:
subject: Package doesnot exist
Similar Threads
Non JSP client for Web Service
Invoking a webservice from a servlet
Unable to receive result from Web Service Method
axis and attachments
NullPointerException returned from webservice