Urgent! Need to convert a .jar to a mac executable!

Discussion in 'Mac Programming' started by jar2app, Apr 25, 2014.

  1. jar2app macrumors newbie

    Joined:
    Apr 25, 2014
    #1
    Hi guys, I'm working for a client for which I developed a simple java application (I packed it in a .jar) but he doesn't want to launch it using terminal (java -jar jarname.jar). I know a couple of tools which run on mac only which can automate the task of making a mac executable app from a .jar file but I don't own a mac or have anyone handy who owns it at the moment!
    So I thought I could ask here if someone wants to help!
    The two apps I found are:
    http://alvinalexander.com/apple/mac/java-jar-bundler/Getting_started_with_Jar_Bu.shtml

    and

    http://www.centerkey.com/mac/java/

    I'm looking for someone who is kind enough to run one of this programs for me and create the mac app! I know it's a bit of a akward request, but I'm really in need of such utility and I can't do that in anyother way! Please let me know if you can help! Thanks!!!
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    What OS X version is the client running?

    What Java version?

    Is the app a GUI app, or a command-line tool?


    Tell the client to double-click the jar file. I just tried this on a 10.8.4 OS, which has Apple's Java 6 on it, and it correctly opened and displayed the Swing window. The manifest in the jar should point to the main class (which it does, otherwise your -jar option wouldn't work). That should be all that's needed to have a double-clickable jar.

    If your app is a command-line tool that relies on command-line args, etc., then encapsulating the correct command-line into a Run Shell Script action in Automator may be a better approach. I realize you don't have a Mac, but your client does. You could have them join here and post a question asking for specific details.
     
  3. bflowers macrumors 6502a

    Joined:
    Jul 19, 2006
    #3
    Couldn't you have the client build the executable using one of those apps? The first one looks easier for the less command line savvy.
     
  4. ratsg macrumors 6502

    Joined:
    Dec 6, 2010
    #4
    A .jar file is nothing other that a .zip file with a renamed suffix.

    If the end user doesn't want to do the

    % java -jar filename.jar ,

    then just stick that stuff into a shell script that the end user can double-click on.
     
  5. jar2app thread starter macrumors newbie

    Joined:
    Apr 25, 2014
    #5
    My Java version is "1.7.0_51", hopefully he is on Java 1.7 too (we are still at the phase where he is trying to open the application so we didn't get into that yet..) but anyway the app is a command line tool which is not very complicated code-wise so I'm pretty sure it will work on Java 1.6 too (I will suggest him to update anyway to 1.7 for security risks involved with 1.6).

    Yes I know that if it was a gui app it would open straight away, but yea as I said it's a command line tool and for what I know Java won't open them by just double clicking. I confirm manifest is pointing to the main class otherwise as you stated it wouldn't open by calling it in command line.
    I also provided him with a .sh script and a .command script with commands to launch the app (java -jar jarfile.jar) and instruction on how to make the files executable (chmod..) but he couldn't make it work... So yea I was thinking about those jar to app tools... It would also look more professional and given he has commited to pay me but he didn't yet... (it was a job by auction) I'd like to give him the least possible overhead..... so is there any chance you (or anyone else reading) could help me with those bundling app?
    I think it's just a matter of a couple of clicks!

    Thank you a lot!
     
  6. jar2app thread starter macrumors newbie

    Joined:
    Apr 25, 2014
    #6
    As you can see by my previous reply, I tried that of course, but he just can't make it work...
     
  7. ratsg macrumors 6502

    Joined:
    Dec 6, 2010
    #7
    did he do a

    % chmod +x <filename.jar>

    to make the script executable?
     
  8. jar2app thread starter macrumors newbie

    Joined:
    Apr 25, 2014
    #8
    I told him to do that(read above), and he said he did, but still he couldn't make it work... He did not explain me what was not working, and anyway he is not a computer person! I don't think he wants to mess with terminal anymore. He would just like to have the app work on double click... That's why I came here...
    If some of you got nothing to do, it would be great if you could look into those 2 apps... I would pay you a beer if you were here, or give me instruction on how to reach you by paypal.
     
  9. jar2app thread starter macrumors newbie

    Joined:
    Apr 25, 2014
  10. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #10
    Stop it. You waited 6 hours.

    If it's a command line app, and your client doesn't want to use terminal, you're going to have problems. Potentially you could write an AppleScript that accepts all inputs via dialogs, then uses system to run your tool and collect the output, then display it. The problem there is you would need to learn AppleScript, and potentially require the jar with your code to reside in a specific place.

    You haven't provided the program you want app-ified, but I don't even know what you'll do once it is if it requires interaction in terminal. Also, you're soliciting something for-pay, which is forbidden here.

    Post what you want to have turned into an app. Maybe someone will help you. Also, don't assume the simplicity of your program will determine what version of Java it will run on. The version of the classes is in the first few bytes. An older VM will not load classes compiled for a newer version.

    We're happy to help, but you're being very demanding for something you've stated you are potentially being paid for.

    -Lee
     
  11. moonman239 macrumors 68000

    Joined:
    Mar 27, 2009
    #11
    Does the executable accept command-line arguments? If so, are they necessary?
    I think you want an app that loads the shell script. I'm not very familiar with Java, but maybe you can develop a launcher in Java that has a GUI, and deploy that with a shell script.

    Or, you could give the app a GUI that runs when the user double-clicks the app's .jar file.
     

Share This Page