Display Name
Display Name

Reputation: 8128

Running GTK through Java on Windows

I've found that there is only one project that allows to do this (from this answer).
I'm trying to get it working (just for fun). So far I have built java code via Eclipse (had to add slf4j jars to build path), then modified build_jni.bat and run it without error messages, so I think it did its work too.

Now I'm at the third sub-step of the README, which says "Build the c portion next. You will need to point the gcc compiler and linker to the /include and /lib folders of the extracted GTK bundle.". I'm not quite sure what to do next... there is no "makefile" or similar thing. Should I throw files to compiler and hope it will figure out everything from scratch? Or what?

Upvotes: 0

Views: 767

Answers (1)

Bill Hull
Bill Hull

Reputation: 36

It was my plan to release a bundle of completed binaries so that users don't have to build everything from scratch but there didn't seem to be much interest in the project so I moved on to something else. Maybe I'll take another look at it now that there is a link from StackOverflow.

I used Eclipse to build everything using the MinGW GCC toolchain. I remember that it took a while to get MinGW setup and configured to work with Eclipse and I don't recall all the steps right now.

Once it is installed and configured you will need to modify the project settings:

C/C++ Build -> Settings -> Tool Settings -> GCC C Compiler -> Includes

"C:\Program Files\Java\jdk1.6.0_25\include"
"${workspace_loc:/${ProjName}/src/main/c/include}"
"C:\Program Files\Java\jdk1.6.0_25\include\win32"
"C:\data\Projects\java-gtk\gtk3\include\gtk-3.0"
"C:\data\Projects\java-gtk\gtk3\include\glib-2.0"
"C:\data\Projects\java-gtk\gtk3\lib\glib-2.0\include"
"C:\data\Projects\java-gtk\gtk3\include\cairo"
"C:\data\Projects\java-gtk\gtk3\include\pango-1.0"
"C:\data\Projects\java-gtk\gtk3\lib\gtk-3.0\include"
"C:\data\Projects\java-gtk\gtk3\include\gdk-pixbuf-2.0"
"C:\data\Projects\java-gtk\gtk3\include\atk-1.0"

C/C++ Build -> Settings -> Tool Settings -> MinGW C Linker -> Libraries

gtk-3
cairo
pango-1.0
gobject-2.0
glib-2.0
gdk-3
atk-1.0
gdk_pixbuf-2.0

C/C++ Build -> Settings -> Tool Settings -> MinGW C Linker -> Library search path

"C:\data\Projects\java-gtk\gtk3\lib"

You will need to change some of the paths above depending on where you extracted the gtk bundle.

The project is not complete and there might not be enough content to build a complete UI. But you are welcome to add any additional pieces you think are necessary.

Upvotes: 2

Related Questions