Overview:

Roles:

  • SAP HANA Cloud Platform administrator
  • Application and Web Front-End Developer
  • SAP HANA modeler

Systems, Tools, Services:

  • Java SDK (JDK)
  • Chrome Web browser with QR Code extension and Postman
  • SAP HANA Cloud Platform Trial Account (HCP Trial account)
  • Eclipse IDE
  • Maven

Downloads

Download LinkDescriptionContext
settings.xmlMaven Configuration FileStep 6: Build and Run Maven-based Project in Eclipse
helloworld.zipHelloWorld Java projectStep 6: Build and Run Maven-based Project in Eclipse

Step 1: Installing Java 8 SDK

In this tutorial Java 8 SDK is mandatory.

Warning: Lower versions like Java 7 or 6 will not work.

1.1 Check if a Java 8 SDK is installed

  1. Open the console or command line of your operating system.
  2. Execute command java -version.

    Result: If Java is already installed, then the command will display the Java version information. The version should be at least 1.8.0.

  3. To check if you have a full fletched Java SDK (and not only a simple Java Runtime Environment (JRE)) installed, execute the command javac -version

    Result: If you have a Java SDK installed then the command will display the Java version information, otherwise the operating system will complain that it can’t find the command and you have to install a new Java SDK as described in the next section 1.2.

Top

1.2 Install Java 8 SDK

If no Java 8 SDK is installed on your computer yet, then install a Java 8 SDK of your choice or follow this help to install the SAP JVM.

Top

Step 2: Prepare Chrome Web Browser and Plugins

Tools like the SAP Web IDE work best with Google Chrome, so we recommend to use this browser.

2.1 Install and Configure Chrome

  1. If Chrome Web browser is not already installed, then download and install it from https://www.google.com/chrome.

    Hint: In this tutorial, we advise you to use special configuration settings and to create several bookmarks. If you don’t want to “spoil” your default Chrome configuration, just may create a new user profile in Google Chrome where you can do all these settings, save logon data and passwords and add bookmarks without interfering with your regular browser experience. You don’t know how this works? Find out here support.google.com: Share Chrome with others or add personas.

  2. Open Chrome Web browser
  3. Configure browser language

    Hint: In this tutorial we will rely on the default browser language is set to English.

  4. Open chrome://chrome/settings/languages and make sure that English or English (United States) is set as default language, which means that English appease as the first Entry in the Languages list.

Top

2.2 Disable Your SSO certificate (if in use)

Note: This step only applies to users who have enabled configured certificate-based Single-Sign-On (SSO) in Google Chrome.

To work through some units with a predefined user, e.g. login to SAP HANA Cloud Platform with another trial user, you have to disable your SSO-certificate in your Google Chrome Browser (if in use).

  1. Open the Google Chrome Settings, search for certificates and click Manage certificates in the HTTPS/SSL section.

  2. In the Certificates popup select tab Personal and double-click the SSO-certificate that is issued to your user. In the new Certificate dialog select tab Details and click the Edit Properties button.

  3. In the Certificate Properties popup dialog under General select radio button Disable all purposes for this certificate and click Ok. Close all open popup dialogs.

Top

2.3 Postman for Chrome

Postman is a REST client, which helps you to send HTTP requests to work with REST APIs. Many HANA Cloud Platform services (like e.g. the later used Jam or Internet of Things service) exposes their data via such REST APIs. In the forecoming weeks of this tutorial, you therefore need a REST client tool. As we provide a postman specific environment file, we recommend to install and use Postman as REST client as described in the following steps:

Warning: Postman seems to also send additional values not defined in your rest-request. Those values come from your current browser settings and/or session. So be aware, in which profile/session you install and use the Postman plugin.

  1. In Chrome Web Browser open Postman in the Chrome App Web Store
  2. Click ADD TO CHROME.

Result: Postman is now available in the Chrome Apps

Hint: When you later need the Postman REST client just open the link chrome://apps/ in Chrome to find the Postman App

Top

2.4 QR Extension for Chrome

By means of the QR Extension you can generate a QR code for any URL opened in the Chrome Web browser. Later in week 5 of this tutorial you will make use of this feature.

  1. In Chrome Web Browser open QR Extension in the Chrome App Web Store.
  2. Install with ADD TO CHROME.
  3. The installed and enabled QR Code Extension is now available as small QR Code icon next to the Chrome URL bar.

Result: For any URL which you open in your Chrome Web browser you could generate a QR code by clicking on the QR code icon.

Step 3: Prepare SAP HANA Cloud Platform Trial Account

SAP HANA Cloud Platform Trial, also known as developer edition, is a free, perpetual license to evaluate SAP HANA Cloud Platform (HCP) for an unlimited period and free of charge.

In this tutorial we will describe how to execute the entire extensions business scenario on a newly registered HCP Trial Account.

Hint: Experienced users might also re-use their already existing HCP account. But you should then be aware that all steps of this tutorial are described as if you started from a newly registered HCP account. Therefore we advise you to register a new HCP trial account to use in this tutorial.

Info: For more information about SAP HANA Cloud Platform accounts see here.

3.1 Register for a Trial Account

  1. Open https://hanatrial.ondemand.com, the SAP HANA Cloud Platform Trial entry page.

  2. Click on Register.
  3. On the Registration page.
    • Enter the mandatory data
    • Read and accept the Terms and Conditions
    • Confirm by clicking Register:

  4. You will get a “Thank you for registering with SAP” dialog. Just close it.

  5. You will receive a confirmation e-mail. Click on Click here to activate your account link to confirm your address and activate your trial account.

  6. The account activation gets confirmed in the new browser page Account Successfully Activated. Click the Continue button.

  7. In the Log On dialog enter your password and click the Log On button.

  8. Close the “News and Announcements” (if opens) as it is not relevant for this tutorial.

  9. Click on the p-User link of your trial account.

  10. The SAP HANA Cloud Platform Cockpit overview page of your Trial account will open.

Result: You now have your SAP HANA Cloud Platform Trial account, on which all the S/4 HANA Extensions of this course can be executed on.

Info: Refer to the help page for additional information about the limitations of HCP Trial accounts.

Top

3.2 Create HCP Bookmark

Note: The opened HCP Trial Cockpit page will later during the course be launched many times. It is the main entry page for developers managing the services, application, configuration, etc. of the HCP account.

For quickly accessing the HCP Trial Cockpit page create now a Web browser bookmark as follows:

  1. Create a bookmark with name HCP for the opened HCP Trial cockpit page.
  2. In Chrome click Bookmark this page icon
  3. Change bookmark name to HCP
  4. Folder: Bookmarks bar
  5. Click Done

    Result: If you have enabled in Chrome customization menu, Bookmarks > Show bookmarks bar then you should get a new Bookmark HCP on the the bookmark bar of your browser. Click on it to access quickly your HCP Trial Cockpit page.

  6. Close the HCP Trial cockpit browser window.

Top

Step 4: Prepare SAP Web IDE

SAP Web IDE is a web-based development environment that simplifies the end-to-end application lifecycle: prototyping, development, packaging, deployment, and custom extensions. Many extensions of the course are developed in the Web IDE.

On every HCP Trial account the Web IDE is enabled and you can launch it as follows.

4.1 Launch SAP Web IDE

  1. Open HCP bookmark in Chrome Web browser (as defined in above section 3.2)
  2. Log in with your HCP Trial User Id (P-user) and password (if requested).
  3. Navigate to Services.
  4. Search for Web IDE and open the tile SAP Web IDE.

  5. On the page for the SAP Web IDE click Open SAP Web IDE link.

  6. The SAP Web IDE will open in a new browser tab.

Result: You have seen how the Web IDE can be launched when starting from the HCP Cockpit page. Next create a bookmark for quickly launching Web IDE whenever needed in the course.

Top

4.2 Create SAP Web IDE Bookmark

  1. Create a bookmark with name SAP Web IDE for the opened HCP Trial cockpit page.

  2. In Chrome click Bookmark this page icon
  3. Change bookmark name to HCP
  4. Folder: Bookmarks bar
  5. Click Done

    Result: You should get a new Bookmark SAP Web IDE next to the HCP bookmark. Click on it to access quickly your SAP Web IDE page.

  6. Close the Web IDE browser window.

Top

Step 5: Install and Configure SAP Tools for Eclipse

By means of the SAP Tools for Eclipse, developers can execute certain HCP development tasks: Building, deploying and running a Java application on HCP or maintaining an SAP HANA instance which in running on HCP will be typical task which will be demonstrated soon in this course.

To make use of the SAP HANA Cloud Platform Tools for Java, you first need to have a supported version of Eclipse installed on your computer.

Warning: Even if you have Eclipse installed on your computer, its a good idea to install an additional version. In this course you will need some special configuration. Having a separate installation prevents you from destroying your working environment. To give an overview, this is what you will check/install in the following units:

  • Proxy Settings: need to be configured so that you can access sources in the web. For more details see below 5.2
  • Some SAP Development Tools for Eclipse are needed. What is needed and how to see below 5.3
  • UTF-8 Text encoding is needed. see below 5.4
  • JDK8 is needed. see below 6.1

5.1 Install Eclipse Neon IDE

For this course it is recommended to install the Eclipse Neon as follows:

  1. Open the Download site for Eclipse and click on the Eclipse IDE for Java EE Developers link

  2. Choose the operating system that you will use to run Eclipse and choose the download site:

  3. Choose the preferred download site and start the download.
  4. Once the download has finished extract the archive to a local folder of your choice (e.g. C:\dev\eclipse).
  5. Click on the eclipse executable file to start the Eclipse IDE.

  6. Eclipse will first show you a Workspace Launcher dialog to choose your workspace. We suggest that you use a fresh workspace for the sake of this tutorial. We will use the workspace path: C:\dev\eclipse_workspace.

  7. Confirm with OK.
  8. Close the Eclipse Welcome Page.

Result: You have an up and running Eclipse Neon IDE. Before you start installing the SAP Tools for Eclipse into your IDE you should check if you need to configure a proxy as described next.

Top

5.2 Configure Proxy Settings

If you are accessing the Internet via a proxy then you need to setup a proxy in the Eclipse IDE. Otherwise you can skip the following steps and continue with next section 5.3

  1. From the Eclipse menu, choose Window > Preferences

    Hint: For Mac OSX, choose instead Eclipse > Preferences.

  2. On the opened Preferences page navigate to General > Network Connections and setup your proxy:
    • Choose Manual from Active Provider dropdown list.
    • Select the HTTP table row and click Edit

  3. On the opened Edit Proxy Entry dialog:
    • Enter your Host and Proxy value (e.g. proxy and 8080).
    • Click OK to confirm the proxy setting for HTTP schema.

  4. Configure proxy settings also for HTTPS (as shown above for HTTP).
  5. Click on OK to close Preferences dialog and save all proxy settings.

Result: In case you are working behind a proxy, you have setup now the Network proxy in Eclipse so that HTTP(S) calls from Eclipse works. E.g. You can install software tools from update sites (See next section 5.3).

Top

5.3 Install SAP Development Tools for Eclipse

Now install the SAP Development Tools for Eclipse into your IDE.

  1. From the Eclipse menu, choose Help > Install New Software…

  2. Copy the repository URL https://tools.hana.ondemand.com/neon and paste it in the Work with field and then press the Enter (or Return) key.

  3. A list of available software in this repository should appear.

    Note: If Eclipse is not able to find the tools then please check your network settings again. Especially if you are working with a proxy you might check your proxy settings again.

  4. In the list select the following tools:
    • ABAP Development Tools for SAP Netweaver
    • SAP HANA Cloud Platform Tools
    • SAP HANA Tools
  5. Press the Next > Button

  6. On the Install Details page click Next.

  7. Read and accept the license agreement and choose Finish. The installation will now start.

  8. At the end of the installation, you will be asked to restart Eclipse. Confirm the dialog with Yes to restart Eclipse immediately

  9. After Eclipse restarts, close the Eclipse Welcome Page.

Result: You now have the SAP Tools for Eclipse (ABAP Development Tools for SAP NetWeaver, HANA Cloud Platform Tools for Java and SAP HANA Tools) installed in your Eclipse IDE.

Top

5.4 Configure UTF-8 Text encoding

In later weeks, you will import an Analytical View. Here you will run into errors if UTF-8 Text encoding is not set. The encoding which is preconfigured depends on various installation aspects of your Eclipse. Please check your preferences.

  1. From the Eclipse menu, choose Window > Preferences; on Mac OS X, choose Eclipse > Preferences.
  2. On the opened Preferences page navigate to General > Workspace and setup the Text file encoding:
    • Select Other in Text file encoding section.
    • Select UTF-8 from dropdown list.
    • Click OK to save this setting.

Top

5.5 Configure Chrome as default Web Browser for Eclipse

As Google Chrome works best for our tutorial, we recommend to set Chrome as default external Web browser for Eclipse.

  1. From the Eclipse menu, choose Window > Preferences
  2. Choose General > Web Browser
    • Select Use external web browser option
    • Select Chrome checkbox as External web browser
    • Click OK to save this preference setting

Result: With this setting Eclipse will open the Chrome Web browser window when e.g. a Web application is launched from Eclipse, as you will see soon for the HelloWorld Java test application.

Top

Step 6: Build and Run Maven-based Project in Eclipse

Apache Maven is a software project management tool, that can manage a project’s build, reporting and documentation from a central piece of information - called project object model (POM). In this step you will ensure that your Eclipse IDE can successfully build a Maven-based HelloWorld Java project.

Note: Building successfully a Maven-based Java project in your Eclipse is a prerequisite for executing the tutorial course. In weeks 5 and 6 you will build and deploy the so-called Java Hub applications in the same way as you test now for the HelloWorld.

A first pre-condition for running a successful Maven build in Eclipse is that you have setup a JDK as Installed JRE as described in the following section 6.1.

6.1 Installed JRE in Eclipse - JDK8 needed

  1. From the Eclipse menu, choose Window > Preferences (On a Mac: Eclipse > Preferences)
  2. Choose Java > Installed JREs.

  3. Check if the default installed JRE is pointing to a JDK 8. Make sure that the respective Location path should contains the term jdk and not “jre”.

    Note: If you have to change the default Installed JRE do the all the following steps (including the remove JREs part):

    • Click Add button.

    • In the opened Add JRE window select Standard VM as JRE Type.
    • Click Next

    • Click Directory… and browse to the folder where you extracted your JAVA JDK 8 or SAP JVM.
    • Click OK
    • Back on the Add JRE window click Finish to add the intended JDK 8 to the list of installed JREs

    • Select the added JDK 8 so that it is marked as default installed JRE.

      Note: Remove also all other existing installed JREs, especially if they are pointing to a jre. The reason is that Maven build later in certain situations could take the installed JREs which are not selected as default.

    • Select the line, not the checkbox (!) of the installed JRE entry to be removed.
    • Click Remove to remove the line selected JRE.

    • Click OK to save settings and close the Preferences window.

Result: After executing the above steps you have ensured that the needed JDK has been set up for a successful Maven build.

The next pre-condition for running a successful Maven build is the proxy setting as described in the following section 6.2.

Top

6.2 Reusing an already installed Maven (optional)

In case you are using Maven for the first time on your computer, you may skip this step and continue with Step 6.3.

If you have already Maven running on your computer and don’t want change your existing setup, you should configure a new settings.xml for this tutorial. This is described in this step.

  1. Create a new directory anywhere for your new Maven repository content, for e.g. m2-cloud-s4ext in your user home directory.
  2. Download the file settings.xml and copy it to this directory.
  3. Edit the file and replace the <localRepository/> tag with the path to the new directory which you created in step 1. For example: <localRepository>${user.home}/m2-cloud-s4ext/repository</localRepository>
  4. In Eclipse open Windows > Preferences> Maven> User Settings (Mac OS X: Eclipse > Preferences>..).
  5. Select the new settings.xml file by clicking Browse under User Settings.
  6. Click Update Settings. Click Apply and click OK.

Look at the Maven Documentation how to use a different directory for your local maven repository using the localRepository tag.

6.3 Configure Proxy for Maven

If you are not accessing the Internet via a proxy, you may skip this section and continue with section 6.4. Otherwise you need to setup also a proxy for Maven as described with the following steps, even though you have already configured a proxy for your Eclipse IDE.

  1. Create a new folder of your choice where Maven will download and create repository artifact.

    Note: By default Maven uses a .m2 directory in the user home directory, so we recommend to create via a command mkdir .m2 this directory if is does not already exists.

  2. Download the file settings.xml and copy it to this directory.
  3. From the Eclipse menu, choose Window > Preferences
  4. Select Maven > User Settings
  5. Click on Open File link next to user settings to open the before copied settings.xml file in an editor behind the Preferences window. (Please be advised that the file will only open in the background.)

  6. Close the Preferences dialog by clicking on OK to display the settings.xml file in the eclipse text editor.
  7. Edit your proxy information in the <proxies> section.
  8. Enter host and port of your proxy.
  9. If your proxy needs an authenticated user then enter username and password, otherwise simple remove these tags from the proxy settings.
  10. A simple unauthenticated proxy setting (with proxy as host and 8080 as port) is shown in the following screenshot.

  11. Save your changes and close the settings.xml text editor.

Info: For more general information on proxy settings in Maven look at the Maven Documentation.

Top

6.4 Maven Test Build

Now you are ready to test if can build and run a Java Web application project with Maven in your Eclipse IDE. For this test we prepared a Maven-based HelloWorld Java project as follows.

  1. Download the archive file helloworld.zip.
  2. Extract the helloworld.zip archive to a directory of your choice.
  3. From the Eclipse menu, choose File > Import… to open the Import wizard.

  4. Choose Maven > Existing Maven Projects and click Next.

  5. In the Import Maven Projects dialog:
    • Click Button Browse and select the helloworld directory where you have extracted the helloworld.zip
    • The helloworld/pom.xml will be listed in the Projects section.
    • Select the checkbox of this pom.xml
    • Choose Finish to start importing the Maven project into your Eclipse workspace.

    Info: POM is an acronym for Project Object Model. It is an XML representation of a Maven project held in a file named pom.xml. For more information see the Maven documentation.

  6. In the Project Explorer view of the Java EE Perspective you should find now the imported helloworld.

  7. Right-click on the helloworld project node to open the Context Menu.

  8. Choose Run As > Maven install to start the Maven build for the helloworld project.
  9. The Eclipse IDE will open a Console Tab that displays the build progress. You should see BUILD SUCCESS. If your build was not successful, please check the troubleshooting Guide for Maven.

  10. In Project Explorer view expand project node, helloworld > target to find the built helloworld.war file.

    Note: To see it you might have to refresh the project by right-clicking on the project-node and press Refresh.

Result: Maven has build successfully the helloworld Java web application and created a helloworld.war file (see console output for the location). You can deploy this war file to your SAP HANA Cloud Platform trial account and run the helloworld application then in the Cloud. You will do this in the next step.

Top

6.5 Deploy and Run HelloWorld Java App on HCP Account

In this sub-step we will instruct you how to deploy and run Java application in your SAP HANA Cloud Platform trial account. As an example you will deploy and run the helloworld application that you built in the previous sub-step.

  1. Open HCP Cockpit bookmark in Chrome Web browser (as defined in above section 3.1).
  2. Log in with your HCP Trial User Id (P-user) and password (if requested).
  3. Navigate to Java Applications > Applications.
  4. Click on Deploy Application.

  5. In the Deploy Application dialog, select the helloworld.war from your local file system.

Hint: How to find the path of the helloworld.war? In Eclipse open the Context Menu of helloworld.war > Properties. In the upcoming properties dialog you can find the full path:

  1. Set the following properties:
    • Runtime Name: Java Web Tomcat 8
    • JVM Version: JRE 8

  2. Click on Deploy to start the upload of the helloworld.war file to your HCP trial account.
  3. In the successfully deployed dialog click on Start to start the deployed Java application.

  4. Once the Java application is started, click on the helloworld application link.

  5. Click on the link under Application URLs. It opens the application in a new browser window.

  6. You can now see the output that the helloworld application created. Click on the link in Open HelloWorldServlet.

  7. A message Hello World! is displayed.

Result: You have successfully deployed and started the helloworld application in your SAP HANA Cloud Platform Trial Account. Later in this course (week 5 and 6) you will deploy and run other Java applications to your HCP Trial account in the same way.

Top

< Previous Unit 4Up ^ Week 1 OverviewNext > Unit 6