Java-Based Apps on SCP: Part 1-Setup Eclipse

I am following openSAP course “Developing Java-Based Apps on SAP Cloud Platform* (Update Q1/2017)”. In this part, I’m going to setup and configure Eclipse IDE for Java EE development.

A. Install Eclipse for Java EE

  1. Download Eclipse IDE for Java EE Developers here.
  2. Extract the package to a folder of your choice and run eclipse.exe
  3. Select your workspace folder.

B. Setup Proxy (Optional)

  1. Go to Windows → Preferences and search for proxy.
  2. Under General → Network Connections, change Active Provider to Manual and setup your proxy accordingly.

C. Install SAP Tools

  1. Go to Help → Install New Software…
  2. Click Add… and enter the following:
    Name: SAP Tools
  3. Click OK.
  4. Select all items and click Next.
  5. Follow on-screen instructions until the installation finish and Eclipse restarts.

D. Install Java Web Tomcat 8 SDK

  1. Download Java Web Tomcat 8 from this page.
  2. Extract the package to a folder of your choice.
  3. Go to Preferences → Server → Runtime Environment and click Add…
  4. Select SAP → Java Web Tomcat 8 and click Next.
  5. Click Browse… and select your JDK folder.
  6. Click Finish.

E. Check Java Version

  1. Open Command Prompt and use command java -version
C:\Users\administrator>java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 8.1.000)
SAP Java Server VM (build 8.1.000 25.11-b08, Aug 8 2014 00:49:10 - 81_REL - optU - windows amd64 - 6 - bas2:223465 (mixed mode))

Here, the SAP JVM version 8 is installed. You can download the SAP JVM from this page.

2. Go to Preferences → Java → Installed JREs.

3. Here you find the list of JREs configured for Eclipse. Make sure Java 8 (either Oracle’s or SAP’s) is installed.

4. Open System Properties → Environment Variables and make sure JAVA_HOME is set properly.

F. Create New Dynamic Web Project

  1. In Eclipse, open Java EE perspective.
  2. Go to File → New → Dynamic Web Project.
  3. Input this information:
    Project name: helloworld
    Target runtime: Java Web Tomcat 8
  4. Click Finish.

G. Create New Servlet

  1. Right-click at the project and select New → Servlet.
  2. Input the following:
    Java package: helloworld
    Class name: HelloWorldServlet
  3. Click Next.
  4. Change the URL Mappings to /
  5. Click Finish.

6. In the new servlet, make the following change:

* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
// response.getWriter().append("Served at: ").append(request.getContextPath());
response.getWriter().println("Hello World!");


H. Run the App Locally

  1. Right-click the project, select Run As → Run on Server.
  2. Select Manually define a new server and Java Web Tomcat 8.
  3. Click Finish.

4. You should see the servlet running in the built-in browser.

5. You can re-run again as you want:

I. Run the App on SCP

  1. Right-click the project, select Run As → Run on Server.
  2. Select Manually define a new server and SAP Cloud Platform.
  3. Input in Landscape host field and click Next.
  4. Input your Account name (e.g. p1940750502trial), User name (e.g. P1940750502), and password. Click Finish.
  5. Wait until the servlet is deployed and its status changes to Started.
  6. The application should appears automatically.

J. Install Git Client and Maven

  1. Download and install Git client from here.
  2. Download Maven from here.
  3. Extract the package to your folder of choice.
  4. Add Maven’s bin folder to the PATH environment variable.
  5. In Command Prompt, use command mvn -v to display version of Maven installed.
C:\Users\administrator>mvn -v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T02:39:06+07:00)
Maven home: E:\apache-maven-3.5.0\bin\..
Java version: 1.8.0_11, vendor: SAP AG
Java home: E:\sapjvm_8\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows server 2012 r2", version: "6.3", arch: "amd64", family: "windows"

Continue Reading

Read More