Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

My Eclipse Doesn't Behave the Same Way

2013-10-06
2013-10-06
  • Mike McGuire
    Mike McGuire
    2013-10-06

    These tutorials are just what I'm looking for, but I'm getting frustrated right off the bat. Note: I'm using Kepler if that matters (it shouldn't at this level), I don't appear to be able to attach screenshots or files, but perhaps this copy of error messages will help. In lesson 2, while attempting to use the scrapbook feature, I typed in 2+2 mimicking the tutorial and got this:

    Override cannot be resolved to a type
    Throwable cannot be resolved to a type
    Code snippet support cannot find the class java.lang.Class
    The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
    The type java.lang.Throwable cannot be resolved. It is indirectly referenced from required .class files
    The type java.lang.Class cannot be resolved. It is indirectly referenced from required .class files
    2+2

    I'm also getting errors on various lines, even though my screen exactly matches the tutorial. For example, in this section:

    // constructors
        public Person()
        {
            name = "unknown name";
            maximumBooks = 3;
        }
    

    I get an error on the public Person() line than reads: Implicit super constructor Object() is undefined. Must explicitly invoke another constructor.

    On the name = "unknown name"; line, the error message reads: String cannot be resolved to a type.

    Can anyone see what I"m doing wrong? I feel as though I'm following the tutorial perfectly, but I'm obviously missing something.

     
    • Mike McGuire
      Mike McGuire
      2013-10-06

      Solved - here's how:

      I installed 1.7 on my MacBook and also did the following trick, which I found when searching about how to set up Eclipse on a Mac (http://stackoverflow.com/questions/14341865/how-to-install-jre-1-7-on-mac-os-x-and-use-it-with-eclipse):

      You need to tell Eclipse which JDK/JRE's you have installed and where they are located.

      This is somewhat burried in the Eclipse preferences: In the Window-Menu select "Preferences". In the Preferences Tree, open the Node "Java" and select "Installed JRE's". Then click on the "Add"-Button in the Panel and select "Standard VM", "Next" and for "JRE Home" click on the "Directory"-Button and select the top level folder of the JDK you want to add.