Skip to Content

This blog post is part 3 of a series of blogs on how to develop a Java application in SAP Web IDE Full-Stack.

It describes how to Run and Debug the application, as well as our new Hot Deployment feature.

Before reading this blog please make sure that you have read the first and second parts of this series.

 

Run

After successfully building and testing our newly created web Java module, we can finally run it.

  1. Right-click the web folder and select RunRun AsJava Application.
    The Run console opens displaying our Java application URL.
  2. Click on the URL. A new tab opens displaying a link for our Hello World Servlet
  3. Click on the link. Our “Hello World” output is displayed.

Hot Deployment

Let’s modify the Java code to show the Hot Deployment capability.

  1. Open the java class.
  2. Modify line 36 to be: write(“New Hello World !!”);
  3. Click the Run console’s green play button to rerun the application.
  4. The time for running the application is now faster than before
  5. Refresh the application page in your browser.
  6. Click the “Hello World Servlet” link.Voilà! our new code modification is now available

Debug

You can run your Java module in debug mode using the Run Configurations dialog.
Then, use the debug tools for debugging your application.

Let me show you how…

  1. Open the HelloServlet.java file under web/src/main/java/…
  2. Set a breakpoint on line 29 inside the doGet(..)
    To achieve this, click the line number in the editor’s gutter.
  3. Right-click the web folder and select Run->Run Configurations. The Run Configurations dialog opens.
  4. Click + to add a new configuration and select the only option – Java Application.
  5. Once the new configuration is created, select the Run in debug mode checkbox.
  6. Click Save and Run to debug your web Java module.
    Once the application is running, a new Debugger pane opens on the right-side paneThe Active Session name is based on the names of our project and Java module: “/mtaproj/web”.
    The running Java application threads are displayed under the Call Stack(s) section.
    Notice the breakpoint we just added for line 28 under the Breakpoints section.
    Now let’s hit a breakpoint.
  7. Click the application URL from the Run console to open the application in a new tab.
    A new tab opens with a link called “Hello World Servlet”.
  8. Click on it. The debugger is suspended.A new notification message stating Debugger: ‘/mtaproj/web’ suspended is displayed.
    The Call Stack section stops on our doGet method.
    The Variables section contains 4 local variables defined inside the doGet method.
    Line #29 in the editor is highlighted.
  9. Use Step Over (F10), Step In (F11), Step Out (Shift + F11), and Resume (F8) to debug the Java code.
  10. You can also scan the tree to inspect the variable values.

 

Conclusion

With this blog post series, you have learnt how to create an MTA project with a Simple Web Application Java module. We integrated the very basic capabilities of Java development to help the full-stack developer throughout the software development lifecycle from Java code development to debugging and running the application.

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply