18
IBM Press Template Examples, 1 Appendix A Installation Instructions This appendix covers the installation of all the software required to develop web applications with WebSphere. We assume that you are starting with a clean development machine, and we do not assume any preinstalled requirements. We also cover the installation of middleware required to host the sample application developed throughout this book. Although this is a step beyond the standard development of the application, we feel that it is important to be able to deploy the final product onto a separate hosting server. The authors want to thank Bhargav Perepa for testing the instructions on Microsoft Windows 7 and for his extensive help in screen capture and co-authoring this revision of the Installation Chapter – thanks Bhargav! Authors’ Note We know that one of the most frustrating aspects of purchasing a book with detailed code and installation examples is finding that the particular release of tools referenced in the book is no longer available or discovering that user interface features of the installation procedure have changed so that you can no longer follow the instructions. An added feature of books in the DeveloperWorks Series is that the book’s home page always has an updated version of the installation instructions for our examples. The home page for this book is http://www.ibm.com/developerworks/dwbooks/modernwebdev/index.html. Visit that page for the most up-to-date version of these instructions. Development Machine Installation To configure the development environment needed to follow the examples in this book, you must install several components. We cover installation of the following software: o Java Runtime Environment, v1.7 o Eclipse Luna IDE, v4.4.1 o IBM WebSphere Liberty Profile Developer Tools for Luna o Source code for the book In addition, we cover installation of the following optional tools for mobile development: o IBM MobileFirst Platform Studio, v6.3.0 o Android Development Tools

Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 1

Appendix A Installation Instructions

This appendix covers the installation of all the software required to develop web applications with WebSphere. We assume that you are starting with a clean development machine, and we do not assume any preinstalled requirements.

We also cover the installation of middleware required to host the sample application developed throughout this book. Although this is a step beyond the standard development of the application, we feel that it is important to be able to deploy the final product onto a separate hosting server.

The authors want to thank Bhargav Perepa for testing the instructions on Microsoft Windows 7 and for his extensive help in screen capture and co-authoring this revision of the Installation Chapter – thanks Bhargav!

Authors’ Note We know that one of the most frustrating aspects of purchasing a book with detailed code and installation examples is finding that the particular release of tools referenced in the book is no longer available or discovering that user interface features of the installation procedure have changed so that you can no longer follow the instructions. An added feature of books in the DeveloperWorks Series is that the book’s home page always has an updated version of the installation instructions for our examples. The home page for this book is http://www.ibm.com/developerworks/dwbooks/modernwebdev/index.html. Visit that page for the most up-to-date version of these instructions.

Development Machine Installation To configure the development environment needed to follow the examples in this book, you must install several components. We cover installation of the following software:

o Java Runtime Environment, v1.7 o Eclipse Luna IDE, v4.4.1 o IBM WebSphere Liberty Profile Developer Tools for Luna o Source code for the book

• In addition, we cover installation of the following optional tools for mobile development:

o IBM MobileFirst Platform Studio, v6.3.0 o Android Development Tools

Page 2: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 2

Installing Java Development Kit/Java Runtime Environment, v1.7 [jre-7u75-windows-x64] Many operating systems have a Java Runtime Environment (JRE) preinstalled. The Eclipse IDE requires a JRE to operate. Using the latest JRE provided by Oracle is preferred. If you will be developing mobile applications using IBM MobileFirst Platform Studio, the Android Developer Tools specifically require the Oracle JRE and will not work otherwise. All our examples were tested with Oracle JDK 1.7, which you can download from the same link shown in the following first step.

1. Browse to http://www.oracle.com/technetwork/java/javase/downloads/index.html.

2. Navigate to section on page that says Java SE 7uNN/MM where NN and MM are two digit numerals such as 75/76

2. Click the JRE Download button. 3. Accept the license agreement to enable downloading. 4. Select the product/file description link appropriate for your operating

system – for example for Windows x64 platform, select jre-7u75-windows-x64.exe

5. Open the downloaded package, and follow the installation wizard prompts.

6. Verify the JRE installation by opening a command prompt and entering the following command: java –version The results should look similar to that in Figure A.1. Verify that you are running the expected Java version.

Figure A.1 Verifying Oracle JRE version information

Page 3: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 3

Installing Eclipse Luna IDE, v4.4.1 The Eclipse Integrated Development Environment (IDE) is the base tool you use here for all development of the web application. Technically, you do the majority of your development and testing using nothing more than a text editor and browser, but there’s no sense in making your life more difficult than necessary. This code for this book was tested using Eclipse Java EE IDE for Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600 (eclipse-jee-luna-SR1a-win32-x86_64.zip). IBM MobileFirst Platform Studio v6.3.0 requires Juno or above. These instructions apply to Windows 7 64-bit platform; for other operating systems, such as Linux or Mac OS the instructions vary slightly.

1. Browse to www.eclipse.org/downloads/packages 2. Select Luna Packages from the list of versions on the left. 3. Click the link labeled Eclipse IDE for Java EE Developers. 4. Click the Download link for your operating system, such as Windows

64-bit. 5. Click the Download link for the selected mirror location. Download the

binary to a desired staging location such as C:\Binaries with downloaded binary name eclipse-jee-luna-SR1a-win32-x86_64.zip.

6. Extract the downloaded archive to your desired location.

For example, assume that your development environment will be located at “C:\i\eclipse”, select C:\Binaries\eclipse-jee-luna-SR1a-win32-x86_64.zip file, right click, and select the Extract All option to extract the contents to the “C:\i” folder. This will create a “C:\i\eclipse “ subfolder when extracted.

7. Start Eclipse using the command C:\i\eclipse\eclipse. The first time you launch Eclipse, you are prompted for a workspace location. For this sample, choose C:\Users\Administrator\workspace. Select to always use this location. Hint: To have your desktop environment launcher icon locked to your taskbar, you can create a Windows 7 shortcut using the following steps: • Click on Windows 7 home screen to get context menu. • Select New > Shortcut. • Type the location of the item:C:\I\eclipse\eclipse.exe. • Type a name for this shortcut: Eclipse Luna Workbench. • Click Finish. • Drag and drop the newly created shortcut to taskbar.

8. Install any available updates. This is a general recommended practice

before installing any new plug-ins. From the main Eclipse menu, click Help > Check for Updates, as in Figure A.2.

Page 4: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 4

Figure A.2 Checking for updates… [Eclipse Luna Workbench]

This might take several minutes to complete, depending on the number of repositories configured and updates to install. Restart Eclipse after any updates.

Installing IBM WebSphere Liberty Profile Developer Tools for Luna The WebSphere Liberty Profile Developer Tools provide support for the WebSphere Liberty

profile.

1. From within Eclipse, select Help > Eclipse Marketplace. 2. In the search box, enter websphere and click Go. 3. Within the results list, locate IBM WebSphere Application Server

Liberty Profile Developer Tools for Luna and click Install, as in Figure A.3.

Page 5: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 5

Figure A.3 Installing IBM WebSphere Application Server Liberty Profile Developer Tools for Luna

4. On the following screens, ensure that all components are selected, accept the license agreement, and click through to completion.

5. Restart Eclipse after the installation has completed.

Installing the Source Code for the Book Examples When the entire development environment has been established, you are ready to import the

example source code for the book.

1. Start Eclipse, if it is not already running. 2. Select File > Import.

Page 6: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 6

3. Select General>Existing Projects into Workspace and click Next, as in Figure A.4.

Figure A.4 Importing existing projects into Workspace

3. On the next screen, choose Select Archive File, and then click the Browse button. Locate the project archive to import and click Open. Ensure that all project(s) are selected and click Finish, as in Figure A.5.

Page 7: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 7

Figure A.5 Select archive file to import

5. Repeat this process for each chapter’s project source as needed.

Optional Development Tooling for Mobile Web Apps If you will be developing mobile web applications, you should install the following components. This book does not specifically cover using all the features of these components, but having them available will enable you to work with them to develop hybrid or native applications.

IBM MobileFirst Platform Studio v6.3.0 IBM MobileFirst Platform Studio (formerly named IBM Worklight Studio and referred to as MobileFirst Platform Studio in the text of the book) is the premier development environment for creating mobile hybrid applications. For this installation, you will install the freely available MobileFirst Platform Studio 6.3.0. This version of Studio does not permit the final deployment of apps, but it enables you to create and test apps using the built-in Mobile Simulator. If you require the final creation and deployment of the application binaries, you must purchase and install the standard MobileFirst Platform Studio product.

Page 8: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 8

1. From Eclipse, select Help > Eclipse Marketplace. 2. In the search box, enter MobileFirst and click Go. 3. Within the results list, locate IBM MobileFirst Platform Studio 6.3.0

and click Install, as in Figure A.6.

Figure A.6 Marketplace for MobileFirst Platform Studio 6.3.0

4. Ensure that all components are selected, accept the license agreement, and click through to completion.

5. Shut down Eclipse. 6. Update the launch settings for Eclipse. IBM MobileFirst Platform Studio

runs more efficiently with a larger memory allocation. To do this, you need to edit the

For Windows/Linux: eclipse/eclipse.ini

Page 9: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 9

In that file, update the following values (from >> to): --launcher.XXMaxPermSize 256m >> 512m -XX:MaxPermSize=256m >> 512m -Xms40m >> 80m -Xmx512m >> 1024m

7. Restart Eclipse and verify that it starts properly.

The next step is to verify proper installation by creating a sample IBM MobileFirst Platform project and application. You will use this app to test the Android installations next.

1. Select File > New > Project. In the New Project dialog box, select MobileFirst > MobileFirst Project.

2. Provide a name, such as TestProject, and select Hybrid Application; then click Next.

3. On the Hybrid Application screen, provide a name for the application, such as TestApp, and click Finish. Note: You do not need to select a JavaScript toolkit for this app. Note: Eclipse asks whether you want to switch to the Design Perspective. Respond Yes.

4. Build the app by first opening TestProject. Select the TestProject and right-click then select Run As > Run on MobileFirst Development Server.

5. Test the app by opening a web browser and opening the MobileFirst Studio console by selecting TestProject then right-clicking and selecting Open MobileFirst Console, or opening a browser at http://localhost:10080/worklightconsole/index.html#TestProject,catalog

Clicking the Preview as Common Resources link, in Figure A.7, now opens a new page that simply shows TestApp.

Figure A.7 TestApp Preview as Common Resources

Page 10: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 10

Android Development Tools and Eclipse Plug-in The Android Development Kit enables native compilation of apps into an Android APK file suitable for installation onto an Android device. It also enables the creation of native emulation for debugging and testing. Finally, it provides tooling to enable remote debugging of apps running on a tethered device from your development machine.

1. Browse to http://www.oracle.com/technetwork/java/javase/downloads/index.html.

2. Navigate to section on page that says Java SE 7uNN/MM where NN and MM are two digit numerals such as 75/76

3. Click the JDK Download button. 4. Read and accept the license agreement. 5. Download the archive suitable for platform – such as jdk-7u75-windows-

x64.exe for Windows 7 64-bit. 5. Extract the archive to the desired location, e.g..,

“c:\i\Oracle\jdk1.7.0_75”. 6. Run the Android tooling (such as c:\i\android-sdk\tools\android.bat). 7. Click the Install button if you have any updates to apply.

The next step is to install the Android ADT Eclipse plug-in.

1. Launch Eclipse and select Help > Install New Software. 2. Click the Add button to add a new repository. 3. Enter the following details:

Name: Android ADT Location: https://dl-ssl.google.com/android/eclipse/ 3. Select Developer Tools and click Next, as in Figure A.8

Page 11: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 11

Figure A.8 Installing Android ADT Developer Tools 5. Click through the remaining prompts, accepting the license agreement,

and click Finish. 6. Restart Eclipse after the install completes.

Now that the Android tooling is installed, you need to test it out our sample MobileFirst Platform Studio app.

1. Open Design Perspective. 2. Select menu option File > New > MobileFirst Project. 3. Specify Project Name: TestProject. Click Next >. 4. Specify Application name: TestApp. Click Finish. 5. Select TestApp > New > MobileFirst Environment. 6. Check Android Phones And Tablets, and click Finish. 7. Build the app by right-clicking TestProject > apps > TestApp and selecting Run As

> Build All Environments.

Page 12: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 12

8. Notice that a new project has been created, called TestProjectTestAppAndroid. You’ll use this shortly. Run the app by right-clicking TestProject > apps > TestApp and selecting Run on MobileFirst Development Server.

9. If you restart the MobileFirst Studio console now, you can see an Android instance of the app that you can preview by clicking the eye icon (see Figure A.9).

Figure A.9 IBM MobileFirst Platform Operations Console – Android application preview

Again, the results are less than dramatic: All you see is TestApp within an Android simulator, as in Figure A.10. However, this is enough to be sure that the environment is up and running properly.

Page 13: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 13

Figure A.10 IBM MobileFirst Platform Mobile Browser Simulator

Note that the “simulator” is using normal HTML to render the app, with a little Java to simulate device features. This is fine for local development and testing, but it does not accurately test real Android OS behavior. For this, you need to test on the Android “emulator,” which you do in the next step.

5. Test the app using the Android emulator, by right-clicking TestProjectTestAppAndroid > Run As > Android Application. The Android ADT boots up an emulated Android device, deploys the app to it, and shows the results on the screen. You can adjust the Eclipse launch options to modify the behavior so that a certain APK (Android device) is launched. If a physical Android device is attached to your system via a USB cable, the app is deployed and launched directly on that device.

Page 14: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 14

Server Installation In this section, you install the middleware required to run the application on a standalone server. The server installation would logically be installed onto a dedicated server, but you are free to physically install the middleware directly onto your development machine for local server testing outside your development environment. Just understand that when we say “server,” we are referring to your logical server, regardless of whether it happens to be on the same physical hardware.

The following software will be installed on the server:

o IBM WebSphere Liberty Profile, v8.5.5.4 o Apache Derby Database, v10

IBM WebSphere Liberty Profile, v8.5.5.4 The WebSphere Liberty Profile (or simply Liberty) provides a lightweight WebSphere application server environment to host web applications.

1. Browse to https://developer.ibm.com/assets/wasdev/ . 2. Select Liberty Profile V8.5.5.4 Runtime and click the Download

button. 3. Agree to the license terms. 4. Save wlp-developers-runtime-8.5.5.4.jar to your system (for example, in

C:\Users\IBM_ADMIN\Downloads). 5. Open a command prompt and change to the directory where you want to

install Liberty (such as C:\i\Lib). Note that Liberty will be installed into a directory named wlp under this directory. cd C:\i\Lib

7. Run the following command, using the proper location and filename: java -jar wlp-developers-runtime-8.5.5.4.jar

8. Read and accept the end user license agreement. 9. The installation asks for a target directory. You should be able to accept

the default (current) location. 10. The installer extracts the files into a wlp directory and completes.

At this point, WebSphere Liberty is installed and ready to go. Go ahead and verify the installation by creating and starting a new server instance.

1. From the command line, change to the directory where Liberty is installed: cd C:\i\Lib\wlp

2. Create a new server instance by running the following command: C:\i\Lib\wlp\bin/server create server1

The server is created under the C:\i\Lib\wlp\usr\servers directory. 3. Check and/or change the default ports to be used by the server, by editing

the server’s server.xml file:

Page 15: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 15

View/Edit: C:\i\Lib\usr\servers\server1\server.xml Locate the httpPort attribute of the httpEndPoint node.

4. Start the server using the following command: C:\i\Lib\bin\server start server1

4. Open the server instance's default page using the port defined in the server.xml file. The results should look like Figure A.11.

Figure A.11 Liberty Profile Welcome Screen

Apache Derby, v10 Apache Derby is a lightweight, file-based relational database. It is useful for test and development environments because it is easy to set up and use. It is not appropriate for production environments because it cannot properly manage heavy loads, nor does it have support for high availability scenarios that production applications typically require.

1. Download the Apache Derby bin archive from http://db.apache.org/derby/derby_downloads.html.  You should be safe using the latest available version. All the book examples were tested with version 10.8.2.2.

2. Extract the downloaded ZIP file to your desired location (such as C:\I\derby).    The archive contains a top-level subdirectory similar to db-derby-10.xx.xx.xx-bin. To make life a little easier, you might want to rename to something simple, such as derby, after extraction. If you do so, note this pathname and adjust the paths you use in building the examples for earlier chapters.

3. Set the DERBY_HOME and the PATH environment variables pointing to your new derby directory (for example, C:\I\derby).  

Page 16: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 16

4. Create a connection definition in Eclipse.  Open the Data Source Explorer view. Click the New Connection Profile icon, as in Figure A.12.

Figure A.12 Database Development – New Connection Profile Creation

Select Derby, change the name to Derby, and click Next. Click the New Driver Definition (target) icon (see Figure A.14). Select Derby Embedded JDBC Driver and select the highest version defined. An error might appear saying that the driver JAR cannot be found. You’ll fix this next. Click the JAR List tab, select the derby.jar file, and click the Edit JAR/Zip button. Click Browse and locate the real derby.jar file (C:\i\derby\lib\derby.jar); open it and click OK. When the driver is properly defined, you return to the main connection page in Figure A.13.

Page 17: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 17

Figure A.13 New Derby Connection Profile Creation

Update the database name and location to suit your tastes (such as C:\Users\Administrator\MyDB), and click Finished.

Summary This appendix has provided instructions for installing both development tools and server-side

middleware needed to create the application code defined in this book. It was tested on Windows 7 for completeness and accuracy. Obviously, product versions change frequently, and you must use proper judgment (and read compatibility guides) to ensure that newer products can

Page 18: Appendix A - public.dhe.ibm.compublic.dhe.ibm.com/software/dw/dwbooks/modernwebdev/updated-a… · Web Developers, Version Luna Service Release 1a (4.4.1), Build id: 20150109-0600

IBM Press Template Examples, 18

interoperate. If you have any issues with the installation of any of these products, either post a message to the appropriate message board on IBM developerWorks or contact your IBM marketing representative for assistance. Good luck and have fun!