Jar Command line

Discussion in 'Java' started by tutor5, May 18, 2008.

  1. tutor5

    tutor5 Guest

    Hi, guys.

    can anyone help me. i have created an executable jar file in my GUI
    program. it works, i tried the same thing on another non-gui program
    and it does not work.
    can anyone help me on how can i do it for non-GUI programms.

    Thanks
    tutor5, May 18, 2008
    #1
    1. Advertising

  2. On May 18, 7:26 pm, tutor5 <> wrote:
    ...
    > can anyone help me.


    That really depends upon you. Can you find
    your shift key and apply once at the start
    of each sentence? (A mostly unrelated matter,
    but it might indicate the basic intelligence
    you need for operating the Jar command.)

    >...i have created an executable jar file in my GUI
    > program. it works, i tried the same thing on another non-gui program
    > and it does not work.


    Perhaps it is just lazy. Did you try flogging
    it with a whip, or perhaps offering it inducements?

    More techically. What do you mean by 'not working'?

    What was your input and output? *Exactly*.

    > can anyone help me on how can i do it for non-GUI programms.


    I can think of no differences between creating
    a Jar for a GUI'd app., as opposed to creating
    a Jar for a non-GUI'd app., but perhaps the problem
    lies in the output, which for a 'self executing'
    non-GUI'd app. is effectively invisible (unless
    the programmer has taken special effort to dump
    it to logs, or ..whatever).

    --
    Andrew T.
    PhySci.org
    Andrew Thompson, May 18, 2008
    #2
    1. Advertising

  3. tutor5

    voorth Guest

    On May 18, 11:26 am, tutor5 <> wrote:
    > Hi, guys.
    >
    > can anyone help me. i have created an executable jar file in my GUI
    > program. it works, i tried the same thing on another non-gui program
    > and it does not work.
    > can anyone help me on how can i do it for non-GUI programms.
    >
    > Thanks


    Ask yourself the following questions:
    - What is my main class?
    - What does my manifest look like?
    - What is my classpath?

    HTH

    Henk van Voorthuijsen
    voorth, May 19, 2008
    #3
  4. tutor5

    Roedy Green Guest

    On Sun, 18 May 2008 02:26:26 -0700 (PDT), tutor5 <>
    wrote, quoted or indirectly quoted someone who said :

    >can anyone help me. i have created an executable jar file in my GUI
    >program. it works, i tried the same thing on another non-gui program
    >and it does not work.
    >can anyone help me on how can i do it for non-GUI programms.


    gui or non-gui, it makes no difference.

    See http://mindprod.com/jgloss/executablejar.html
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, May 19, 2008
    #4
  5. tutor5

    Mark Space Guest

    tutor5 wrote:
    > Hi, guys.
    >
    > can anyone help me. i have created an executable jar file in my GUI
    > program. it works, i tried the same thing on another non-gui program
    > and it does not work.
    > can anyone help me on how can i do it for non-GUI programms.
    >
    > Thanks


    Try to make a short example program that you can post here (you should
    be able to make it one class and one short file). Show us the jar file
    (jar -tf jarFileName) and whatever error you get when trying to run it.

    Without that, we cannot help you.

    For example, here is a short GUI Java program:


    package guisscce;

    import javax.swing.JFrame;
    import javax.swing.JLabel;

    public class Main extends JFrame {

    public static void main(String[] args) {
    Main m = new Main();
    m.add( new JLabel( "Hello World!"));
    m.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    m.pack();
    m.setVisible(true);
    }

    }


    And here I show how I build it and run it correctly.


    Brenden@Homer ~/Dev/misc/GuiSscce
    $ javac -d build/classes src/guisscce/*.java

    Brenden@Homer ~/Dev/misc/GuiSscce
    $ ls build/classes/guisscce/
    Main.class

    Brenden@Homer ~/Dev/misc/GuiSscce
    $ jar cfe sscce.jar guisscce.Main -C build/classes guisscce/

    Brenden@Homer ~/Dev/misc/GuiSscce
    $ jar tf sscce.jar
    META-INF/
    META-INF/MANIFEST.MF
    guisscce/
    guisscce/Main.class

    Brenden@Homer ~/Dev/misc/GuiSscce
    $ java -jar sscce.jar

    Brenden@Homer ~/Dev/misc/GuiSscce
    $
    Mark Space, May 20, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. xarax
    Replies:
    5
    Views:
    23,349
    Roedy Green
    Aug 14, 2003
  2. Arnold Peters
    Replies:
    0
    Views:
    543
    Arnold Peters
    Jan 5, 2005
  3. muttley
    Replies:
    0
    Views:
    2,677
    muttley
    Oct 20, 2005
  4. cyberco
    Replies:
    4
    Views:
    3,707
    Roedy Green
    Feb 14, 2006
  5. Arnold Peters
    Replies:
    0
    Views:
    632
    Arnold Peters
    Jan 5, 2005
Loading...

Share This Page