• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 622
  • Last Modified:

Code not compiling in eclipse

I am trying to set up an existing project in eclipse. After creating the project, when I open any of the source files, it gives me errors like

the type java.lang.String cannot be resolved. It is indirectly referenced from required .class files

Can someone please let me know what settngs do I need to make to have it compiled with Java. Java is already set is the Path environment variable of the system. I am able to execute Java commands from command prompt. Do I need to do something in eclispe as well?

Thank you
0
ank5
Asked:
ank5
3 Solutions
 
for_yanCommented:
0
 
cmalakarCommented:
check if you have JRE_SYSTEM_LIBRARY in build path.
0
 
CEHJCommented:
>>Java is already set is the Path environment variable of the system.

Try setting JAVA_HOME to the installation directory of the jdk
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
ank5Author Commented:
>>check if you have JRE_SYSTEM_LIBRARY in build path.

No it is not there. How do I add it?
0
 
for_yanCommented:
Hit "Add Library ...", Select "JRE System Library" and add the appropriate JRE for the project (eg. 'Workspace default JRE')

Hit "Finish" in the library selection and "OK" in the project properties and then wait for the re-build of the project

see link above
0
 
for_yanCommented:
Go to properties of project with the build error (right click > Properties)

View the "Libraries" tab in the "Build Path" section

Find the "JRE System Library" in the list (if this is missing then this error message is not an eclipse bug but a mis-configured project)

Remove the "JRE System Library"

Hit "Add Library ...", Select "JRE System Library" and add the appropriate JRE for the project (eg. 'Workspace default JRE')

Hit "Finish" in the library selection and "OK" in the project properties and then wait for the re-build of the project

Hopefully the error will be resolved ...

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now