Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Run Qt Jambi From Eclipse



  • Hello,

    I've been using PyQt for quite some time and wanted to start working with Qt Jambi in Java. I have Eclipse installed as that seems to be one of the more common Java editors and there are Qt plugins for that.

    I can't seem to get anything involving Qt to run. I installed using the installer from Sourceforge for 4.7 Jambi. The demo works fine. But when I run Eclipse to start working Eclipse doesn't recognize com.trolltech.qt.core.* or com.trolltech.qt.gui.*. I copied the example "here (Analog clock)":http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/qtjambi-analogclock-code.html and it still doesn't work.

    I must not have Qt Jambi installed correctly for Eclipse.

    I'd really like to understand two things;

    1. How to set up Qt Jambi so that the libraries are recognized by Eclipse
    2. How to add libraries in such a way that I can import them into Eclipse (perhaps an Eclipse specific question)

    Thanks, I'm really new with Eclipse and Java, so I appologise if the solution is trivial but I've been searching for a solution all day.

    Thanks
    Kyle



  • Hi, and thanks for having interest in Jambi!

    First of all, please tell you operating system? 4.7 Linux beta package has a certain bug that forces undoing of chrpaths before they actually work. Other packages should work without problems.

    I’m not familiar with Eclipse myself, but it has GUI for adding libraries and such to project and so on. All possible, I’ve done it, though I just appended same kind of arguments I used on CLI.

    I myself think, that unless you really want to, there is no need to use Eclipse. I’ve seen that IntelliJ Idea’s open source version is viable alternative for Java, though I do my small Java bits with KDevelop (which does not have Java support AFAIK most of time.

    If you have any specific error, please tell us the error so we can see what’s wrong with your setup :)



  • I think I may have figured out the problem. Apparently Java or Eclipse allows you to import libraries in several different ways. I found that I could add the qtjambi*.jar files to the build path as an external archive and then Eclipse seemed to find the libraries. I still haven't compiled though to test as the code isn't quite finished yet.

    One frustrating thing that I found which made me think that there was something wrong with qtjambi was that the documentation on the install.html file is incorrect. It says

    //Windows
    java -cp qtjambi-4.5.0_01.jar:qtjambi-win32-msvc2005-4.5.0_01.jar... com.trolltech.launcher.Launcher

    This didn't work at first and I couldn't figure out why until I read the Java compiler information that the -cp arguments should be ; separated not : separated. I changed that and it worked fine. Just something that the community should be aware of for people like me starting with qtjambi.

    Do the editors that you mentioned support the qt designer? There is apparently support for designer in Eclipse (though I haven't gotten it to work). That was why I was using Eclipse. I never used the designer with pyqt myself but thought that I might like it if it was easier to use than just imagining what the GUI would look like.



  • As an update and hopefully help for other people like me.

    To build a qtjambi program in Eclipse you must;

    1. Start a new project.
    2. Right click on the project folder.
    3. Select "Build path" -> "Add External Archives..."
    4. Browse to your qtjambi install directory.
    5. Select qtjambi-<version>.jar, qtjambi-<system>-<builder>*.jar
    6. Write your program in the main() class.
    7. Run as Java Application

    Hope this helps.



  • Thanks for your information, I’ll try to remember this next time someone asks :)

    [quote author="covingto" date="1325509289"]
    Do the editors that you mentioned support the qt designer? There is apparently support for designer in Eclipse (though I haven't gotten it to work). That was why I was using Eclipse. I never used the designer with pyqt myself but thought that I might like it if it was easier to use than just imagining what the GUI would look like.[/quote]

    The Eclipse Qt Jambi integration was closed source, so we don’t have access to it. Therefore that old package may have quite a bit of problems of working; I remember there was a talk about it somewhere...

    We do have a designer plugin though. These plugins are for Qt designer to save designer files in Jambi compliant format and then compiled with JUIC tool instead of UIC into Java. Extension for these files is .jui instead of .ui of standard files.

    We have been playing on Linux and successfully used Qt designer for Jambi, so I guess it should work with Windows too. However, if you can’t (or don’t want) to make it work, those files can also be converted into Jambi format, though this is not optimal: http://stackoverflow.com/questions/5774663/how-to-convert-ui-file-to-jui-file



  • 开发 Qt



  • Windows7 中文


Log in to reply