Skip to Content
Author's profile photo Tom Cenens

SAP Java Administration – Troubleshooting part I – java as a programming language

Context

Hello SDN Community

As a SAP Basis Administrator I know that a lot of other administrators find it more difficult to troubleshoot Java compared to ABAP. It is also noticeable on the SDN forum that people are having a hard time to understand java logs and crash situations.

That’s why I thought it would be a good idea to blog on the subject of SAP Java Troubleshooting, to start off with, it’s important to have an idea how java programming works.

Java as a programming language

Java is an object oriented programming language, it’s a programming language which is not too complicated to code and it reuses coding and recycles objects. If you are already thinking mm, what does that mean, then let’s take a look at a little example to demonstrate what I mean with reusing and recycling.

Creation of a Java object

I like cars so we will go for an example that involves a car (it’s a good trick to learn things, get something involved you are interested in so you understand better).

public class Car {

private string brand;
private string model;
private string color;
private int speed;

public Car(int brand,string model,string color,int speed) {

this.brand = brand;
this.model = model;
this.color = color;
this.speed = speed;
}

}

What we have here is a class called Car. You can see a class as a combination of variables and methods. Variables being brand,model,color and speed. In the example I only have one method, a constructor method. The public Car ( … ) { } you see in the example is a constructor, a constructor is called to create an object.

For the example we will assume the program will simulate a race.

Now, we need to display details of a few cars in our program so we create a new car with the following specifics, we want an Audi R8 that is red and goes up to 250 km’s/hour. This would result in following coding line (I’m keeping it simple so I’m leaving out additional coding that is not relevant).

Car a;
a = new Car(“Audi”,”R8″,”red”,250);

After those lines are processed, we have an object of the class Car. The class Car represent a car in general; a car can be of lots of different brands, models and so on. Our object represents a red Audi R8 with a top speed of 250 km’s/hour.

Reusing

A race with one car is boring, right, so we create two additional cars (to keep it interesting).

Car b;
b = new Car(“BMW”,”M5″,”black”,250);

Car c;
c = new Car(“BrandX”,”RC”,”blue”,250);

We want to keep the race tight so the speed is limited to 250 km’s/hour for each car. After those additional lines of coding we have 3 objects.

Now I already demonstrated how some coding is being reused, you can create new objects of the class Car with their own specific variable values. Nice isn’t it.

Recycling

The race has begun and after 30 laps we are at the first corner after the start line and the BrandX RC spins off the track and it crashes into the wall.

It’s the end of the race for the BrandX RC. Now we come to the point where we no longer need the BrandX RC since we are only interested in the ongoing race, the object is no longer needed and it will be destroyed. When you recycle an object, it is marked for garbage collection, once it is collected by the garbage collector, the object is destroyed.

In the next part of this blog series I will talk about how the above affects memory use (I will reuse the same example type) and where the garbage collector (collection) comes into play.

Kind regards

Tom

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.