Package does not exist

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • akas
    New Member
    • Mar 2007
    • 2

    Package does not exist

    frnds i have been working in java for 10 months ...

    still a basic question is irritating me .....

    i have a simple code like this .....

    c:\jdk1.3\bin\p ack>

    package pack;

    public class one
    {
    public void disp()
    {
    System.out.prin tln("Welcome");
    }
    }

    An another files contain

    c:\jdk1.3\bin\p ack1>

    package pack1;

    import pack.one;
    public class two
    {
    public static void main(String ar[])
    {
    one o = new one();
    o.display();
    }
    }

    c:\jdk1.3\bin\p ack1>javac two.java

    it display 4 Errors in stmt.....

    1.Package does not exits----->package.pack
    2. cannot resolve the symbol
    3.cannot resolve the symbol

    please help me...
    and ..thanks
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Question is being moved to the Java forum.

    ADMIN

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Originally posted by akas
      frnds i have been working in java for 10 months ...

      still a basic question is irritating me .....

      i have a simple code like this .....

      c:\jdk1.3\bin\p ack>

      package pack;

      public class one
      {
      public void disp()
      {
      System.out.prin tln("Welcome");
      }
      }

      An another files contain

      c:\jdk1.3\bin\p ack1>

      package pack1;

      import pack.one;
      public class two
      {
      public static void main(String ar[])
      {
      one o = new one();
      o.display();
      }
      }

      c:\jdk1.3\bin\p ack1>javac two.java

      it display 4 Errors in stmt.....

      1.Package does not exits----->package.pack
      2. cannot resolve the symbol
      3.cannot resolve the symbol

      please help me...
      and ..thanks
      I have seen this before. Why are you storing your programs in the java directories? You can store your programs in My Documents or anywhere else and be able to run them by specifying the classpath.

      Did you compile one first? Have also set up the correct directory structure for the classpath?

      Comment

      • akas
        New Member
        • Mar 2007
        • 2

        #4
        Thanks for ur Reply....
        Please help me..
        Same errors occur in other Dir....

        how to set classpath....

        Comment

        • r035198x
          MVP
          • Sep 2006
          • 13225

          #5
          Originally posted by akas
          Thanks for ur Reply....
          Please help me..
          Same errors occur in other Dir....

          how to set classpath....
          Just search for it here on TSDN. The question has been asked many times before.

          Comment

          • Ndia
            New Member
            • Apr 2007
            • 1

            #6
            Originally posted by akas
            frnds i have been working in java for 10 months ...

            still a basic question is irritating me .....

            i have a simple code like this .....

            c:\jdk1.3\bin\p ack>

            package pack;

            public class one
            {
            public void disp()
            {
            System.out.prin tln("Welcome");
            }
            }

            An another files contain

            c:\jdk1.3\bin\p ack1>

            package pack1;

            import pack.one;
            public class two
            {
            public static void main(String ar[])
            {
            one o = new one();
            o.display();
            }
            }

            c:\jdk1.3\bin\p ack1>javac two.java

            it display 4 Errors in stmt.....

            1.Package does not exits----->package.pack
            2. cannot resolve the symbol
            3.cannot resolve the symbol

            please help me...
            and ..thanks
            i have a project in designing the programme that execute exactly as microft wordprocessing

            Comment

            • r035198x
              MVP
              • Sep 2006
              • 13225

              #7
              Originally posted by Ndia
              i have a project in designing the programme that execute exactly as microft wordprocessing
              Start your own thread for it but read the guidelines first.

              Comment

              • MUTHU81
                New Member
                • Apr 2007
                • 1

                #8
                Originally posted by akas
                frnds i have been working in java for 10 months ...

                still a basic question is irritating me .....

                i have a simple code like this .....

                c:\jdk1.3\bin\p ack>

                package pack;

                public class one
                {
                public void disp()
                {
                System.out.prin tln("Welcome");
                }
                }

                An another files contain

                c:\jdk1.3\bin\p ack1>

                package pack1;

                import pack.one;
                public class two
                {
                public static void main(String ar[])
                {
                one o = new one();
                o.display();
                }
                }

                c:\jdk1.3\bin\p ack1>javac two.java

                it display 4 Errors in stmt.....

                1.Package does not exits----->package.pack
                2. cannot resolve the symbol
                3.cannot resolve the symbol

                please help me...
                and ..thanks
                WHERE U MENTION TWOCLASS

                Comment

                • rommelsharma
                  New Member
                  • Apr 2007
                  • 1

                  #9
                  1. Create a directory structure outside JDKs dir structure, as JDKs dir structure has a certain format and the JVM reads it for certain reasons (like bootstrap and java extensions classloading etc)
                  (FYR-Take a look at:
                  http://java.sun.com/docs/books/tutorial/ext/basics/load.html)

                  2. Include the parent dir. of your package in the classpath, for example if you have your class that follows the package structure as myjava.util.MyC lass

                  and the myjava directory is under C:\java\testcod e, then in the classpath include C:\java\testcod e, so that all packages under it are available.

                  3. It will help you if you use the right coding conventions from the beginning, for example, start the Class name with a Capital letter (e.g MyClass and not myclass), and use your method names starting with a small letter (e.g getData() and not Getdata() )

                  Happy learning, and enjoy!
                  Rommel Sharma.

                  Comment

                  Working...