You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

getting-started-netbeans.asciidoc 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. ---
  2. title: Creating a Project in NetBeans
  3. order: 110
  4. layout: page
  5. ---
  6. [[getting-started.netbeans]]
  7. = Creating a Project with the NetBeans IDE
  8. In the following, we walk you through the creation of a Vaadin project in NetBeans and show how to run it.
  9. Installation of NetBeans and the Vaadin plugin is covered in <<../installing/installing-netbeans#installing.netbeans, "Installing the NetBeans IDE and Plugin">>.
  10. Without the plugin, you can most easily create a Vaadin project as a Maven
  11. project using a Vaadin archetype. You can also create a Vaadin project as a
  12. regular web application project, but it requires many manual steps to install
  13. all the Vaadin libraries, create the UI class, configure the servlet, create
  14. theme, and so on.
  15. [[getting-started.netbeans.creating]]
  16. == Creating a Project
  17. . Select "File > Net Project..." from the main menu or press kbd:[Ctrl+Shift+N].
  18. . In the [guilabel]#New Project# window that opens, select the [guilabel]#Vaadin# category and one of the Vaadin archetypes from the right.
  19. +
  20. image::img/netbeans-newproject-1.png[width=80%, scaledwidth=100%]
  21. +
  22. The archetypes are described in more detail in <<getting-started-archetypes#getting-started.archetypes, "Overview of Maven Archetypes">>.
  23. . In the [guilabel]#Name and Location# step, enter the project parameters.
  24. +
  25. image::img/netbeans-newproject-2.png[width=80%, scaledwidth=100%]
  26. [guilabel]#Project Name#:: A project name.
  27. The name must be a valid identifier that may only contains alphanumerics, minus, and underscore.
  28. It is appended to the group ID to obtain the Java package name for the sources.
  29. [guilabel]#Project Location#::
  30. Path to the folder where the project is to be created.
  31. [guilabel]#Group Id#:: A Maven group ID for your project.
  32. It is normally your organization domain name in reverse order, such as `com.example`.
  33. The group ID is also used as a prefix for the Java source package, so it should be Java-compatible package name.
  34. [guilabel]#Version#:: Initial version of your application.
  35. The number must obey the Maven version numbering format.
  36. [guilabel]#Package#:: The Java package name to put sources in.
  37. [guilabel]#Additional Creation Properties#::
  38. The properties control various names.
  39. They are specific to the archetype you chose.
  40. +
  41. Click [guibutton]#Finish#.
  42. Creating the project can take a while as Maven loads all the needed
  43. dependencies.
  44. [[getting-started.netbeans.exploring]]
  45. == Exploring the Project
  46. The project wizard has done all the work for you: a UI class skeleton has been written to the [filename]#src# directory.
  47. The project hierarchy shown in the Project Explorer is shown in <<figure.getting-started.netbeans.exploring>>.
  48. [[figure.getting-started.netbeans.exploring]]
  49. .A new Vaadin project in NetBeans
  50. image::img/netbeans-created-annotated-hi.png[width=80%, scaledwidth=100%]
  51. [filename]#mytheme#::
  52. The theme of the UI.
  53. See <<../themes/themes-overview#themes.overview, "Themes">> for information about themes.
  54. [filename]#MyUI.java#::
  55. The UI class, which is the main entry-point of your application.
  56. See <<../application/application-overview#application.overview, "Server-Side Applications">> for information about the basic structure of Vaadin applications.
  57. The Vaadin libraries and other dependencies are managed by Maven.
  58. Notice that the libraries are not stored under the project folder, even though they are listed in the "Java Resources > Libraries > Maven Dependencies" virtual folder.
  59. [[getting-started.netbeans.running]]
  60. == Running the Application
  61. Once created, you can run it in a server as follows.
  62. . In [guilabel]#Projects# tab, select the project and click in the [guilabel]#Run Project# button in the tool bar (or press kbd:[F6]).
  63. . In the [guilabel]#Select deployment server# window, select a server from the [guilabel]#Server# list.
  64. It should show either GlassFish or Apache Tomcat or both, depending on what you chose in NetBeans installation.
  65. +
  66. image::img/netbeans-server.png[width=75%, scaledwidth=100%]
  67. +
  68. Also, select [guilabel]#Remember Permanently# if you want to use the same server also in future while developing applications.
  69. +
  70. Click [guibutton]#OK#.
  71. The widget set will be compiled at this point, which may take a while.
  72. If all goes well, NetBeans starts the server in port 8080 and, depending on your
  73. system configuration, launches the default browser to display the web
  74. application. If not, you can open it manually, for example, at
  75. http://localhost:8080/myproject. The project name is used by default as the
  76. context path of the application.
  77. Now when you edit the UI class in the source editor and save it, NetBeans will automatically redeploy the application. After it has finished after a few seconds, you can reload the application in the browser.