Importing Inter-package classes

hello
I have never had this problem before but I just 'downgraded' to JDK 1.1.8 because the code will be used on my PDA. I am trying to import Inter-package classes but the compiler it cannot find the classes I've imported. This code was working perfectly in j2sdk1.4.2_02
I think the code is right all files saved in folder graphs and beginning looks like this:
package graphs;
import graphs.AxisParameter;

Yes they are in the same folder with 'package graphs;' in the 1st line,
i've tried with and without package.class to no avail
the exact errors i'm getting are
without the package in front
error: File .\CustomLabel.class does not contain type CustomLabel as expected, but type graphs.CustomLabel. Please remove the file or make sure it appears in the correct subdirectory of the class path
with the graphs.CustomLabel i get the following errors
error: Invalid class File formate: .\graphs\CustomLabel.class, wrong version: 46, expected 45
2nd error: Class graphs.CustomLabel not found in import.

Similar Messages

  • When try to import a packaged class it alway complain package does not exis

    when try to import a packaged class it alway complain package does not exisist??
    pls help

    when try to import a packaged class it alway complain
    package does not exisist??Even with the bootstrap classes? "import java.lang.Double;" gives you the same error?
    If not, please check your classpath.

  • How to import non-package class in JSP ?

    We have develped an enterprise solution in java 1.3 . Some of the controller and controller helper classes donot have any package structure. So they are been kept in web_inf/classes. When any jsp tries to refrence these classes class not found exception arise.
    One solution is to put these classes in package and write approprite import statement. But this involve lot of changes. Kindly suggest a solution which can have minimum impact.
    I have even jared all these classes into a jar and put that jar in the class path. But still its not working.

    It should not be web_inf , the case and the spelling matters it should be WEB-INF , make that correction and see if it works.
    If not then, use an IDE to refactor your code.
    Some good IDEs with refactoring capabilities are
    IntelliJ IDEA - commercial
    NetBeans - open source I think (not sure)
    Eclipse Web Tools - also open source
    Using packages is a good practice, and will make your application more understandable.
    Message was edited by:
    appy77

  • Package zzz not found in import (server side classes)

              Hi,
              I'm trying to use the "Web Application" feature in WL 5.10
              (with no service pack). My application contains a couple of
              servlets, a couple of server side classes, and a couple of
              jsp pages.
              I created the WEB-INF\classes directory structure both in
              public_html and in my application's root directory. I
              modified setEnv.bat to contain the two directories in
              ClassPath and compilation of my servlets from the command
              line completes OK (the servlets import a package that sits in
              public_html\WEB-INF\classes).
              However, when I try to import the same package from a jsp
              file, I get the "package zzz not found in import" error
              message. The trace shows that the java compiler invoked
              after the servlet has been generated does not contain
              public_html\WEB-INF\classes in the ClassPath, but contains
              public_html\my_app\WEB-INF\classes.
              How can I specify that the java compiler should look under
              public_html\WEB-INF\classes for server side classes? Is there
              another solution and am I even using the right approach?
              Thanks,
              Vladimir
              

              Vladimir wrote:
              >
              > Hi,
              >
              > I'm trying to use the "Web Application" feature in WL 5.10
              > (with no service pack). My application contains a couple of
              You should install the service packs, your problem will probably
              disappear then.
              Web Apps are better supported with service packs.
              > servlets, a couple of server side classes, and a couple of
              > jsp pages.
              >
              > I created the WEB-INF\classes directory structure both in
              > public_html and in my application's root directory. I
              > modified setEnv.bat to contain the two directories in
              > ClassPath and compilation of my servlets from the command
              > line completes OK (the servlets import a package that sits in
              > public_html\WEB-INF\classes).
              >
              > However, when I try to import the same package from a jsp
              > file, I get the "package zzz not found in import" error
              > message. The trace shows that the java compiler invoked
              > after the servlet has been generated does not contain
              > public_html\WEB-INF\classes in the ClassPath, but contains
              > public_html\my_app\WEB-INF\classes.
              >
              > How can I specify that the java compiler should look under
              > public_html\WEB-INF\classes for server side classes? Is there
              > another solution and am I even using the right approach?
              >
              Setting the WEBLOGIC_CLASSPATH should do the trick. Look in weblogic
              start file (On NT startWeblogic.cmd)
              > Thanks,
              > Vladimir
              

  • Problem in importing two different classes with same name...

    I have to import two different classes in my program with the same name....
    import org.apache.lucene.document.Document;
    import org.w3c.dom.Document;
    //    I AM USING THE DOCUMENT FROM W3C PACKAGE HERE....
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                     DocumentBuilder builder = factory.newDocumentBuilder();
                     InputSource is = new InputSource( new StringReader( tempString ) );
                     d = builder.parse( is );
                     NodeList images = d.getElementsByTagName("img");
                     int length = images.getLength();
                     for(int i = 0;i<length;i++)
                         Node image = images.item(i);
                         String tempAltText = image.getAttributes().getNamedItem("alt").getNodeValue();
                         altText = altText.concat(" ").concat(tempAltText);
                     }and the error i am getting is
    [javac] C:\Documents and Settings\sumit-i\WolframWorkspaces\Base\WolframNutch\src\java\com\wolfram\nutch\indexer\InfoCenterFilter.java:20: org.apache.lucene.document.Document is already defined in a single-type import
        [javac] import org.w3c.dom.Document;
        [javac] ^
        [javac] C:\Documents and Settings\sumit-i\WolframWorkspaces\Base\WolframNutch\src\java\com\wolfram\nutch\indexer\InfoCenterFilter.java:132: incompatible types
        [javac] found   : org.w3c.dom.Document
        [javac] required: org.apache.lucene.document.Document
        [javac] d = builder.parse( is );
        [javac] ^
        [javac] C:\Documents and Settings\sumit-i\WolframWorkspaces\Base\WolframNutch\src\java\com\wolfram\nutch\indexer\InfoCenterFilter.java:133: cannot find symbol
        [javac] symbol  : method getElementsByTagName(java.lang.String)
        [javac] location: class org.apache.lucene.document.Document
        [javac] NodeList images = d.getElementsByTagName("img");
        [javac] ^
        [javac] Note: Some input files use unchecked or unsafe operations.
        [javac] Note: Recompile with -Xlint:unchecked for details.
        [javac] 3 errorsany idea ..how to resolve it
    Edited by: ping.sumit on Jul 16, 2008 3:39 PM
    Edited by: ping.sumit on Jul 16, 2008 3:40 PM

    now i changed the code to
    import org.apache.lucene.document.Document;
    import org.w3c.dom.Document;
    org.w3c.dom.Document d = null;
    try{
         System.out.println("in author");
                   URL url = new java.net.URL(urlString);
                   java.net.URLConnection conn = url.openConnection();
                   BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                   while ((in.readLine()) != null)
                        //tempString = tempString.concat(in.readLine());
                        String temp = in.readLine();
                        tempString = tempString + " " + temp;
                   System.out.println("the string in author" + tempString);
                    in.close();
                    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                     DocumentBuilder builder = factory.newDocumentBuilder();
                     InputSource is = new InputSource( new StringReader( tempString ) );
                     d = builder.parse( is );
                     NodeList images = d.getElementsByTagName("img");and their is only one error i am getting ...and that is
    [javac] C:\Documents and Settings\sumit-i\WolframWorkspaces\Base\WolframNutch\src\java\com\wolfram\nutch\indexer\InfoCenterFilter.java:20: org.apache.lucene.document.Document is already defined in a single-type import
        [javac] import org.w3c.dom.Document;
        [javac] ^
        [javac] Note: Some input files use unchecked or unsafe operations.
        [javac] Note: Recompile with -Xlint:unchecked for details.
        [javac] 1 error

  • //package classes;

    i have used the code below,,and my application is working fine...but when i removed the comments from the package ling..the 404 error is coming..i have compiled the servlet with package line uncommented..whats the reason?
    //package classes;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.io.*;
    import java.sql.*;
    public class CookieLoginServlet extends HttpServlet {
         public void doGet(HttpServletRequest request ,HttpServletResponse response)
         throws ServletException,IOException {
              sendLoginForm(response,false);
              System.out.println("inside get");
         public void doPost(HttpServletRequest request,HttpServletResponse response)
         throws ServletException ,IOException {
              String userName=request.getParameter("userName");
              String password=request.getParameter("password");
              if(login(userName,password)){
    Cookie c1=new Cookie("userName",userName);
    Cookie c2=new Cookie("password",password);
    response.addCookie(c1);
    response.addCookie(c2);
    response.setContentType("text/html");
    PrintWriter out =response.getWriter();
    // response.sendRedirect does not work here.
    // use a Meta tag to redirect to ContentServlet
    out.println("<META HTTP-EQUIV=Refresh CONTENT=0;URL=ContentServlet>");
              }else{
                   sendLoginForm(response,true);
         private void sendLoginForm(HttpServletResponse response,boolean withErrorMessage)
         throws ServletException ,IOException {
              response.setContentType("text/html");
              PrintWriter out=response.getWriter();
              out.println("<html>");
              out.println("<head>");
              out.println("<title>Login</title>");
              out.println("<body>");
              out.println("<center>");
              if(withErrorMessage){
                   out.println("login failed .plz try again<br>");
                   out.println("if u think you have entered the correct user name "+
                        "and password,the cookie setting in your browser might be off " +
                        "<br>Click<a href=InfoPage.html>here</a> for information ");
              out.println("<br>");
              out.println("<br><h2>please enter your username and password</h2>");
              out.println("<br>");
              out.println("<br><form method=POST>");
              out.println("<table>");
              out.println("<tr>");
              out.println("<td>userName:</td>");
              out.println("<td><input type=text name=userName></td>");
              out.println("</tr>");
              out.println("<tr>");
              out.println("<td>password:</td>");
              out.println("<td><input type=password name=password></td>");
              out.println("</tr>");
              out.println("<tr>");
              out.println("<td><input type=submit value=submit></td>");
              out.println("</table>");
              out.println("</form>");
              out.println("</center");
              out.println("</body>");
              out.println("</html>");
         public static boolean login(String userName,String password){
              try{
                   Class.forName("sun.jdbdc.odbc.JdbcOdbcDriver");
                   Connection con =DriverManager.getConnection("jdbc:odbc:JavaWeb");
                   Statement s=con.createStatement();
                   String sql="SELECT UserName FROM users" +
                   "WHERE UserName='"+fixSqlFieldValue(userName)+ "'"+
                   "AND password='"+fixSqlFieldValue(password)+"'";
                   ResultSet rs= s.executeQuery(sql);
                   if(rs.next()){
                        rs.close();
                   s.close();
                   return true;
                   }else
                   {     rs.close();
                   s.close();
                   con.close();
              }catch(ClassNotFoundException e){
                   System.out.println(e.toString());
         catch (SQLException e) {
         System.out.println(e.toString());
         catch (Exception e) {
         System.out.println(e.toString());
         return false;
         public static String encodeHtmlTag(String tag){
              if(tag==null)
              return null;
              int length=tag.length();
              StringBuffer encodeTag=new StringBuffer(2*length);
              for(int i=0; i<length; i++) {
              char c=tag.charAt(i);
              if(c=='<')
              encodeTag.append("<");
              else if(c=='>')
              encodeTag.append(">");
              else if(c=='&')
              encodeTag.append("&");
              else if(c=='"')
              encodeTag.append(""");
              else if(c==' ')
              encodeTag.append(" ");
              else
              encodeTag.append(c);
              return encodeTag.toString();
         public static String fixSqlFieldValue(String value) {
              if (value==null)
              return null;
              int length = value.length();
              StringBuffer fixedValue = new StringBuffer((int) (length* 1.1));
              for(int i=0; i<length; i++) {
              char c = value.charAt(i);
              if(c=='\'')
              fixedValue.append("''");
              else
              fixedValue.append(c);
              return fixedValue.toString();
    }

    It means you didn't deploy the servlet properly.
    Put the package back - all your Java classes should go into packages. All the time. The only exception is when you're writing a quick knock-off to test something that you'll run on the command line and rarely use again.
    No surprise - the code you've written is certainly terrible. HTML to the output stream - ever heard of JSP?
    SQL code in a servlet - ever hear of Data Access Objects?
    Layering apps makes them easier to test, debug, maintain, and understand.
    What servlet/JSP engine are you using? Tomcat? If so, Tomcat requires that you use packages.
    Where did you put this beauty of a servlet? Better not be /ROOT. Create a directory under /webapps for your app and deploy it there.
    What URL did you use to invoke the servlet? I'll bet that's wrong, too.
    Lots to correct here.
    %

  • How to import a package in jsp

    i've searching here and i've not found answer to this, so i write it here.
    i've created a class to send mail, it imports the javax.mail.* and javax.activation.*, in a package named jspbeans.
    now, when i try to use this package in my jsp page (using tomcat), gives me the error:
    Package jspbeans not found in import
    import jspbeans.*;
    the code for my jsp page is:
    <%@ page language="java" %>
    <html>
    <head>
    <title>Sending mail from JSP</title>
    </head>
    <body>
    <%@ page import="jspbeans.*"%>
    <jsp:usebean id="sendmail" class="jspbeans.SendMail" scope="page"/>
    <jsp:setProperty name="sendmail" property="host" value="mail.wavelinksystems.com"/>
    <jsp:setProperty name="sendmail" property="to" value="[email protected]"/>
    <jsp:setProperty name="sendmail" property="from" value="[email protected]"/>
    <jsp:setProperty name="sendmail" property="msg" value="testing 1 2 3..."/>
    <jsp:setProperty name="sendmail" property="subject" value="test"/>
    <%//sendmail.send();%>
    <p>
    Mail has been sent to <jsp:getProperty name="sendmail" property="to"/>
    </body>
    </html>and the path of this jsp page is:
    C:\WINDOWS\Desktop\tomcat\jakarta-tomcat-3.3.1\webapps\ROOT\pruebas\jspMailTest.jsp
    the path for the package is:
    C:\WINDOWS\Desktop\tomcat\jakarta-tomcat-3.3.1\webapps\ROOT\pruebas\jspbeans
    what am i doing wrong?
    what am i missing?
    how do i have to import the package?
    thanks

    it generates a
    java.lang.NoClassDefFoundError: javax/mail/MessagingException
    i changed the package to that directory and the import generates no errors, if i do nothing but the import, and soem printing, the page is generated, but when i try to assign the variables, generates that error, why is it?

  • Problem with importing jsp packages

    Hi guys. I'm having a problem compiling a class that imports jsp packages.
    I'm getting errors along the lines of:
    C:\>javac HelloTag.java
    HelloTag.java:4: package javax.servlet.jsp does not exist
    import javax.servlet.jsp.*;
    ^
    HelloTag.java:5: package javax.servlet.jsp.tagext does not exist
    import javax.servlet.jsp.tagext.*;
    - I've copied jsp-api.jar and servlet-api.jar to a folder that's in my path: C:\Program Files\Java\jre1.5.0_03\lib\ext
    Any suggestion?
    Thanks.

    U have to add the path into the classpath
    set CLASSPATH=%CLASSPATH%;jsp-api.jar ....
    the compile in the same cmd window
    Do not use the CLASSPATH environment variable. Use the -classpath option while compiling and specify the path to your jar file.
    javac -classpath <path to jar file> filename.javacheers,
    ram.

  • HELP: Import my own class in JSP ???

    Hi, all!
    I read many previous topics in this forum but no one works for me!
    Please someone help me!
    I'm using Tomcat 4.1.12 and my JSP scripts work just fine, but I need to import my own .class file. I just don't know where to put it so Tomcat can find it!?
    I have this environment variable:
    JAVA_HOME=.;c:\jdk1.3.1
    And in my code I'want to place something like this:
    <%@ page import="myClass" %>
    But I get a "can not resolve symbol" exception.
    Thanks for readind this, and please help if you can!
    Bye.
    adriano

    Within the Tomcat directory, under your application directory place the class file/s into the WEB-INF/classes directory. If your classes are part of a package place the entire directory structure of the package under the WEB-INF/classes directory.
    The import in the JSP is the same as for any Java class.
    Hope this solves your problem.

  • Importing my own classes

    I have 2 simple classes in the same directory and I'd like to test the use of import to import one class into the other. Upon compilation of the class thats doing the import, I get a compilation error. Herewith the details, where could I be getting it wrong.
    ****code for class to be imported****
    import java.util.Date;
    public class printer
    public void print()
    System.out.println(new Date());
    System.out.println("Hello World");
    --The above code compiles with no problems.
    ***Code for the main class that imports the above*****
    import printer;
    public class myapp
    public static void main(String[] args)
    (new printer()).print();
    -upon compiling the second class above, myapp.java, I get the following errors:
    C:\java\source>javac myapp.java
    myapp.java:1: '.' expected
    import printer;
    ^
    myapp.java:1: ';' expected
    import printer;
    ^
    2 errors

    Moreover, classes do not need to import any class which is in the same package as their own, and since your printer class is in the default package (if you call that a package) you shouldn't need to import it into myapp anyway

  • How to import GreenSock external classes?

    Hi, I'm having some problems in importing GreenSock external classes into my flash project.
    Line 27: import gs.*;
    Desktop\myFlashAPPS\twitter\src\zainu\twitter\MainClass.as, Line 27
    1172: Definition gs could not be found.
    Here is the directory tree:
    myFlashApp (contains myproject.fla)
         src
              zainu
                   twitter (contains MainClass.as and gs folder)
    MainClass.as:
    package zainu.twitter{

    You could try specifying the path to the gs folder as if you were importing it directly from the myproject.fla file.
    You should set up a classpath for external classes for your system so that Flash has a ready reference for finding them.  YOu can set this up via using Edit -> Preferences... -> Actionscript -> Actionscript 3.0 Settings... -> specify a source path.  Normally what people do is create a folder in a relatively general location and use that as their source path.   Within that they place a "com" folder, and within that com folder they place their subfolders for different classes they acquire from outside sources, such as your gs folder.  So when you want to import the gs classes you can use... import com.gs.*;
    There is a tutorial at gotoandlearn that explains this...   http://www.gotoandlearn.com/play.php?id=30

  • Importing a Custom Class

    Hi everyone...
    I'm working on one final part of a Flash piece that's ended being quite a bear for me. So looking forward to wrapping it up! I'm a big-time newbie. This has been an amazing learning experience but boy it has made my brain hurt!
    The final issue I'm having invloves importing a custom class that calls a custom application. It's a class/application that I downloaded and am trying to apply to my project. It is an application that adds transform handles around targeted objects.
    I'm importing the class as I think I am supposed to but it doesn't work. There aren't any erros but it simply doesn't work.
    Here's how I'm doing it...
    My .FLA, FloorPlan.FLA, is located in my root folder along with the class file, ApplicationMain.as.
    ApplicationMain.as has an import that imports the application called TransformTool.as. TransformTool.as is located in the root as well.
    So in scenen 1 on frame 1 of FloorPlan.FLA I have an import written like so...
    import ApplicationMain;
    In the file ApplicationMain.as I have an import to grab the file TransformTool.as that is written like so...
    package  {
        import flash.display.MovieClip;
        import flash.geom.Rectangle;
        import flash.events.MouseEvent;
        import TransformTool;
        public class ApplicationMain extends MovieClip
            private var _transformTool;
            public function ApplicationMain ()
                _transformTool = new TransformTool();           
                _transformTool.mode = TransformTool.ROTATE;
                _transformTool.iconScale = new HandleHintScale();         
                _transformTool.iconRotate = new HandleHintRotate();
                // _transformTool.boundaries = new Rectangle(50, 50, 475, 260);
                addChild(_transformTool);
            // register targets //   
                _transformTool.targets = [content_MC.e1, content_MC.e2, content_MC.e3, content_MC.e4, content_MC.f1, content_MC.f2, content_MC.f3, content_MC.f4, content_MC.f5, content_MC.f6, content_MC.f7, content_MC.f8];
                _transformTool.activeTarget = content_MC.f8;
            // register radio buttons //   
                  // radio1.addEventListener(MouseEvent.CLICK, changeToolMode);
              //  radio2.addEventListener(MouseEvent.CLICK, changeToolMode);             
            private function changeToolMode(evt:MouseEvent):void
                _transformTool.mode = evt.currentTarget.label.toLowerCase();
    Everything but this class/application is working just fine. It doesn't cause any erros and make other items not function. It simply isn't working. And I had it working at the very beginning of the project so I know its not the class/application files causing the problem; other than possible path issues.
    I'm stumped, yet again! 
    Thanks in advance for your help!

    HandleHintScale and HandleHintRotate are movie clips in the library of the .fla

  • Not  able to access default package classes in own package

    I created a class called Constant.java in default package(no package ).
    I have Connection.java in util package.
    I am trying to use the Constant.java in my Connection.java like below..
    public class Constant
         public static final String NEW = "01";
    package util;
    import Constant;
    public class Connection
    I am unable to compile the class Connection. My question here is Won't I able to access default package in my util package.. ?

    java_guy04 wrote:
    Djaunl , I understand.
    but, Will I able to access default package in my util package.. ? is this correct.No, you won't be able to use classes out of the "default" package.
    Because, AFAIK, if you use a classname that you haven't imported, Java automatically attempts to locate this class in the same package as the current class. It does not check the "default" package (unless that is also the current package), and since the "default" package does not have a package name, you can't import those classes either.

  • Import and package does not exist

    I have a program and I wish to import a package that I've made. I have tried to do this with:
    import clientcode.*;but I keep getting the error message java:8: package clientcode does not exist
    I am completely new to Java and have no idea how to get around this. Please help

    Do you use ide or compile classes from command line?
    Most likely it's a classpath problem.

  • Compiling java package class referring a default package class.

    I am trying to compile a java class having a package defination referring a java class with a default package.
    The code for the default package class is .
    public class Test{.
    public static void main(String[] args){
    System.out.println("Hello World!");
    This class compiles fine.
    I have another class called PackJava, whose code is :
    package test;
    import Test;
    public class PackJava{
    public static void main(String[] args){
    Test test = new Test();
    System.out.println("Hello World!");
    I have Test file in the windows path
    D:\development\packagetest\example
    and the PackJava java file in the path
    D:\development\packagetest\example\test
    I have set the CLASSPATH environment varibale as
    D:\development\packagetest\example;.
    When I try to compile the PackJava from the
    D:\development\packagetest\example path giving the command as
    javac -classpath . test\PackJava.java
    or
    javac -classpath %CLASSPATH% test\PackJava.java
    it gives me error,
    Do any of you have an idea of the parameter i should pass
    to the -classpath option
    Thanks

    There is a way around all this. The classes in the default packages need to implement an interface with the methods require. The interface can be in any package you want ie. com.work.around.interf.MyInterface1. Next, make this interface available in a Singleton. - The only catch here is that, the main method must reside in default package as well. And o, on start of main, instantiate the class you want and put it in the singleton. There after, you may refer to it from the singleton.
    Enjoy.

Maybe you are looking for

  • Is there a way to publish a high-res .ipa from Flash CS5.5 with AIR for iOS?

    Hello, I've developed an app for iOS in Flash specifically for iPad 3's. My client uses SOTI MobiControl as it's mobile device management solution. If I publish out of Flash using AIR SDK 3.1 or newer the app is created and looks high-res on the iPad

  • Windows Server 2012 R2 GPO Loginscript is executed with more than 2 minutes delay after login

    Hi everybody A strange problem came up in a new Windows Active Directory Domain (one single DC with Windows Server 2012 R2 Essentials): after configuring a User GPO with a Powershell Loginscript and applying the GPO to an User OU, the following happe

  • Can't add iframe as HTML

    I'm putting the following code in Muse's HTML box, but it won't work. Can anyone see where I'm going wrong? <iframe name="gs3" src="http://vid1alearnerpower.businesscatalyst.com/lessons/gs3/index.html" width="1024" height="800" frameborder="0" scroll

  • Stop(); not working when exporting AIR for iOS from Flash CS5.5

    Hey there I've tried to do a simple 5 frame animation in Flash CS5.5 each with a stop(); action but when viewed on the iPad the aniamtion doesnt stop, it cycle through the 5 frames instead of stopping at frame 1. Any reason why that is happening?

  • CS4 insists on being default app (over CS3)

    I work on a PPC G5 (OS 10.5.8) with CS3.   When we installed CS4 (the last version to support PPC?) the CS4 apps insist on being the default apps for all things Illustrator, Photoshop, and InDesign.   (WHY we'd like CS3 to be the default for awhile i