• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Java 8 and Eclipse

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41125
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 75844
361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 75844
361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 75844
361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 75844
361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 75844
361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Turns out I needed to upgrade to version 4.4 of Luna. That fully supports Java 8.
 
The airline is called "Virgin"? Don't you want a plane to go all the way? This tiny ad will go all the way:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic