Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Error when running "Run as Java application" from NWDS

Dear All,

I am trying to run the following .java proggie...

Thanks for that. By the way, I am now trying to compile the following .java program.....

/*

  • Created on 01-Oct-2007

*

  • To change the template for this generated file go to

  • Window>Preferences>Java>Code Generation>Code and Comments

*/

/**

  • @author chris.jackson

*

  • To change the template for this generated type comment go to

  • Window>Preferences>Java>Code Generation>Code and Comments

*/

import com.sap.lcr.api.cimclient.CIMClient;

import com.sap.lcr.api.cimclient.CIMClientHandle;

import com.sap.lcr.api.cimclient.CIMOMClient;

import com.sap.lcr.api.cimclient.ClientFactory;

import com.sap.lcr.api.sapmodel.SAP_AppServJCODestination;

import com.sap.lcr.api.sapmodel.SAP_JCODestination;

import com.sap.lcr.api.sapmodel.SAP_JCODestinationAccessor;

import com.sap.lcr.api.sapmodel.SAP_MsgServJCODestination;

import com.sap.mw.jco.JCO;

import com.tssap.dtr.client.lib.protocol.URL;

public class sldpoke {

public void main() {

ClientFactory factory = ClientFactory.newInstance();

try {

final URL url = new URL("http://ex1d002a.eu.unilever.com:58300/sld/cimom");

String sldUsername = "cjacks01";

String sldPassword = "password";

CIMOMClient cimomClient = factory.createClient (url, sldUsername, sldPassword);

CIMClient cc = new CIMClient(cimomClient);

CIMClientHandle cch = (CIMClientHandle) cc;

SAP_JCODestinationAccessor jcoAccessor = new SAP_JCODestinationAccessor(cc);

SAP_JCODestination[] jcoDestinations = jcoAccessor.enumerateSAP_JCODestinationInstances();

JCO.Client jcoClient = null;

String user = null;

String pwd = null;

// iterate over all destinations

for (int i = 0; i < jcoDestinations.length; i++)

{

SAP_JCODestination jcoDestination = jcoDestinations;

user = jcoDestination.getLogonUser();

pwd = jcoDestination.getLogonPwd();

if (jcoDestination instanceof SAP_AppServJCODestination)

{

SAP_AppServJCODestination jcoDest = (SAP_AppServJCODestination) jcoDestination;

jcoClient = JCO.createClient(jcoDest.getLogonBCClient(),

user,

pwd,

jcoDest.getLogonLanguage(),

jcoDest.getAppServHost(),

jcoDest.getAppServNumber());

}

else if (jcoDestination instanceof SAP_MsgServJCODestination)

{

SAP_MsgServJCODestination jcoDest = (SAP_MsgServJCODestination) jcoDestination;

jcoClient = JCO.createClient(jcoDest.getLogonBCClient(),

user,

pwd,

jcoDest.getLogonLanguage(),

jcoDest.getMsgServHost(),

jcoDest.getSAPSystemName(),

jcoDest.getLogonGroup());

}

}

} catch (Exception e) {

}

}

}

and I am getting the message "The selection does not contain a main type". The class contains a 'main' function so I am at a loss as to what the problem is. Any ideas how I progress?

Kind Regards

Chris Jackson.

Former Member
Not what you were looking for? View more on this topic or Ask a question