. Advertisement .
..3..
. Advertisement .
..4..
I am working on java, but I found the following warning message:
error: Class names, 'EnumDevices', are only accepted if annotation
processing is explicitly requested
1 error
Is there any way to stabilize the issue “class names are only accepted if annotation processing is explicitly requested”? I read a lot of topics about this, but all of them were trying to install anything. Is this the correct way, or any recommendation for me? Please find the beginning command below:
import jcuda.CUDA;
import jcuda.driver.CUdevprop;
import jcuda.driver.types.CUdevice;
public class EnumDevices {
public static void main(String args[]) {
CUDA cuda = new CUDA(true);
int count = cuda.getDeviceCount();
System.out.println("Total number of devices: " + count);
for (int i = 0; i < count; i++) {
CUdevice dev = cuda.getDevice(i);
String name = cuda.getDeviceName(dev);
System.out.println("Name: " + name);
int version[] = cuda.getDeviceComputeCapability(dev);
System.out.println("Version: " +
String.format("%d.%d", version[0], version[1]));
CUdevprop prop = cuda.getDeviceProperties(dev);
System.out.println("Clock rate: " + prop.clockRate + " MHz");
System.out.println("Threads per block: " + prop.maxThreadsPerBlock);
}
}
}
javac -cp /home/manish.yadav/Desktop/JCuda-All-0.3.2-bin-linux-x86_64 EnumDevices
The cause: This error happens because you compile a java program without the
.java
extension.Solution: You can easily fix this problem by adding
.java
to the end of the file name and it would work.This was also a puzzle to me. I had included the.Java extension, but then I saw the capital J.
This will also lead to an “annotation processing error”
It should instead be: