Annotations in Java binding

Tim Moloney t.moloney at verizon.net
Tue Apr 18 06:06:18 PDT 2006


Thiago Macieira wrote:
> Tim Moloney wrote:
>   
>> "rhythmbox.RhythmboxPlayer" doesn't exist
>>     
>
> Looks like you're calling out to the wrong interface. The XML file you 
> posted had interface org.gnome.Rhythmbox.Player.
>   

True, but rhythmbox.RhythmboxPlayer is the name of the Java class that 
was generated by running CreateInterface on that XML file.  I think that 
part is working correctly since I can run my simple test application 
(below) and Rhythmbox will be started if it isn't already running.

Tim Moloney


package rhythmbox;

import org.freedesktop.dbus.DBusConnection;

public class RhythmboxInterface {

  public static void main(String[] args) {
    try {
      DBusConnection conn = 
DBusConnection.getConnection(DBusConnection.SESSION);
      RhythmboxPlayer rp = 
(RhythmboxPlayer)conn.getRemoteObject("org.gnome.Rhythmbox",
          "/org/gnome/Rhythmbox/Player", RhythmboxPlayer.class);
      rp.playPause(true);
      conn.disconnect();
    }
    catch (DBusException e) {
      System.out.println("Error connecting to session bus");
      //  TODO Other exceptions?
    }
  }

}



More information about the dbus mailing list