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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 5 of 5

Thread: Basic Java help in Eclipse

  1. #1
    Junior Member
    Join Date
    May 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Basic Java help in Eclipse

    I am taking an intro class to Java programming. All I need to do, is replicate the exact code that my professor has. As simple as I thought this would be (who was I kidding?), I am still having trouble. I am using Eclipse IDE for Java Developers (It is what my professor told us to use). The error I am getting on the first line states: the declared package does not match the expected package. How do I see what the expected package is?


    Screen Shot.jpg

    Can anyone recommend a video tutorial on the basics of the basics for Eclipse? My only experience is the very fundamentals of C++ where I used X-Code.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Basic Java help in Eclipse

    Moved to IDE section.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    May 2014
    Location
    Chennai
    Posts
    9
    My Mood
    Cool
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Basic Java help in Eclipse

    Hello, it means that the package that you have mentioned in your code is not the exact location where your java program resides. Kindly check both and correct the declaration in your program code.

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Basic Java help in Eclipse

    Welcome to the Forum! Please read this topic to learn how to post code correctly and other useful tips for newcomers.

    Though you should understand how to use your tools and why you're getting this error, Eclipse will fix it for you, if you let it. The reason you're getting the error is because you've stored the code in a location not described by the project and package name, probably in the project's default /src folder. To get Eclipse to fix the error for you, HOVER over the package name, review the correction options that come up, and select one of them. If you are required to use the package name, then the correction option you should select should say something like "fix package structure", or "save source in new package", etc. I forget exactly what it says.

    There are hundreds, probably thousands of Eclipse "getting started" tutorials that pretty much all say the same thing. Getting started can only cover so much. I don't watch video tutorials, so I'm not sure how many of those you'll find, but I'm sure they are out there. The Eclipse Wiki is also an excellent source of info, but you'll actually have to read the wiki.

  5. #5
    Junior Member
    Join Date
    May 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Re: Basic Java help in Eclipse

    Thank you!

    For some reason, as soon as I re-opened Eclipse it seemed to have fixed itself. I will definitely take a look at the wiki and tutorial videos.

Similar Threads

  1. Basic GUI (eclipse swing)
    By klskl in forum Object Oriented Programming
    Replies: 20
    Last Post: November 17th, 2013, 04:50 PM
  2. Beginners Eclipse Tutorial. How to run first java application on Eclipse?
    By JavaPF in forum Java Code Snippets and Tutorials
    Replies: 13
    Last Post: June 24th, 2011, 12:26 AM
  3. help us in eclipse basic codes
    By bil_Imma in forum AWT / Java Swing
    Replies: 1
    Last Post: January 24th, 2009, 06:02 PM