guliver has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'm trying to create a JAVA GUI over a perl program (until now we used a TK GUI, but it looks quite obsolete and have some nasty bugs).

The requirements are:
  1. Perl program have to be run both in GUI mode (JAVA GUI) and in CLI mode (perl CLI).
  2. JAVA GUI have to be able to communicate with the perl program that actually does all the job (the GUI is there just to permit the user to choose/modify some options)
The options are:
  1. Use Java.pm and launch from there the JAVA GUI (from the preliminary tests seems to run slow, the GUI somtimes even freeze).
  2. Launch a jar that contains the JAVA GUI, and call perl subroutines from there.

Which one of these options did you think it's better? Have you ever use one of them and how.

Thanks.

Replies are listed 'Best First'.
Re: JAVA GUI for perl program
by PodMaster (Abbot) on Feb 03, 2006 at 14:32 UTC
    If you think Tk sucks, use something else, like Prima, or Wx, maybe even Gtk. All of the above beat the Java GUI option. Heck, using CGI beats starting up java.

    (GUI) Windows Programming FAQ

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

      (GUI) Windows Programming FAQ is really badly out of date. Judging by a comparison of the info at gtk.org, if would be counterproductive to use it except for links to GUI sites.
        Maybe you'd like to respond to the FAQ detailing how.

        MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
        I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
        ** The third rule of perl club is a statement of fact: pod is sexy.

      I forgot to mention this: the GUI must run on Windows (2000,XP,2003), Solaris, HPUX and in near future on Linux.

      So, from this point, Gtk is not a very good choice (it's hard to compile and run from a CD/DVD on Windows)

      Wx and Prima looks nice, I'll give them a try

      Some issues that I'm afraid of (because I get them in TK) are:

      • GUI that froze during procesing databases in the background - in Java the process can be launched on a separate thread (I know that this can be solved using threads in perl, but I'm not sure how well it's working on Windows).
      • Tree view of file system (like Tk::DirTree that is buggy)
Re: JAVA GUI for perl program
by philcrow (Priest) on Feb 03, 2006 at 15:04 UTC
    You can use Inline::Java to bridge Perl and Java. It supports GUI behavior. There is even a thin wrapper over Inline::Java which provides sugar for the task: Java::Swing. <disclosure>I wrote Java::Swing</disclosure>

    Phil

      I've tried Inline::Java, but it's quite slow (at least at start it seems to freeze for about 30'-1min, and we can't get this to the clients).
        The first time you run something with Inline::Java it must compile all the java code involved. It should be much faster on the second load, at least until you change the code and have to recompile. All Inline modules for compiled languages suffer this problem. But, Inline is good at caching the results of the compile. If you're a bit more clever than I, you can have that compilation happen during make or make test. Consult the Inline mailing list for details.

        Phil