Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Problem with Packages

  1. #1
    Junior Member
    Join Date
    Nov 2010
    Thanked 0 Times in 0 Posts

    Default Problem with Packages

    Hey guys.

    I'm having a weird problem with packages. I know the package exists however Java is giving me the "package does not exist" error.

    I used the exact same main in another .java outside the package "grt" (in which Grt.java is on) and it worked, so I don't understand what's wrong.

    The files are:

    MenuBuillder.java - package grt.textui.main
    Grt.java - package grt

    The proof that the package exists in /usr/share/java:

    Thanks a lot.
    Last edited by pirezas; November 12th, 2010 at 09:18 AM.

  2. #2
    Join Date
    May 2010
    North Central Illinois
    My Mood
    Thanked 112 Times in 110 Posts

    Default Re: Problem with Packages

    I think you have to go in and import it, not with an import statement, or something.

    Perhaps download it and put it in the same directory as your program(s).

    P.S., how do you save and load something? I've never gotten it to work right.

    I'm dying to know.

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Thanked 833 Times in 772 Posts
    Blog Entries

    Default Re: Problem with Packages

    The package doesn't exist as the compiler sees it. Is the java file in a package like directory structure? I'd recommend using an IDE to make things such as this MUCH easier

  4. The Following 2 Users Say Thank You to copeg For This Useful Post:

    javapenguin (November 12th, 2010), pirezas (November 12th, 2010)

  5. #4
    Junior Member
    Join Date
    Nov 2010
    Thanked 0 Times in 0 Posts

    Default Re: Problem with Packages

    I've through through "import grt.textui.main.Message" but it still doesn't work, the same error.

    Yes the java file is in a directory structure, grt/textui/main/Message.java and inside Message.java it's "package grt.textui.main".

    I don't believe the error is in that because I've tried the exact same code inside other class in the package grt.textui and it worked...

Similar Threads

  1. [SOLVED] Confuced when import packages...
    By Delmi in forum AWT / Java Swing
    Replies: 2
    Last Post: May 20th, 2010, 03:39 AM
  2. [SOLVED] placing packages of the same directory into an array
    By javanub:( in forum Java Theory & Questions
    Replies: 16
    Last Post: May 18th, 2010, 07:49 AM
  3. A Question Regarding Abstract Classes & Packages
    By Kerubu in forum Object Oriented Programming
    Replies: 3
    Last Post: December 21st, 2009, 01:27 PM
  4. importing packages..
    By chronoz13 in forum Java IDEs
    Replies: 4
    Last Post: November 23rd, 2009, 05:49 PM