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-environment.asciidoc 9.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. ---
  2. title: Setting up the Development Environment
  3. order: 2
  4. layout: page
  5. ---
  6. [[getting-started.environment]]
  7. = Setting up the Development Environment
  8. This section guides you step-by-step in setting up a reference development
  9. environment. Vaadin supports a wide variety of tools, so you can use any IDE for
  10. writing the code, almost any Java web server for deploying the application, most
  11. web browsers for using it, and any operating system platform supported by Java.
  12. In this example, we use the following toolchain:
  13. * Windows, Linux, or Mac OS X
  14. * link:http://www.oracle.com/technetwork/java/javase/downloads/index.html[Oracle Java SE 8] (Java 6 or newer is required)
  15. * link:http://www.eclipse.org/downloads/[Eclipse IDE for Java EE Developers]
  16. * link:http://tomcat.apache.org/[Apache Tomcat 8.0 (Core)]
  17. * link:http://www.getfirefox.com/[Mozilla Firefox] browser
  18. * link:http://www.getfirebug.com/[Firebug] debug tool (optional)
  19. * link:http://vaadin.com/download/[Vaadin Framework]
  20. The above reference toolchain is a good choice of tools, but you can use almost
  21. any tools you are comfortable with.
  22. We recommend using Java 8 for Vaadin development, but you need to make sure that
  23. your entire toolchain supports it. A server supporting Servlet 3.0 is
  24. recommended. It is required for using Vaadin CDI, for which also a CDI container
  25. is required, a standard feature in Java EE 6 or newer servers. It is also
  26. required by the Vaadin Spring add-on. Server push can benefit from using
  27. communication modes, such as WebSocket, enabled by features in some latest
  28. servers. For Java EE containers, at least Wildfly, Glassfish, and Apache TomEE
  29. Web Profile are recommended.
  30. [[figure.toolchain]]
  31. .Development Toolchain and Process
  32. image::img/toolchain-hi.png[]
  33. <<figure.toolchain>> illustrates the development toolchain. You develop your
  34. application as an Eclipse project. The project must include, in addition to your
  35. source code, the Vaadin libraries. It can also include project-specific themes.
  36. You need to compile and deploy a project to a web container before you can use
  37. it. You can deploy a project through the Web Tools Platform (WTP) for Eclipse
  38. (included in the Eclipse EE package), which allows automatic deployment of web
  39. applications from Eclipse. You can also deploy a project manually, by creating a
  40. web application archive (WAR) and deploying it to the web container.
  41. [[getting-started.environment.java]]
  42. == Installing Java SDK
  43. Java SDK is required by Vaadin and also by the Eclipse IDE. Vaadin is compatible
  44. with Java 1.6 and later editions. Java EE 7 is required for proper server push
  45. support with WebSockets.
  46. [[getting-started.environment.java.windows]]
  47. === Windows
  48. . Download Oracle Java SE 8.0 from
  49. link:http://www.oracle.com/technetwork/java/javase/downloads/index.html[http://www.oracle.com/technetwork/java/javase/downloads/index.html]
  50. . Install the Java SDK by running the installer. The default options are fine.
  51. [[getting-started.environment.linux]]
  52. === Linux / UNIX
  53. Most Linux systems either have JDK preinstalled or allow installing it through a
  54. package management system. Notice however that they have OpenJDK as the default
  55. Java implementation. While it is known to have worked with Vaadin and possibly
  56. also with the development toolchain, we do not especially support it.
  57. Regarding OS X, notice that JDK 1.6 or newer is included in OS X 10.6 and newer.
  58. Otherwise:
  59. . Download Oracle Java SE 8.0 from
  60. link:http://www.oracle.com/technetwork/java/javase/downloads/index.html[http://www.oracle.com/technetwork/java/javase/downloads/]
  61. . Decompress it under a suitable base directory, such as [filename]#/opt#. For
  62. example, for Java SDK, enter (either as root or with [command]#sudo# in Linux):
  63. +
  64. [subs="normal"]
  65. ----
  66. [prompt]#+++#+++# [command]#cd# [replaceable]#/opt#
  67. [prompt]#+++#+++# [command]#sh# [replaceable]##<path>##/jdk-[replaceable]##<version>##.bin
  68. ----
  69. +
  70. and follow the instructions in the installer.
  71. . Set up the [literal]#++JAVA_HOME++# environment variable to point to the Java
  72. installation directory. Also, include the [literal]#++$JAVA_HOME/bin++# in the
  73. [literal]#++PATH++#. How you do that varies by the UNIX variant. For example, in
  74. Linux and using the Bash shell, you would add lines such as the following to the
  75. [filename]#.bashrc# or [filename]#.profile# script in your home directory:
  76. +
  77. ----
  78. export JAVA_HOME=/opt/jdk1.8.0_31
  79. export PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
  80. ----
  81. +
  82. You could also make the setting system-wide in a file such as
  83. [filename]#/etc/bash.bashrc#, [filename]#/etc/profile#, or an equivalent file.
  84. If you install Apache Ant or Maven, you may also want to set up those in the
  85. path.
  86. +
  87. Settings done in a [filename]#bashrc# file require that you open a new shell
  88. window. Settings done in a [filename]#profile# file require that you log in into
  89. the system. You can, of course, also give the commands in the current shell.
  90. [[getting-started.environment.eclipse]]
  91. == Installing Eclipse IDE
  92. === Windows
  93. . Download the Eclipse IDE for Java EE Developers from
  94. link:http://www.eclipse.org/downloads/[http://www.eclipse.org/downloads/]
  95. . Decompress the Eclipse IDE package to a suitable directory. You are free to
  96. select any directory and to use any ZIP decompressor, but in this example we
  97. decompress the ZIP file by just double-clicking it and selecting "Extract all
  98. files" task from Windows compressed folder task. In our installation example, we
  99. use [filename]#C:\dev# as the target directory.
  100. Eclipse is now installed in [filename]#C:\dev\eclipse#.
  101. You can start it from there by double clicking [filename]#eclipse.exe#.
  102. === Linux / OS X / UNIX
  103. We recommend that you install Eclipse manually in Linux and other UNIX variants.
  104. They may have it available from a package repository, but using such an installation may cause problems with installing plug-ins.
  105. You can install Eclipse as follows:
  106. . Download Eclipse IDE for Java EE Developers from
  107. link:http://www.eclipse.org/downloads/[http://www.eclipse.org/downloads/]
  108. . Decompress the Eclipse package into a suitable base directory. It is important
  109. to make sure that there is no old Eclipse installation in the target directory.
  110. Installing a new version on top of an old one probably renders Eclipse unusable.
  111. . Eclipse should normally be installed as a regular user, which makes installation of plug-ins easier.
  112. Eclipse also stores some user settings in the installation directory.
  113. +
  114. To install the package, enter:
  115. +
  116. [subs="normal"]
  117. ----
  118. [prompt]#$# [command]#tar# zxf [replaceable]##<path>##/eclipse-jee-[replaceable]##<version>##.tar.gz
  119. ----
  120. +
  121. This will extract the package to a subdirectory with the name
  122. [filename]#eclipse#.
  123. . If you wish to enable starting Eclipse from command-line, you need to add the
  124. Eclipse installation directory to your system or user PATH, or make a symbolic
  125. link or script to point to the executable.
  126. An alternative to the above procedure would be to use an Eclipse version
  127. available through the package management system of your operating system. It is,
  128. however, __not recommended__, because you will need write access to the Eclipse
  129. installation directory to install Eclipse plugins, and you may face
  130. incompatibility issues with Eclipse plugins installed by the package management
  131. of the operating system.
  132. [[getting-started.environment.tomcat]]
  133. == Installing Apache Tomcat
  134. Apache Tomcat is a lightweight Java web server suitable for both development and
  135. production. There are many ways to install it, but here we simply decompress the
  136. installation package.
  137. __Apache Tomcat should be installed with user permissions.__ During development,
  138. you will be running Eclipse or some other IDE with user permissions, but
  139. deploying web applications to a Tomcat server that is installed system-wide
  140. requires administrator or root permissions.
  141. . Download the installation package:
  142. +
  143. Apache Tomcat 8.0 (Core Binary Distribution) from http://tomcat.apache.org/
  144. . Decompress Apache Tomcat package to a suitable target directory, such as
  145. [filename]#C:\dev# (Windows) or [filename]#/opt# (Linux or Mac OS X). The Apache
  146. Tomcat home directory will be [filename]#C:\dev\apache-tomcat-8.0.x# or
  147. [filename]#/opt/apache-tomcat-8.0.x#, respectively.
  148. [[getting-started.environment.firefox]]
  149. == Firefox and Firebug
  150. Vaadin supports many web browsers and you can use any of them for development.
  151. If you plan to create a custom theme, customized layouts, or create new
  152. components, we recommend that you use either Firefox together with Firebug or
  153. Google Chrome, which has built-in developer tools similar to Firebug.
  154. [[getting-started.environment.firefox.firebug]]
  155. === Using Firebug with Vaadin
  156. After installing Firefox, use it to open
  157. link:http://www.getfirebug.com/[http://www.getfirebug.com/]. Follow the
  158. instructions on the site to install the latest stable version of Firebug
  159. available for the browser. You may need to allow Firefox to install the plugin
  160. by clicking the yellow warning bar at the top of the browser window.
  161. After Firebug is installed, it can be enabled at any time from the Firefox
  162. toolbar. <<figure.firebug.calc>> shows Firebug in action.
  163. [[figure.firebug.calc]]
  164. .Firebug Debugger for Firefox
  165. image::img/firebug.png[]
  166. The most important feature in Firebug is inspecting HTML elements. Right-click
  167. on an element and select [guilabel]#Inspect Element with Firebug# to inspect it.
  168. In addition to HTML tree, it also shows the CSS rules matching the element,
  169. which you can use for building themes. You can even edit the CSS styles live, to
  170. experiment with styling.