Go Back   UNIX Socket FAQ > Languages > Java

Reply
 
Thread Tools Display Modes
  #1  
Old 10-29-2009, 12:22 PM
amrish amrish is offline
 
Join Date: Oct 2009
Posts: 3
Default Error while loading .a file on AIX machine

Hi ,
I am getting error while loading a .a file using java .
My java code is
Code:
import java.util.*;
import java.lang.*;
import java.net.*;
public class GetOSName
{
  public static void main(String argas[]) {
    try{
      String osName= System.getProperty("os.name");
      System.out.println("Operating system name =>"+ osName);
      System.out.println("Loading Files");
      System.load("/lib/libtest.a");
      System.out.println("Files loadeds");
      
    }catch (Exception e){
      System.out.println("Exception caught ="+e.getMessage());
    }
  }
}
It was compiled successfully on AIX but when i tried to run it

It has given me following error

Operating system name =>AIX
Loading Files
Exception in thread "main" java.lang.UnsatisfiedLinkError: /lib/libtest.a: load ENOEXEC on shared library(s) /lib/libtest.a
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.jav a:2120)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java :1955)
at java.lang.Runtime.load0(Runtime.java:773)
at java.lang.System.load(System.java:885)
at GetOSName.main(GetOSName.java:13)

Please help me in this regards
Reply With Quote
  #2  
Old 10-30-2009, 04:27 AM
i3839 i3839 is offline
Oddministrator
 
Join Date: Jun 2003
Location: Amsterdam
Posts: 2,002
Default

.a are static libraries useful for compile-time linking, not dynamic runtime linking.
If you want to use it as a dynamic library turn it into a .so (or whatever AIX uses).
Reply With Quote
  #3  
Old 10-30-2009, 04:32 AM
amrish amrish is offline
 
Join Date: Oct 2009
Posts: 3
Default

but it should load any type of library. I was unable to compile a .so file.
Reply With Quote
  #4  
Old 10-30-2009, 09:44 AM
i3839 i3839 is offline
Oddministrator
 
Join Date: Jun 2003
Location: Amsterdam
Posts: 2,002
Default

Well, it won't load the library of Alexandria either, will it?
Reply With Quote
  #5  
Old 10-30-2009, 09:53 AM
amrish amrish is offline
 
Join Date: Oct 2009
Posts: 3
Default

I don't know about library of Alxendaria ,,but it is not loading a .so file .
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:42 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.