2


I am trying to build a JNI wrapper for using Ubuntu's AppIndicator in a Java application. I have some experience in C/C++, though no experience in GTK and Ubuntu development.

I have already done some research on AppIndicators and compiled a sample program with this makefile:

NAME=indicator
CFLAGS=-g -Wall -o $(NAME)
GTKFLAGS=-export-dynamic `pkg-config --cflags --libs gtk+-2.0`
SRCS=indicator.c
CC=gcc
INCLUDES=-I/usr/include/libappindicator-0.1/ -L/usr/lib -lappindicator

all: main

main: $(SRCS)
    $(CC) $(CFLAGS) $(SRCS) $(INCLUDES) $(GTKFLAGS)

I was hoping that the shared library needed for AppIndicators would come preinstalled with recent (X)Ubuntu versions, but when I compile against libappindicator-0.1, and try to run the resulting binary on a fresh Xubuntu 14.04.4, it says that the shared library could not be found. From the contents of /sbin/ldconfig -p on Xubuntu it seems that libappindicator3.so.1 is installed, but I don't know how to build against that. When I include libappindicator3-0.1 in the makefile, the program still seems to be compiled against the same .so as before.

Thus, I'm hoping for your help with these questions:

  • There seem to be multiple versions of AppIndicator, such as libappindicator-0.1, libappindicator3-0.1, libappindicator3-1 etc. What is the difference between these versions?
  • What version do I have to use to not require users to install an additional library? What version of libappindicator comes shipped with recent versions of Ubuntu and Xubuntu?
  • How do I compile against libappindicator3.so.1?
  • What version of GTK do I need to use for AppIndicators to work? 2 or 3?

Any help is highly appreciated!

3
  • Could you give some explanation about why you are trying to run an appindicator from Java? What caught my eye for this question was Java - years ago I had a Java library I had written and wanted to display outputs from that library in an appindicator. I ended up learning Python and wrote my indicator and then ported the library to Python. Refer to launchpad.net/~thebernmeister/+archive/ubuntu/ppa for examples of how to write an indicator - specifically indicator-stardate was what I originally wrote to go from Java to Python. Apr 11, 2016 at 23:44
  • @Bernmeister Well, because I already have a multi-platform Java application that uses Java TrayIcons. However, as TrayIcon isn't supported on some Ubuntu derivates (such as Xubuntu), I was thinking of building a compatibility layer and using AppIndicators on Ubuntu-based systems.
    – FD_
    Apr 12, 2016 at 14:16
  • Depending on how easily you can expose some sort of API to your Java application, you could alternatively write the appindicator in Python and then invoke call the Java API using subprocess call/check_output. Apr 12, 2016 at 22:42

0

You must log in to answer this question.

Browse other questions tagged .