facebook

How do deploy (and run) a Matisse app?

  1. MyEclipse Archived
  2.  > 
  3. Matisse/Swing UI Development
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #269473 Reply

    Mork
    Participant

    I’ve written a small utility using Matisse. It’s just a JDialog that displays some local machine info.

    However, when I try to “jar” it up and run it with something like:

    java -cp foo.jar GetLocalMachineInfo

    I get no where.

    Is there a nice way to create an “EXE” (for Windows, of course) or other thing I need to do to be able to run the matisse Java app outside of MyEclipse?

    Thanks in advance for all replies!!!

    M

    #269479 Reply

    Riyad Kalla
    Member

    M, you need to make sure to specify the Main-Class attribute in your MANIFEST file, that is what the java -jar command reads so it knows what to run. For example:

    
    Main-Class: com.mork.SystemInfoDialog
    

    then you can JAR up the project and do a:

    
    java -jar SystemInfo.jar
    
    #269481 Reply

    Mork
    Participant

    Thanks for your reply.

    Part of the problem, perhaps the main problem, is that the matisse jar file is not included in the “Exported” Jar file from the Matisse project -> Jar export.

    My main class does have: “Main-Class: GetSysInfo” in the manifest file, but the error seems more like the required Matisse Jar file wasn’t exported. I tried every combination in the export dialog I could think of:

    C:\temp>java -jar GetSysInfo

    Exception in thread “main” java.lang.NoClassDefFoundError: org/jdesktop/layout/G
    roupLayout$Group

    —————————

    It would be nice if you added a “build EXE” (okay, executable Jar) in some future version so it just “works”.

    Can you explain what I need to add to my Jar?

    I can’t seem to add the matisse (swing) jar to the project’s exported jar file.

    Thanks in advance.

    M

    #269485 Reply

    Riyad Kalla
    Member

    Ahh, Mork try and install the FatJar plugin for Eclipse. We haven’t solve this exporting issue yet, but I am pushing to add the FatJar plugin as part of MyEclipse. It will export the whole project into a runnable JAR, libraries and all.

    #269487 Reply

    Mork
    Participant

    Ok, will do. I ultimately want to have a “file” the user can double-click on in Windows. It would be nice if it had all the Java jars too so the user didn’t need to have a JRE installed.

    If memory serves, JBuilder had this functionality back in their JBuilder 7 release (4 or 5 years ago).

    Thanks.

    M

    #269489 Reply

    Riyad Kalla
    Member

    Ahh, and to address the EXE question (I skipped that), there is no nice way to do this. While JBuilder had this functionality it wasn’t a real EXE. There are commercial products that can actually build you a real honest-to-god EXE that will run and packages the JRE in it even… they slip my mind at the moment, but they weren’t cheap IIRC.

    #269490 Reply

    Mork
    Participant

    The FatJar plugin works fine.

    The problem is that when I create a shortcut, I see that stupid DOS window behind my little cool JDialog. I could just as easily have created a batch file. It would probably look better.

    I’ll look around for a real EXE converter from a JAR. It really doesn’t matter if it’s a JAR behind the scenes (like JBuilders). As long as “it” has the required java libraries so it runs like the user expects: a dialog and nothing else.

    Sigh…

    It’s no wonder why M$ hangs on…

    🙁

    #269491 Reply

    Riyad Kalla
    Member

    The problem is that when I create a shortcut, I see that stupid DOS window behind my little cool JDialog. I could just as easily have created a batch file. It would probably look better.

    That’s because you want to use the javaw.exe executable and not the java.exe executable. The javaw one is intended for windows and doesn’t show a console window in the back ground.

    If you don’t have size limitations you can deploy your app using web start or you could package it all up into a zip that includes the JRE, then in your bat file hard code the path:
    ./jre/bin/javaw.exe -jar ./lib/SysUtils.jar

    and then you are all set and your users just run the BAT file.

    #272415 Reply

    ylou
    Member

    I have a problem to run the example ContactEditor on a winodws xp pro.
    C:\MyEclipseWS\Jar>java -jar ContactEditor.jar
    Exception in thread “main” java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group
    The jar file includes swing-layout-1.0.jar in Path \lib and the content of MANIFEST.MF is

    Manifest-Version: 1.0
    Main-Class: my.contacteditor.ContactEditorGUI

    Even I put a swing-layout-1.0.jar in .\lib directory and run

    C:\MyEclipseWS\Jar>dir lib
    Volume in drive C has no label.
    Volume Serial Number is 5403-D9F6

    Directory of C:\MyEclipseWS\Jar\lib

    07/06/2007 09:14 AM <DIR> .
    07/06/2007 09:14 AM <DIR> ..
    07/03/2007 02:52 PM 140,545 swing-layout-1.0.jar
    1 File(s) 140,545 bytes
    2 Dir(s) 21,091,532,800 bytes free

    C:\MyEclipseWS\Jar>java -cp .;.\lib\swing-layout-1.0.jar -jar ContactEditor.jar
    Exception in thread “main” java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group

    I still get the same error.
    Thanks for any help.
    ylou

    #272434 Reply

    Riyad Kalla
    Member

    ylou,
    The last thing you tried was right, except you cannot use -cp and -jar together… you’ll have to change your command to something like this:

    
    java -cp .;.\lib\swing-layout-1.0.jar my.contacteditor.ContactEditorGUI
    
    #272982 Reply

    ylou
    Member

    Riyad,

    Thank you very much. It works after I run
    java -cp .;.\lib\swing-layout-1.0.jar;ContactEditor.jar my.contacteditor.ContactEditorGUI

    it will failed without ;ContactEditor.jar.

    I have another question. Why java does not use the swing-layout-1.0.jar in the application jar file ContactEditor.jar? To run the application I always need .\lib\swing-layout-1.0.jar whether or not the application includes the lib jar file.

    Thanks.
    Ylou

    #272983 Reply

    Riyad Kalla
    Member

    Ylou,
    Java won’t parse embedded JARs, so if you have a JAR inside a JAR, it won’t load the embedded one (which is unfortunate, it would make packaging a lot easier).

    One way around this is to unzip ALL the JARs and combine them into one huge JAR, this is what the “FatJar” plugin does for Eclipse. It takes all the JARs on your build path, and all the classes from your project, unzips them all together, then compresses them all into a single JAR, so you can just do:
    java -jar MyJar.jar

    or the like.

    #272986 Reply

    ylou
    Member

    Riyad,
    Thanks.
    ylou

Viewing 13 posts - 1 through 13 (of 13 total)
Reply To: How do deploy (and run) a Matisse app?

You must be logged in to post in the forum log in