error while trying to get connection

sami Mohammed sami.mohammed912 at gmail.com
Thu Aug 11 11:02:53 PDT 2011


Hello All,

I am a beginner to DBus

Here is my code I am trying to execute and I am getting error

@SuppressWarnings("rawtypes")
public class Client implements DBusSigHandler {

	public void handle(DBusSignal s) {
		if(s instanceof ProximitySignal.Connect)
			System.out.println("Got a connect for "+((ProximitySignal.Connect)
s).address);
		else if(s instanceof ProximitySignal.Disconnect)
			System.out.println("Got a disconnect fo
"+((ProximitySignal.Disconnect) s).address);
	}
	@SuppressWarnings("unchecked")
	public static void main(String[] args){
		System.out.println("Creating Connection");
		DBusConnection conn = null;
		
		try{
			conn = DBusConnection.getConnection(DBusConnection.SYSTEM);
		}catch(DBusException dbe){
			System.out.println("cannot make connection");
			System.exit(1);
		}
		
		try{
			conn.addSigHandler(ProximitySignal.Connect.class, new Client());
			conn.addSigHandler(ProximitySignal.Disconnect.class, new Client());
		}catch(DBusException dbe){
			conn.disconnect();
			System.exit(1);
		}
	}
	
}


Here are the errors

Exception in thread "main" java.lang.UnsatisfiedLinkError: no
dbus-java in java.library.path
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)
	at java.lang.Runtime.loadLibrary0(Runtime.java:823)
	at java.lang.System.loadLibrary(System.java:1028)
	at org.freedesktop.dbus.DBusConnection.<clinit>(Unknown Source)
	at com.avocent.test.Client.main(Client.java:23)


can any one tell me what is the mistake I am doing

Thank you
Sami


More information about the dbus mailing list