- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- [Java JNI] Loading a shared image
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2005 06:46 AM
тАО03-24-2005 06:46 AM
[Java JNI] Loading a shared image
I am using Java 1.4.2 under OpenVMS 7.3.1 with ODS-5.
From our application, which is highly dynamic and plugin oriented, we load and unload Java components at runtime. Sometimes we have to integrate legacy code, which is done via JNI.
The problem is, that loading the SHRs the way HP suggests in their JNI example is not applicable for us, since this would require us to define a symbol for each installed library (and drop it when the component is uninstalled).
Java.lang.System provides two methods to load native code:
System.loadLibrary(String libname) --> this one requires a defined symbol
System.load(String path) --> takes an absolute path to the SHR.
Can anyone tell me which path syntax is expected by System.load?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2005 10:43 PM
тАО03-24-2005 10:43 PM
Re: [Java JNI] Loading a shared image
Perhaps I am mis-understanding some element of your problem description, but System.loadLibrary does not require a "symbol". The -libmame- parameter is used as a logical name (not a symbol).
Unloading dynamically loaded code is a whole different topic, and has complications (which I would expect, on first glance, to have other, deeper issues).
I have used this interface successfully. It does obey the logical name (for the native code; java code still needs to be on CLASSPATH).
Defining the logical name to point to different places from within java code should not be a problem (with the appropriate auxilliary code to invoke the system services to define/redefine the logical name).
I hope that the above is helpful.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-25-2005 07:06 PM
тАО03-25-2005 07:06 PM
Re: [Java JNI] Loading a shared image
Do you have any hints where to find code that allows the use of OpenVMS commands from within java?
I think that Runtime.exec(..) won't do, because this call spawns another process.
And, of course UNloading the native code is really a different issue and it's not supported by the Java API at all.
However, i still try to get System.load(pathname) to work, since this would render a logical name unnecessary (so I hope at least..)
Can't test this before Tuesday, since I have no access to an OpenVMS machine from home....
regards,
Bernhard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-25-2005 11:16 PM
тАО03-25-2005 11:16 PM
Re: [Java JNI] Loading a shared image
I have not needed to do things in this particular way (yet), but the following should work.
To the best of my knowledge, there is no restriction on the number of native mode libraries that you can connect to. I would thus do what you are attempting in the following way:
- Loan a basic JNI library which allows you to define/redefine a logical name in the process logical name table.
- Use that basic library to define the logical name.
- Then issue the loadLibrary function.
Since, as we noted earlier, unload is a whole different story, I would be careful to make sure that the quotas were sufficient, otherwise you will effectively be creating a situation with much the same virtual address behavior as a "memory leak".
I hope that the preceeding is helpful.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-27-2005 08:48 PM
тАО03-27-2005 08:48 PM
Re: [Java JNI] Loading a shared image
A little hint abbout shared images loaded in run time. I am not shure but the shared images are probably loaded using the LIB$FIND_IMAGE_SYMBOL run time library function.
When using LIB$FIND_IMAGE_SYMBOL you must have different image names/ logical names which points to different images. If you define the same logical name to two different images the function will not load the second image.
Example:
You have two shareable images with the same function:
void shrfunc () {printf ("Image A\n");}
and
void shrfunc () {printf ("Image B\n");}
(both linked /share with SYMBOL_VECTOR=(shrfunc=PROCEDURE) option)
Now the main program which loads and execute both image functions:
$DESCRIPTOR (logical_name , "MYSHAREIMAGE");
$DESCRIPTOR (procedure_name , "SHRFUNC");
$DESCRIPTOR (imagea , "dev:[dir]imagea.exe");
$DESCRIPTOR (imageb , "dev:[dir]imageb.exe");
void (*procedure) ();
lib$set_logical (&logical_name , &imagea);
lib$find_image_symbol (&logical_name , &procedure_name , &procedure);
(*procedure)();
lib$set_logical (&logical_name , &imageb);
lib$find_image_symbol (&logical_name , &procedure_name , &procedure);
(*procedure)();
Now the result (output) is
Image A
Image A
and not
Image A
Image B
what is supposed to be the result!
So when you define the logical name, give to each image a different name.
Bojan