aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes The import java.xxx cannot be resolved and String cannot be resolved to a type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "The import java.xxx cannot be resolved and String cannot be resolved to a type" Watch "The import java.xxx cannot be resolved and String cannot be resolved to a type" New topic
Author

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

Raymond Gillespie
Ranch Hand

Joined: Oct 08, 2012
Posts: 132
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

Joined: Oct 13, 2005
Posts: 39409
    
  28
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

Joined: Oct 08, 2012
Posts: 132
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

Joined: Feb 26, 2013
Posts: 32
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

Joined: Oct 13, 2005
Posts: 39409
    
  28
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

Joined: Oct 08, 2012
Posts: 132
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

Joined: Oct 13, 2005
Posts: 39409
    
  28
Surely Java7 is compatible because Java® always supports backwards compatibility.
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3669
    
  15
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.

Joanne
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
jQuery in Action, 2nd edition
 
subject: The import java.xxx cannot be resolved and String cannot be resolved to a type