Java EE 7 教程 第一部分 简介 第2章 使用教程示例 第2.1节 需要的软件

原文:http://docs.oracle.com/javaee/7/tutorial/doc/usingexamples001.htm
翻译:石卓林 shizhuolin@hotmail.com

2.1 Required Software

The following software is required to run the examples:

  • Java Platform, Standard Edition
  • Java EE 7 Software Development Kit
  • Java EE 7 Tutorial Component
  • NetBeans IDE
  • Apache Maven

2.1 需要的软件

以下是运行示例需要的软件:

  • Java平台,标准版
  • Java EE 7软件开发工具包
  • Java EE 7教程组件
  • NetBeans IDE
  • Apache Maven

2.1.1 Java Platform, Standard Edition

To build, deploy, and run the examples, you need a copy of the Java Platform, Standard Edition 7 Development Kit (JDK 7). Some distributions of the Java EE 7 SDK include JDK 7. You can download JDK 7 software separately from http://www.oracle.com/technetwork/java/javase/downloads/index.html.

2.1.1 Java平台,标准版

要构建,部署和运行此示例, 你需要一个Java平台副本, 标准版 7开发工具包(JDK 7). 在一些Java EE 7 SDK发行版中包含JDK 7. 你可以在http://www.oracle.com/technetwork/java/javase/downloads/index.html单独下载JDK7.

2.1.2 Java EE 7 Software Development Kit

GlassFish Server Open Source Edition 4 is targeted as the build and runtime environment for the tutorial examples. To build, deploy, and run the examples, you need a copy of GlassFish Server and, optionally, NetBeans IDE. To obtain GlassFish Server, you must install the Java EE 7 Software Development Kit (SDK), which you can download from http://www.oracle.com/technetwork/java/javaee/downloads/index.html. Make sure that you download the Java EE 7 SDK, not the Java EE 7 Web Profile SDK. There are distributions of the Java EE 7 SDK with and without the Java Platform, Standard Edition 7 Development Kit.

2.1.2 Java EE 7软件开发工具包

GlassFish服务器开源版4是针对本示例的构建和运行环境.要构建,部署和运行本示例, 你需要一份GlassFish服务器副本和可选的NetBeans IDE. 要获得GlassFish服务器,你必须安装Java EE 7软件开发工具包(SDK), 你可以在 http://www.oracle.com/technetwork/java/javaee/downloads/index.html 下载这些软件. 确认你下载的是Java EE 7 SDK而不是Java EE 7 Web Profile SDK. 这些是Java EE 7 SDK发行而不是Java平台标准版7软件开发包.

2.1.2.1 SDK Installation Tips

Do the following during the installation of the SDK.

  • Allow the installer to download and configure the Update Tool. If you access the Internet through a firewall, provide the proxy host and port.
  • Configure the GlassFish Server administration user name as admin, and specify no password. This is the default setting.
  • Accept the default port values for the Admin Port (4848) and the HTTP Port (8080).
  • Do not select the check box to create an operating system service for the domain.

You can leave the check box to start the domain after creation selected if you wish, but this is not required.

This tutorial refers to as-install-parent, the directory where you install GlassFish Server. For example, the default installation directory on Microsoft Windows is C:\glassfish4, so as-install-parent is C:\glassfish4. GlassFish Server itself is installed in as-install, the glassfish directory under as-install-parent. So on Microsoft Windows, as-install is C:\glassfish4\glassfish.

After you install GlassFish Server, add the following directories to your PATH to avoid having to specify the full path when you use commands:

as-install-parent/bin

as-install/bin

2.1.2.1 SDK安装提示

在SDK安装过程中注意下几点.

  • 允许安装程序下载和配置更新工具. 如果你通过防火墙访问internet,可能需要提供代理主机和端口.
  • 配置GlassFish服务器管理用户名为admin且不设置密码. 这是默认设置.
  • 同意Admin端口(4848)和HTTP端口(8080)的默认端口值.
  • 不要选择复选框以免为域创建操作系统服务.

如果你想要的话,你可以在启动域后选中创建复选筐,但这不是必须的.

本教程被放到as-install-parent中, 此目录就是你安装GlassFish服务器的地方.例如,在Microsoft Windows上默认安装目录是C:\glassfish4, 所有 as-install-parent 就是 C:\glassfish4. GlassFish服务器自己被安装到as-install中, glassfish目录在as-install-parent内. 所有在Microsoft Windows上as-install就是C:\glassfish4\glassfish.

安装GlassFish服务器后, 添加以下目录到你的PATH中,以避免你使用命令时需要输入全部的路径:

as-install-parent/bin

as-install/bin

2.1.3 Java EE 7 Tutorial Component

The tutorial example source is contained in the tutorial component. To obtain the tutorial component, use the Update Tool.

2.1.3 Java EE 7 教程组件

本教程示例源码包含在教程组件中.可以使用更新工具获取教程组件.

2.1.3.1 To Obtain the Tutorial Component Using the Update Tool

  1. Start the Update Tool by performing one of the following actions.
    • From the command line, enter the command updatetool.
    • On a Windows system, from the Start menu, choose All Programs, then choose Java EE 7 SDK, then choose Start Update Tool.
  2. Expand the Java EE 7 SDK node.
  3. Select Available Updates
  4. From the list, select the Java EE 7 Tutorial check box.
  5. Click Install.
  6. Accept the license agreement.After installation, the Java EE 7 Tutorial appears in the list of installed components. The tool is installed in the as-install-parent/docs/javaee-tutorial directory, which is referred to throughout the tutorial as tut-install. This directory contains two subdirectories: docs and examples. The examples directory contains subdirectories for each of the technologies discussed in the tutorial.

Next Steps

Updates to the Java EE 7 Tutorial are published periodically. For details on obtaining these updates, see Getting the Latest Updates to the Tutorial.

2.1.3.1 使用更新工具获取教程组件

  1. 通过执行以下操作之一启动更新工具.
    • 在命令行中输入命令 updatetool.
    • 在Windows系统上, 点击开始菜单, 选择所有程序, 再选择Java EE 7 SDK, 在选择Start Update Tool.
  2. 展开Java EE 7 SDK节点.
  3. 选择Available Updates
  4. 在列表中选中Java EE 7 Tutorial复选筐.
  5. 点击Install.
  6. 同意许可协议.
    安装后, Java EE 7 教程出现在已安装组件列表中. 工具被安装在as-install-parent/docs/javaee-tutorial目录, 那些被提到的教程在tut-install. 此目录包含两个子目录:docs和examples. examples目录包含教程中提到的每个技术子目录.

下一步

Java EE 7教程更新会定期发布. 要获取有关更新的信息, 请查看获取教程的最近更新.

2.1.4 NetBeans IDE

The NetBeans integrated development environment (IDE) is a free, open-source IDE for developing Java applications, including enterprise applications. NetBeans IDE supports the Java EE platform. You can build, package, deploy, and run the tutorial examples from within NetBeans IDE.

To run the tutorial examples, you need the latest version of NetBeans IDE. You can download NetBeans IDE from https://www.netbeans.org/downloads/index.html. Make sure that you download the Java EE bundle.

2.1.4 NetBeans IDE

NetBeans 集成开发环境是一个免费的,发展中的开源IDE和Java应用程序, 包括企业应用. NetBeans IDE支持Java EE 平台. 你可以在NetBeans IDE中构建,打包,部署和运行教程示例.

要运行教程示例, 你需要NetBeans IDE的最新版本. 你可以在https://www.netbeans.org/downloads/index.html下载NetBeans IDE. 确保您下载的是Java EE包.

2.1.4.1 To Install NetBeans IDE without GlassFish Server

When you install NetBeans IDE, do not install the version of GlassFish Server that comes with NetBeans IDE. To skip the installation of GlassFish Server, follow these steps.

  1. On the first page of the NetBeans IDE Installer wizard, deselect the check box for GlassFish Server and click OK.
  2. Accept both the License Agreement and the Junit License Agreement.A few of the tutorial examples use the Junit library, so you should install it.
  3. Continue with the installation of NetBeans IDE.

2.1.4.1 安装不含GlassFish服务器的NetBeans IDE

要安装NetBeans IDE,但是不想安装NetBeans IDE附带的GlassFish服务器版本. 也就是说想跳过GlassFish服务器安装,请参看以下步骤.

  1. 在NetBeans IDE安装向导第一页,脱选GlassFish服务器复选框,点击OK.
  2. 同时接受许可协议和Junit许可协议.
    有少数学习示例使用Junit库,所以你需要安装它.
  3. 继续NetBeans IDE安装进程.

2.1.4.2 To Add GlassFish Server as a Server Using NetBeans IDE

To run the tutorial examples in NetBeans IDE, you must add your GlassFish Server as a server in NetBeans IDE. Follow these instructions to add GlassFish Server to NetBeans IDE.

  1. From the Tools menu, choose Servers.
  2. In the Servers wizard, click Add Server.
  3. Under Choose Server, select GlassFish Server and click Next.
  4. Under Server Location, browse to the location of the Java EE 7 SDK and click Next.
  5. Under Domain Location, select Register Local Domain.
  6. Click Finish.

2.1.4.2 添加GlassFish服务器作为NetBeans IDE用服务器

为了在NetBeans IDE中运行学习示例,你必须添加你的GlassFish服务器作为NetBeans IDE中的服务器. 以下介绍了如何添加GlassFish服务器到NetBeans IDE.

  1. Tools菜单中选择Servers.
  2. 在服务器向导中点击Add Server.
  3. Choose Server内选择GlassFish Server并且点击Next.
  4. Server Location内定位到Java EE 7 SDK并且点击Next.
  5. Domain Location中选择Register Local Domain.
  6. 点击Finish.

2.1.5 Apache Maven

Maven is a Java technology–based build tool developed by the Apache Software Foundation and is used to build, package, and deploy the tutorial examples. To run the tutorial examples from the command line, you need Maven 3.0 or higher. If you do not already have Maven, you can install it from: http://maven.apache.org

Be sure to add the maven-install/bin directory to your path.

If you are using NetBeans IDE to build and run the examples, it includes a copy of Maven.

2.1.5 Apache Maven

Maven是一个基于Java技术的构建工具,由Apache软件基金会开发.用于其构建,打包和部署学习示例.为了在命令行中运行学习示例,你需要Maven 3.0或更高版本. 如果你没有准备好Maven,你可以从:http://maven.apache.org获取并安装它

确认添加maven-install/bin目录到你的path.

如果你使用NetBeans IDE构建和运行示例,则不需要做额外工作,因为它已经包含Maven副本.

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload the CAPTCHA.

Proudly powered by WordPress   Premium Style Theme by www.gopiplus.com