• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin


Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had the following error when I try to compile a java program that have a System.nanoTime method:

TimerRes.java:96: cannot resolve symbol
symbol : method nanoTime ()
location: class java.lang.System
count1 = System.nanoTime();

I checked for the JRE and JDK installation and it seems to be correct:

J2SE Development Kit 5.0 Update 6
J2SE Runtime Environment 5.0 Update 6
Java 2 Runtime Environment, SE v1.4.2_10
Java 2 SDK, SE v1.4.2_10

I installed the Java 3D 1.3.2 by unzipping it into the jre directory version 1.5.

I cannot understand where is the problem....maybe the classpath?

I also verified that:

java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

really I noted that I don't have javac.exe program into my installation directory C:\java15.
Than I used the javac.exe of the 1.4 version from the C:\java14 directory.

Thanks for the help.
author and iconoclast
Posts: 24207
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Angelo,

Welcome to JavaRanch!

The nanoTime() method is new in Java 5 (also called JDK 1.5). Anything older won't recognize it, including JDK 1.4.

It's OK to have multiple versions of Java on one machine, but you do need to keep them straight, and make sure you know that the API you're using corresponds to the Java version of both the compiler and the runtime you're using. Finally, note that if you use this API (and even if you don't, but you compile with a JDK 1.5 compiler), your class files won't run on a JDK 1.4 runtime.

You need to find the JDK 1.5 installation directory, and use the javac.exe from there.
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic