You should declare Package abc.pqr in the source and compile it as javac -d <desired package location> xyz.java. You must not have compiled the class with Package. In such a compilation, though the java source gets compiled, at runtime, it throws above error. Abhay ----- Original Message ----- From: Mark Koscak <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, December 27, 2000 5:10 AM Subject: JDK compiles and on import give a bad class error. > Hi everyone, > > This was posted around 2 weeks ago to the jakarta-tomcat users mailing list. > > I have a Servlet that compiles under > java -version > Kaffe Virtual Machine > Copyright (c) 1996-1999 > Transvirtual Technologies, Inc. All rights reserved > Engine: Just-in-time v3 Version: 1.0.5 Java Version: 1.1 > Using this version everything is fine, compiles and runs properly when > accessed from a browser. > > > Yet when I migrate this application to the jdk1.3 on a different machine > java -version > java version "1.3.0" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0) > Java HotSpot(TM) Client VM (build 1.3.0, mixed mode) > > I get the following error when I attempt to compile the servlet class. > > javac VesEnqServletLive_a.java > VesEnqServletLive_a.java:74: cannot access webVesselEnq.VesEnq_b > bad class file: > /usr/local/jakarta-tomcat/packages/webVesselEnq/VesEnq_b.class > class file contains wrong class: VesEnq_b > Please remove or make sure it appears in the correct subdirectory of the > classpa > th. > VesEnq_b processRequest = new VesEnq_b(out, userTermSelection, > stateLoca > tion, p ); > > NOTE: > /usr/local/jdk1.3/lib/tools.jar is in the classpath. > VesEnq_b.class compiles without error using either JDK envronment. > VesEnq_b.class is in the correct package location for proper reference when > it gets imported. > /usr/local/jakarta-tomcat/packages is in the class path > > VesEnqServletLive_a is the actual servlet that communicates with VesEnq_b > to complete processing. VesEnq_b is a class that performs database access > and outputs display using a PrintWriter object passed to it. > > > Thank-you for your time. > > Mark > > ___________________________________________________________________________ > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff SERVLET-INTEREST". > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > Resources: http://java.sun.com/products/servlet/external-resources.html > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html > ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
