hypfvieh / dbus-java

Improved version of java DBus library provided by freedesktop.org (https://dbus.freedesktop.org/doc/dbus-java/)
https://hypfvieh.github.io/dbus-java/
MIT License
185 stars 73 forks source link

dbus-java-dbus-java-parent-3.0.2 installation #73

Closed LotekB closed 4 years ago

LotekB commented 5 years ago

Hello, I am going to install and evaluate the dbus-java-dbus-java-parent-3.0.2. The "mvn test" seems to work (with some small errors). Then I've noticed the two almost identical directories: ./dbus-java/src/main/resources/ and ./dbus-java/target/classes/ with Makefiles.

In the INSTALL file in these directories it is stated, that for the successful compilation, the http://www.matthew.ath.cx/projects/java/ libraries are necessary.

I thought, these libraries are part of the old implementation (2.7.x versions), which in turn in not compatible (according to the README.md file) with this library.

Could you please explain the dependencies between the project and these two directories and describe the steps of the full installation?

Thank you for your help,

with best regards,

Bogdan

hypfvieh commented 5 years ago

First of all, you don't have to build it yourself because 3.0.2 is available in maven central, so you can just add it to your maven/gradle project.

The reason for the duplicated make files is the maven build process. Maven copies everything from src/main/resources to target directory.

I thought, these libraries are part of the old implementation (2.7.x versions), which in turn in not compatible (according to the README.md file) with this library.

The comment in README.md means only the java code and not the c code. The binaries (the c library to create unix sockets) is still the old original version.

This should inform developers that they have to change their code to be able to use the new library version (=> not a drop-in replacement).

If you want to build the native libs yourself, you have to build the code in src/native e.g. using the compile_native.sh shell script. GCC and some other dev-libs/headers are required to do this.

LotekB commented 5 years ago

Hello David,

Thank you for your explanations, unfortunately I am not coming clear with the make process. Also the compile_native.sh script makes some problems.

Questions to resources directory and make:

Could you please give me the steps for the successful make install call? The most important for me is the possibility to call the CreateInterface.sh scripts. I've also seen the CreateInterface test in the new dbus-java-utils 3.0.2 library. And again the question - Could this library be used directly? If yes how? Questions to the native directory and the compile_native.sh script

Thank you for your help (sorry for bothering you)

Regards,

Bogdan

On 08/24/2019 08:56 AM, David M. wrote:

First of all, you don't have to build it yourself because 3.0.2 is available in maven central, so you can just add it to your maven/gradle project.

The reason for the duplicated make files is the maven build process. Maven copies everything from src/main/resources to target directory.

I thought, these libraries are part of the old implementation (2.7.x versions), which in turn in not compatible (according to the README.md file) with this library.

The comment in README.md means only the java code and not the c code. The binaries (the c library to create unix sockets) is still the old original version.

This should inform developers that they have to change their code to be able to use the new library version (=> not a drop-in replacement).

If you want to build the native libs yourself, you have to build the code in src/native e.g. using the compile_native.sh shell script. GCC and some other dev-libs/headers are required to do this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hypfvieh/dbus-java/issues/73?email_source=notifications&email_token=AM7OHYEOFF2AJJJX4RVTBO3QGDLRFA5CNFSM4IPCRUB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5B2IZI#issuecomment-524526693, or mute the thread https://github.com/notifications/unsubscribe-auth/AM7OHYHPH3OTROZMXIZCGPLQGDLRFANCNFSM4IPCRUBQ.

--

Bogdan Lotko

bogdan@lotko.at Phone: +43 1 2852458 Mobile: +43 676 6615012

hypfvieh commented 5 years ago

I still don't understand why you want to compile everything yourself, when you are just interested in running the interface creation tool.

Anyway, this is how you compile the native library:

  1. make sure you have JAVA_HOME environment variable set to your JDK directory (at least Java 8 required)
  2. make sure you have gcc and make installed
  3. Go into the directory of your cloned 3.0.2 dbus-java repo
  4. Change directory to subproject 'dbus-java'
  5. Use mvn compile to create the required class files
  6. Change directory to subproject dbus-java/src/native
  7. Call compile_native.sh like this: sh compile_native.sh /tmp $(readlink -f ../../) $(readlink -f ../../target/classes/)

This will create the native library in /tmp/native

Regarding your questions: The libraries from matthew.ath.cx (Matthew Johnson) are not required at all. In version 3.0.2 dbus-java already contains the classes from the libunix-java project of Matthew Johnson.

In fact dbus-java is a fork of the dbus-java implementation from matthew.ath.cx because the original library was written for Java 5 and was never uploaded to Maven Central. The original lib was also never updated for the last 10 or 15 years, so I took over to put it to some better shape and make it available in Maven Central as the original was never uploaded.

The only thing where the original lib comes into play is when you install libunix-java using your package manager on linux (e.g. apt on debian/ubuntu). Then a ready-to-use version of the library with the required native libs is installed. dbus-java will then use this native-library instead of the compiled native lib provided in src/main/resources/lib.

But again, if you just want to use the createInterface tool, just use the maven artificats like this: 1) download the dbus-java artifact from here. 2) download the dbus-java-utils from here 3) download slf4j-api from here 4) optional: download slf4j-simple to get more/better logging (find it here) 4) put all files into the same directory 4) open a shell and switch the directory you put all the files in 5) Run java: java -cp dbus-java-3.0.2.jar:dbus-java-utils-3.0.2.jar:slf4j-api-1.7.25.jar:slf4j-simple-1.7.26.jar org.freedesktop.dbus.bin.CreateInterface

You have to add some more parameters after the CreateInterface class name to provide the required information for the util for creating the interface files of your desired dbus object.