Redhat 7.9
Netbeans 16
JDK 1.8

From the Netbeans templates tutorial: "Right-click the module in the Projects window, choose Properties, and use the Libraries tab to add dependencies on Datasystems API and Utilities API."

I followed the tutorial twice from scratch the result is the same.

Looking through the project the file causing errors is: package-info.java. Errors are:

Cannot find symbol class TemplateRegistration
Cannot find symbol class Messages
Package org.netbeans.api.templates does not exist
Package org.openide.util.NbBundle does not exist

Something missing from the installation? or error/s in the tutorial?

Apologies for the replies to wrong address.

On 23/02/2023 04:42, Sean Carrick wrote:
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)



--
Regards
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to