Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The import java.xxx cannot be resolved and String cannot be resolved to a type

 
Raymond Gillespie
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I open Eclipse this morning and none of the normal java imports cannot be resolved. It is was something external that I downloaded and added a jar file, it is not giving the error. I am also getting an error for Strings (String cannot be resolved to a type).

Anyone know what is going on with my Eclipse. Everything was find yesterday. When I left, I closed Eclipse and shutdown the computer.

So far any searching I have done has only resulted in explanations regarding imported jar files.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48976
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know.
Have you tried running your app from the command line?
What is your system PATH? Where have you installed Java®? Which version? Does Eclipse support Java8?
Where are you putting those other files you want to import?
 
Raymond Gillespie
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Don't know.
Have you tried running your app from the command line?
What is your system PATH? Where have you installed Java®? Which version? Does Eclipse support Java8?
Where are you putting those other files you want to import?


I have not tried running it from the command line. I have never tried that in fact.

System PATH to what?

Java looks like it is installed C:/Progam Files/Java and is version 7. I don't know if Eslipse supports Java8 or not but since I don't have that, would it matter?

The external jar files that are imported are in the WebContent/WEB-INF folder. Again, there are not the issue. It's all the internal stuff.

I did try setting a new Jave EE project and the same problem occured although when I create a regular Java project it worked fine.

 
Marshall Blythe
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right-click on your errant project in Eclipse and choose Properties --> Build Path from the menu, then click on the "Libraries" tab. Do you see a JRE system library listed there? If not then that could explain the problem, and you'll need to add the missing library for your chosen JRE. Why did this suddenly stop working? I dunno- Eclipse can be a trying and fickle beast at times.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48976
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have never found Eclipse fickle, but I tried after posting and it still seems not to support Java8. As you say, that is not an issue if you don't actually have Java8. If you can't sort it out by setting the JRE location for the project, can you run anything from the command line?
 
Raymond Gillespie
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So just to let you guys know what happened, my company did an update and updated my version of Java from 6 to 7, which was not compatible with what I was working on. I had to reinstall version 6 to get everything working again.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48976
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surely Java7 is compatible because Java® always supports backwards compatibility.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:I have never found Eclipse fickle, but I tried after posting and it still seems not to support Java8. As you say, that is not an issue if you don't actually have Java8. If you can't sort it out by setting the JRE location for the project, can you run anything from the command line?

I was reading a recently released book yesterday and it said that Eclipse is normally a few months behind when supporting new releases. Eclipse Luna will support Java 8 and its release date appears to be late June.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34422
347
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joanne Neal wrote:and its release date appears to be late June.

More than "appears to be" . Eclipse has been very good at meeting their annual release train date. The release candidate is available now if someone wants to try it earlier than late June.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic