Search code examples
eclipsejarjco

Load SAP's jcoDestination from a .jar file


I have a SAP connection already locally running, with a XXX.jcoDestination on my Project folder (Eclipse Mars). When I export my project generating a .jar I can not get the connection working, although the XXX.jcoDestination was correctly exported (on my opinion!).

I have already tried all three options while exporting, and none of them managed to work.

Have anyone got an idea?

If there is not possible to use this configuration, I would like to pass directly the connection parameters (programmatically or means an external DD.BB.) rather than using the instruction JCoDestinationManager.getDestination(ABAP_AS).

Thanks in advance for any help!!


Solution

  • You have two optyions to read from custom path

    • Option 1 : Write the file to any path and set the location to the file in system property with key "jco.destinations.dir"

      System.setProperty("jco.destinations.dir", "path to your properties file");

    • Option 2: create custom destination implements DestinationDataProvider and override parent method @Override public Properties getDestinationProperties(final String sapServerConnectionName) {

    Please find complete code sample at Sample sap jco connection There are two projects:

    1. sapjcoclient_1 the most important line is set environment variable System.setProperty("jco.destinations.dir", "/var/sap/conf/"); for sap jco client to read from different folder

    2. sapjcoclient_2 implement custom destination to read from different folder.