This article describes how developers can leverage this framework to deploy their http://www.aliyun.com/zixun/aggregation/7155.html on ibm®websphere®application Server J2ee™ applications are integrated with these C + + libraries.
Ibm®websphere®application Server is a robust and highly available middleware environment compatible with JAVA®EE 6, which provides a platform to host and manage various enterprise applications. Some users may have encountered scenarios where they need to integrate java-based applications with native implementations based on C + +. For example, applications involving defense, aviation, weather forecasts, and other scientific applications contain algorithms that can only be implemented using these native languages and are too complex, too difficult, or too risky to implement in Java.
To integrate these C-based implementations with Java programs, you need to create a connection between the two programming language APIs in some way. Java Native Interface (JNI) provides this cohesive way to exchange data between Java and the C + + API. To implement this solution, you need to define the interface in Java using a method that you want to expose to other Java classes, generate a header file from the compiled code for that interface, and then import the header file into a native shared library module, such as a dynamic link library (. dll) for Windows® and a Shared objects (. So) libraries for UNIX® systems. These modules can be created from a variety of tools provided by multiple vendors.
The steps described in this article simplify the process of integrating java-based applications that are deployed on a WebSphere creator Server with a C-based implementation through Java Native Interface (JNI). With the content of this article, you will be able to create, configure, and invoke shared libraries for WebSphere creator Server.
The information contained here applies to IBM WebSphere creator Server V6.1, V7, and V8, and assumes that you are familiar with the appropriate IBM rational® tools. Note that the sample provided here is very basic and is used only to demonstrate the advanced development process involved, and does not contain data validation or other good practices that are typically included in typical application development.
Create a native shared library
Open the IBM integration Designer and create a stand-alone Java project (see Figure 1). Figure 1. To create a stand-alone project
Create a Java class that contains the methods that you want to associate with native access (see Figure 2). The method declaration will depend on the signature of the C method that you want to invoke. In this case, suppose a third party C API requires a simple type and an array of data (in this case, a double-precision array). (to invoke another native library, you need to associate the file with your DLL by importing its header file during the header file implementation.) ) Figure 2. Creating Java Classes
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.