Results 1 to 7 of 7

Thread: Qt <-> Java - Best Practices?

  1. #1
    Join Date
    Jun 2006
    Posts
    12
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Qt <-> Java - Best Practices?

    Hello All-

    I have a project that I expect to have to integrate some java code with Qt code. The question is whether or not there is some neat Qt trick to do this, or should I just go through "standard" processes of calling methods back and forth? If so, are there standard practices other folks here use? I did some googling around and it seems that there are a number of ways to do this in the general C++<->Java manner. Any hints as I go down this unfortunate path?

    Thanks!

    -Lance

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt <-> Java - Best Practices?

    I suggest you wait a little as Trolltech is preparing Java bindings for Qt, which would surely make your life much easier.

  3. The following user says thank you to wysota for this useful post:

    mentat (18th July 2006)

  4. #3
    Join Date
    Jun 2006
    Posts
    12
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt <-> Java - Best Practices?

    Quote Originally Posted by wysota
    I suggest you wait a little as Trolltech is preparing Java bindings for Qt, which would surely make your life much easier.
    Thanks for the info! I was hoping for that. Unfortunately, for the proof-of-concept I'm putting together, I'll need the bindings sooner rather then later - so I guess standard C++<->Java methods will be the way to go for now. Do you know how long we'll have to wait for these bindings (ie: are we talking weeks, months, or unknown)?

    Thanks!

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt <-> Java - Best Practices?

    I think there are some 3rd party Java-Qt3 bindings available (http://sourceforge.net/projects/qtjava). As for Qt4 bindings from Trolltech, they didn't specify any release date, but I think it'll be in Q4 this year (but that's my personal wild guess, no warranties given).

  6. #5
    Join Date
    Jun 2006
    Posts
    12
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt <-> Java - Best Practices?

    Quote Originally Posted by wysota
    I think there are some 3rd party Java-Qt3 bindings available (http://sourceforge.net/projects/qtjava). As for Qt4 bindings from Trolltech, they didn't specify any release date, but I think it'll be in Q4 this year (but that's my personal wild guess, no warranties given).
    Thankfully, I don't really have to worry about GUI/Window stuff. It's really just "execute this function", "execute that function" kind of stuff. I do want to make the Java code work as a QPlugin, so I'll need to build some wrapper code for this functionality. I'm playing with that now.

  7. #6
    Join Date
    Jul 2006
    Posts
    36
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt <-> Java - Best Practices?

    Hi

    You can use JNI to interface qt <--> c++ <--> java.
    For more information google->JNI TUTORIALS

  8. #7
    Join Date
    Jun 2006
    Posts
    12
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt <-> Java - Best Practices?

    Well it was easier said then done in the search for call Java from C++. Java folks can't imagine that anyone would actually write a C++-based program that would call a Java routine or two. Almost every source I found would always say something along the lines of JNI is for those times when you don't have time to port a native routine to Java. I even found a forum site that answered my C++->Java question by honesty suggesting that the person should re-write the code in Java because Java is "better." Talk about a poor response to a good question! Anyway, it took a lot of searching to find a simple "Hello World"-type example, but here are few for other developers who may have the same question as I.

    http://www-128.ibm.com/developerwork...iexamples.html

    http://www.inonit.com/cygwin/jni/invocationApi/

Similar Threads

  1. What are your favourite C++ books?
    By eugen in forum General Programming
    Replies: 84
    Last Post: 12th January 2021, 17:47
  2. UICTable listview subitems with java
    By cqtkitty in forum Qt Programming
    Replies: 1
    Last Post: 15th March 2006, 09:59
  3. Embedding Java in Qt
    By learnerplts in forum Qt Programming
    Replies: 2
    Last Post: 27th February 2006, 16:45

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.