Compiler Error J0265

@dll attribute cannot be placed on method 'identifier' — it must be declared 'native'

The compiler detected an @dll comment tag placed on a method that is not declared with the native modifier. This error usually occurs if an @dll comment tag is defined but the method it was applied to was removed or commented out, and other methods in the class can have the comment tag applied to them. Ensure that the method declared with the @dll comment tag is declared as native or remove the @dll comment tag and compile again.

The following example illustrates this error:

public class Simple{
   /** @dll.import("USER32") */
   //private native static int MessageBox(int hwndOwner, String text,
                                          String title, int fuStyle);
   
   /*error: the @dll comment tag cannot applied to 'method1' which is a
            non-native method instead of the intended native method*/
   public void method1(){
     //do something here
   }
}