• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java 8 and Eclipse  RSS feed

 
Paul Heubach
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since I updated to Java 8 from Java 6, Eclipse is showing me many errors

import java.util.*; has the error message, "the import java.util cannot be resolved".

String has the error message, "String cannot be resolved to a type".

System.out.print("\n\n"); has the error message, "System cannot be resolved". (Only System is underlined in red in my eclipse code).

I have similar errors for StringBuilder, Calendar, and GregorianCalendar.

I appreciate any help you can give.

Thank you.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37496
540
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like Eclipse can't find Java. Try going to the Eclipse preferences and then Java > Installed JREs.

I'm guessing your JDK isn't in the list so click add and enter the location of it.
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also tell us how you installed Java® and Eclipse, and what OS you are using.
 
Paul Heubach
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am operating on a PC windows 7 professional

On the C drive: C:\Program Files\Java\jre1.8.0_45

There is another folder on the C drive: C:\Program Files (x86)\Java
It has the jre listed above along with: jdk1.6.0_21 from August, 2010

I have two eclipse programs, The old one is from January, 2012
The newer eclipse is from June, 2013.
Both eclipses' Java Installed JREs point to the newer Java.

The old eclipse program has the errors mentioned previously.

The new eclipse does not have errors but will not run.
Build failed Reason: Unable to find an Ant File to run.

Thank you.
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not being able to find the Ant file sounds like a different problem.

Stop using the 6_21 JRE; it is (probably dangerously) out of date. Use JDK1.8_0_45; you would appear to have the latest version installed already. Verify the installation by writing
java -version
and
javac -version
at the command prompt. Both versions should have 1.8.0_45 in. You must have a correct installation somewhere before you try to run Eclipse.
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you run Eclipse with only a JRE and not a JDK?

I am going to duplicate this discussion in our IDES forum. Edit: already in the IDEs forum.
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Eclipse installation instructions say you need a JRE but they recommend a JDK for development work.
Tell us the output from javac -version, please. That will distinguish a JDK from a JRE.
 
Steve Beckle
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having similar problems. I've updated my jdk in Eclipse (luna) to 1.8.0_45. For some reason Eclipse does not like "import java.util.Comparator", and in the package explorer, shows that class to be empty. Yet when I look at that class in 7zip, by looking inside the jre library rt.jar, it looks fine, and I can compile a simple .java file with that import statement when I run javac from the command line in DOS. Also, when I go to Window/Preferences/Java/Compiler in Eclipse, my choice for Compiler Compliance Level only goes as high as 1.7. Why wouldn't 1.8 show up since that's my most recent JDK?
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

What happens when you run a simple program from the command line (even hello world)?
What are the responses to the following instructions at the command line?
java -version
javac -version
 
Steve Beckle
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Turns out I needed to upgrade to version 4.4 of Luna. That fully supports Java 8.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!