Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Jar Command line (http://www.velocityreviews.com/forums/t615478-jar-command-line.html)

tutor5 05-18-2008 09:26 AM

Jar Command line
 
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

Andrew Thompson 05-18-2008 09:54 AM

Re: Jar Command line
 
On May 18, 7:26*pm, tutor5 <sihl...@gmail.com> 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

voorth 05-19-2008 12:12 PM

Re: Jar Command line
 
On May 18, 11:26 am, tutor5 <sihl...@gmail.com> 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

Roedy Green 05-19-2008 05:00 PM

Re: Jar Command line
 
On Sun, 18 May 2008 02:26:26 -0700 (PDT), tutor5 <sihle87@gmail.com>
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

Mark Space 05-19-2008 11:48 PM

Re: Jar Command line
 
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
$



All times are GMT. The time now is 09:02 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.