Rick,

You need to set a dependency in each module that uses them on the /File Templates/ and /Base Utilities API/ libraries in order to use them.

Per your compiler output:

   
/home/rick/Projects/AdditionalFileTemplates/src/org/myorg/additionalfiletemplates/package-info.java:5:
   error: cannot find symbol
   @TemplateRegistration(
      symbol: class TemplateRegistration

You do not have a dependency on the /File Templates/ NetBeans API.

Per your compiler output:

   
/home/rick/Projects/AdditionalFileTemplates/src/org/myorg/additionalfiletemplates/package-info.java:12:
   error: cannot find symbol
   @Messages(value = "HTMLtemplate_displayName=Empty HTML file")
      symbol: class Messages

You do not have a dependency on the /Base Utilities API/.

When creating application or modules against the NetBeans Platform, you must be specific and explicit in your dependency declarations. To add these dependencies, click on the /Libraries/ node in the Projects window for each of the module projects that need to use these features and select /Add Module Dependency.../ In the field at the top of the dialog, type in "TemplateRegistration" and the list will filter down to only show the /File Templates/ module. Likewise, type in "NbBundle" or "NbBundle.Messages" and the list will filter down to /Base Utilities API/. Add each of those to your module and recompile. You should be fine then.

Also, it helps if, when you are asking for help, you include which version of NetBeans, which version of the JDK, and what build system you are using.

-SC

On 2/21/23 10:52 PM, Rick Tee wrote:
Hi,
I followed the template tutorial: https://netbeans.apache.org/tutorials/nbm-filetemplates.html

When I choose run i get:

warning: [options] bootstrap class path not set in conjunction with -source 1.7 warning: No processor claimed any of these annotations: TemplateRegistration,Messages /home/rick/Projects/AdditionalFileTemplates/src/org/myorg/additionalfiletemplates/package-info.java:15: error: package org.netbeans.api.templates does not exist
import org.netbeans.api.templates.TemplateRegistration;
/home/rick/Projects/AdditionalFileTemplates/src/org/myorg/additionalfiletemplates/package-info.java:16: error: package org.openide.util.NbBundle does not exist
import org.openide.util.NbBundle.Messages;
/home/rick/Projects/AdditionalFileTemplates/src/org/myorg/additionalfiletemplates/package-info.java:5: error: cannot find symbol
@TemplateRegistration(
  symbol: class TemplateRegistration
/home/rick/Projects/AdditionalFileTemplates/src/org/myorg/additionalfiletemplates/package-info.java:12: error: cannot find symbol
@Messages(value = "HTMLtemplate_displayName=Empty HTML file")
  symbol: class Messages
4 errors
1 warning
/usr/lib/apache-netbeans/harness/common.xml:207: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 1 second)

Attachment: OpenPGP_0xA195702ECF56996D.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to