I have the following very simple java file called test.java

import java.util.concurrent.RecursiveAction;

and when I run

javac test.java

I get the following error

test.java:1: cannot find symbol symbol : class RecursiveAction location: package java.util.concurrent import java.util.concurrent.RecursiveAction; ^ 1 error

and if I run java -version I get

java version "1.7.0_25"

also if I try javap -verbose anotherfile I get that

major=50

so it seems like a must be using java 6.

I'm probably missing something frustratingly silly nevertheless I can;t see what it is.

有帮助吗?

解决方案 2

More than likely you are using a JDK earlier than JDK 7 and a JRE that does actually use version 7 which is required for the class. Solution: install JDK 7 which should update the PATH environmental variable - remove the earlier JDK from the PATH

其他提示

java.util.concurrent.RecursiveAction was only introduced in JDK7 (see the @since annotation in the Javadoc), so if you were to compile your code against an earlier version of the JDK (6 or below) then you would get an error message like this.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top