cancel
Showing results for 
Search instead for 
Did you mean: 

should we use main method in JCO

Former Member
0 Kudos
37

1/

Should we use main method in JCO.. Connections does not seem to be simple java programes... so why should we use them??? just for the sake of running the programme?

2/ And the below mentiond programme.. there is nothing called Connect1. Still the that class is created ..

do not you thik it has to be <b>TutorialConnect1</b> object and constructor,

import com.sap.mw.jco.*;

public class TutorialConnect1 extends Object {

JCO.Client mConnection;

public Connect1() {

try {

// Change the logon information to your own system/user

mConnection =

JCO.createClient("001", // SAP client

"<userid>", // userid

"****", // password

null, // language

"<hostname>", // application server host name

"00"); // system number

mConnection.connect();

System.out.println(mConnection.getAttributes());

mConnection.disconnect();

}

catch (Exception ex) {

ex.printStackTrace();

System.exit(1);

}

}

public static void main (String args[]) {

Connect1 app = new Connect1();

}

}

View Entire Topic
venkatakalyan_karanam
Active Contributor
0 Kudos

Hi

The main method is used in the learning stages to know how the program is executing.In real time scenarios we do not use the main method.If you use a main method it is just like a stand alone program to know the basics.

In your program the class name and constructor name is different

Make sure both are same or otherwise create an object with default constructor given by jvm and then call a method

Thanks

kalyan