12 messages in net.java.dev.jna.usersExample not running on Solaris 9 x86.
FromSent OnAttachments
Steve RamageMay 13, 2008 4:24 pm 
Timothy WallMay 13, 2008 5:05 pm 
Steve RamageMay 14, 2008 10:28 am 
Steve RamageMay 14, 2008 10:36 am 
Timothy WallMay 14, 2008 10:47 am 
Timothy WallMay 14, 2008 10:56 am 
Steve RamageMay 14, 2008 11:35 am 
Timothy WallMay 14, 2008 12:00 pm 
Steve RamageMay 14, 2008 1:51 pm 
Steve RamageMay 14, 2008 3:53 pm 
Steve RamageMay 14, 2008 6:03 pm 
Timothy WallMay 19, 2008 7:43 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Example not running on Solaris 9 x86.Actions...
From:Steve Ramage (qoox@steve.ipapp.com)
Date:May 13, 2008 4:24:07 pm
List:net.java.dev.jna.users

I have the simple example program: package com.sun.jna.examples;

import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.Platform;

/** Simple example of native library declaration and usage. */ public class HelloWorld {

public interface CLibrary extends Library { CLibrary INSTANCE = (CLibrary) Native.loadLibrary((Platform.isWindows() ? "msvcrt" : "c"), CLibrary.class);

void printf(String format, Object... args); }

public static void main(String[] args) { //System.loadLibrary("c"); CLibrary.INSTANCE.printf("Hello, World\n"); for (int i=0;i < args.length;i++) { CLibrary.INSTANCE.printf("Argument %d: %s\n", i, args[i]); } } }

Trying to run, when I try to run it I get:

java -Djna.library.path="/usr/lib" -cp jna.jar:. com.sun.jna.examples.HelloWorld

It works on another machine no problem, both using Java 5.

Looking at the truss output I see:

/1: xstat(2, "/var/tmp/jna14055.tmp", 0x080454CC) = 0 /1: xstat(2, "/usr/jdk1.5.0_15/jre/lib/i386/client/libc.so.1", 0x08045430) Err#2 ENOENT /1: xstat(2, "/usr/jdk1.5.0_15/jre/lib/i386/libc.so.1", 0x08045430) Err#2 ENOENT Exception in thread "main" java.lang.UnsatisfiedLinkError: /var/tmp/jna14055.tmp: ld.so.1: java: fatal: libc.so.1: open failed: No such file or directory at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1647) at java.lang.Runtime.load0(Runtime.java:769) at java.lang.System.load(System.java:968) at com.sun.jna.Native.loadNativeLibrary(Native.java:509) at com.sun.jna.Native.<clinit>(Native.java:91) at com.sun.jna.examples.HelloWorld$CLibrary.<clinit>(HelloWorld.java:11) at com.sun.jna.examples.HelloWorld.main(HelloWorld.java:20)

My class path is set to:

declare -x LD_LIBRARY_PATH="/usr/lib"

Finally I can call System.load('c'); without any problems.