Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
10.2k views
by
I just created a Selenium Java project and moved it to the new location.

I am getting below error in my code:

The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

1 Answer

0 like 0 dislike
by The go-to Tester (222 points)

Above error shows up when you do not have JRE or JDK not added to your build path. This is the well-known bug with Eclipse.

The possible solution is

  1. Close the project and reopen it.
  2. Clean the project (It will rebuild the build path hence reconfiguring with the JDK libraries  OR
  3. Delete and Re-import the project and if necessary do the above steps again

If above steps do not work, you can add workspace default JRE as below.

  • Right-click on project » Properties » Java Build Path
  • Select Libraries tab
  • Find the JRE System Library and remove it
  • Click Add Library... button at right side » Add the JRE System Library (Workspace default JRE)

You can even include custom JDK you have installed on your OS as below.

  1. Right-click your project > properties
  2. Select “Java Build Path” on left, then “JRE System Library”, click Edit…
  3. Select "Workspace Default JRE"
  4. Click "Installed JREs"
  5. If you see JRE you want in the list select it (selecting a JDK is OK too)
  6. If not, click Search…, navigate to Computer > Windows C: > Program Files > Java, then click OK
  7. Select the one you want and click OK/Finish

Now you should see all installed JREs, select the one you want


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...