Search code examples
javajava-native-interfacewebsphereshared-libraries

How to build Java project while using shared library?


I have an Java class which needs to access an shared library class. How can I write the code to use shared library and build the project?

public void callApp(){
    ExternalProp prop = new ExternalProp();
    prop.set("name", "test user");
    prop.set("eligibility", "master");
    prop.set("id", "103452");
}

ExternalProp is available in driver-prop.jar file, which I am asked to use from shared library (not to be added to the project).

Since ExternalProp is not in the build path, I get an compile time error as

ExternalProp cannot be resolved to a type

Can someone help?


Solution

  • I have resolved this by,

    1) Compilation - Added the library as an external JAR maintained in a shared location and updated the classpath (build path) to refer the JAR. JAR is maintained outside of the project.

    2) Deployment - Created a shared library in Web sphere environment and referenced this library to the application.

    https://www.ibm.com/support/knowledgecenter/en/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/ucws_rsharedlib_map.html