How can I make .jar files for applications?

My jar program creates jar files but won't open the program when I double click them. I use the command:
jar cvf *.jar filenames
The jar file is created but won't execute. Can anyone tell me what i am doing wrong?
Thanks
Jiby

Hello !
Well, I had the same problem a week or two ago !
First, in your *.java, don't use any package...I mean, don't do a package of your program (I guess there is a way to make it work with, but it would need a little bit more work...).
Then, with the jar tools, use the command
-jar cf jar_that_you_want_to_create.jar class-that_you_include_in_your_jar.class
With that, a jar will be created, and when you will try to "run" it, it will say that it can not find the main class...
You need a Manifest !
Create a text file MyManifest.text, and write that in your text file :
Main-Class: classname
follow the same as i wrote above. leave a blank after colon and a blank line after the first line like above.
then, well, use tha jar tool again:
-jar umf MyManifest.txt jar-file-you-created.jar
To "run" it, double click on it, or use the java tool:
java -jar jar_you_created.jar
Thanks to Phani, who helped me with that !!
Splitsch

Similar Messages

  • Can we make jar file for simple j2se application

    Hi..Can we make a jar file for simple j2se application so that it can be executed on any system like .exe file...

    Read the JAR files section in Sun's Java tutorial.

  • How to make jar file for this compilation method ?

    can any one tell me how to make jar file for this compilation
    D:\java\browser\IEInJava>javac -classpath jdic.jar;. IEInJava.java
    D:\java\browser\IEInJava>java -cp jdic.jar;. IEInJava
    *this is a compile code:-*
    D:\java\browser\IEInJava>javac -classpath jdic.jar;. IEInJava.java
    *and this is a run code:-*
    D:\java\browser\IEInJava>java -cp jdic.jar;. IEInJavanow how make JAR file ?

    Assuming IEInJava only uses classes inside the jdic jar, this is one way. D:\java\browser\IEInJava> jar cf yourjar.jar IEInJava.classThen to run it you would use D:\java\browser\IEInJava> java -cp jdic.jar;yourjar.jar IEInJavaAnother way would use the jar manifest file to specify the Main-Class and Class-Path.

  • How can i build RPMs file for my own Java Application?

    How can i build RPMs file for my own Java Application?....I have my own directory that contains all Java Source files and some files that my Application required....I want to build RPMs file like a install File to Linux System, Now my OS is Linux Fedora core 1.....How can i do this?

    I think that in order to create a RPM, you'd need to
    use some C.Nope - the RPM is all about packaging and the "magic" x.spec file. You can have anything you want in the RPM, but you have to use RPM tools to build the .rpm file. One of the features is that you can also indicate (via "install" scripts) modifications to other files or the filesystem to support the installation of whatever's in the RPM.

  • How can i make doc file in ipad

    how can i make doc file in ipad??

    I believe that Pages for the iPad is capable of creating documents compatible with MS Word's .doc format.
    Best of luck.

  • 2 questions : How do I know if a video in Flash is streaming? 2nd - how can I make an overlay for video?

    Two questions :
    1) I have created a QT.mov, imported it into Flash, but after
    thinking about it, I want to be sure it is streaming for the web.
    How can I be sure of that? If it is not, what code can I put to
    make sure it is loading?
    2) How can I make an overlay for the video that disappears as
    soon as the user clicks on the play button?

    1. Without a flash ciommunication server for TRUE streaming
    of the file, what you get is called Progressive streaming. This
    means once the video begins to download it can start playing before
    the file has completely downloaded to the user. There are good
    descriptions (including pros and cons) of this here:
    http://www.mediacollege.com/video/streaming/overview.html
    2. If you have the file set to start automatically there will
    be no need for the user to push the play button. You could just put
    a graphic on top of the video component, and use actionscript to
    make the graphic invisible when the play button is pushed.

  • How can i make a email for my printer

    how can i make a email for my printer to send the things to the email and get it printed if i was out of the house my printer model is 3525

    Hi alhashmi_sy,
    Welcome to the HP Support Forums. I see that you would like to learn how to setup the ePrint feature of your Deskjet Ink Advantage 3525 printer.
    The first step is to connect your printer to your wireless network. Please follow the steps in the Installing the Printer Software for a Wireless Network Connection document for your operating system. If you have already setup your printer with a USB cable, each operating system section has the steps to switch from the USB connection to a wireless connection.
    After connecting the printer to your wireless network please follow the steps for Getting the Printer Claim Code. Once you have the web services information sheet with your claim code please Set Up a Custom Email Address for ePrint.
    You should now have a customized ePrint email address for your printer. If you run into any issues please let me know at what step things went awry and the contents of any error messages. Please also let me know what operating system you are using on your computer (whatsmyos.com). Thank you.
    Regards,
    Happytohelp01
    Please click on the Thumbs Up on the right to say “Thanks” for helping!
    Please click “Accept as Solution ” on the post that solves your issue to help others find the solution.
    I work on behalf of HP

  • Help - I have an apple id account, where is my iPod and iPad registered, but also the iPod of my daughter. How can I make an account for my daughter and keep all the apps she has on her iPod?

    Help - I have an apple id account, where is my iPod and iPad registered, but also the iPod of my daughter. How can I make an account for my daughter and keep all the apps she has on her iPod and in her own iTunes?

    Sorry, content bought with one Apple ID cannot be merged or transferred to another Apple ID.

  • How can I make a shortcut for bluetooth in my iPhone 4 ?

    Hello everyone
    How can I make a shortcut for bluetooth in my iPhone 4 ?

    sorry not that I know of, out of the box that is, would be heady to quickly change between headset and normal mode though
    let apple know you want this feature
    http://www.apple.com/feedback/iphone.html
    there are 3th party solutions though
    http://www.macrumors.com/2012/04/17/new-app-turns-bluetooth-on-and-off-with-one- touch/

  • How can i make cotrol file which have conveyor and ?

    how can i make cotrol file which have conveyor " to move the bottle and slider " to fill the same bottle ?
    i attach my control file.............
    " Science is came....not come "
    I study Mechatronics Engineer
    skype : t_alhowaiti
    Attachments:
    convyer.ctl ‏16 KB

    Jeff·Þ·Bohrer wrote:
    billko wrote:
    ThaerAL-Hwaiti wrote:
    i want to make a production line which move a bottle on a conveyor and fill it .
    That's all good and fine, but what have you tried codewise?  Let's see what you have so far and we can go from there.
    The easy answer is "an assignment" and a desire to pass the course without actually needing to read and comprehend information.
    I as trying to be diplomatic about it. 
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • 2 days ago i rented The Avengers, beside it took almost 7h to download, at the end it did not get fully downloaded... 20 last minutes were not there. I know is just 5 dollars, but, how can i make a claim for the amount paid?

    2 days ago i rented The Avengers, beside it took almost 7h to download, at the end it did not get fully downloaded... 20 last minutes were not there. I know is just 5 dollars, but, how can i make a claim for the amount paid?, what if I buy a movie later? i will get the same problem!!! still I do not know how the avengers ends!! please do not tell me haha, focus on the problem here!

    Welcome to the Apple Community.
    Apple's policy on sales of digital content is that all sales are final. If however you wish to appeal to Apple, select the content which is causing a problem and use the 'Report a problem' button in Your Purchase History on your computer.
    Currently, if your purchase happens to be your most recent purchase you will not be redirected to the report form, in this case use the report a problem option from the invoice that was emailed to you.
    I believe your issues are probably a network issue, which unless you resolve are likely to be repeated again.

  • ICal does not allow me to edit "minutes" in the appointments. when i make an appointment it defaults it to xxhrs 08mins (example 16:08) how can i make an appointment for 16:00 or 15:30 hrs ...etc.

    iCal does not allow me to edit "minutes" in the appointments. when i make an appointment it defaults it to xxhrs 08mins (example 16:08) how can i make an appointment for 16:00 or 15:30 hrs ...etc.

    Hi,
    You can change this in System Preferences, Language & Text.
    Go to System Preferences > Language & Text > Formats tab and change where it says Custom to your location. Then re-open iCal.
    Let us know how it goes.
    Best wishes
    John M

  • How can i put Jar Files in Java Runtime.?

    HI,
    how can i put jar files in JRE so that they are accessible every where.? is there some way.?
    Regards,
    AA

    Closest you could get to this I think is to explode all your jars into the same parent directory. Then if you put that directory on the classpath, you should be able to access all classes in all jar files

  • How can i make a file a .jar again?

    Ive opened a minecraft.jar with Archive Utillity so i can change pictures but ow can i make a file a .jar again?

    You have not said what your target size is nor how many photos you have or how large on screen. Nor what version of Pages you are using. Nor whether it is just for looking at on screen or you require a good print.
    Reducing file size is a combination of things that can be done with no loss of quality:
    1. Crop and reduce resolution of images in a 3rd party application, Preview will do.
    and those that will reduce quality
    2. Menu > File > Reduce File Size
    3. Menu > Share > Export > PDF > Good (Good is not very good unfortunately)
    Use vector (drawing) pdfs in place of bitmap (photo) images can save considerable size. Preparing photos in other programs also allows you to control the image quality of jpegs and tricks like slightly blurring them prior to saving.
    Pages is not very efficient in this regard and there are limits to what you can do. Lots of images, covering a lot of the page does add up to a bigger file whatever you do.
    Peter

  • How to make .jar file for a multiple class program

    I have a code for a chat room that contains two folders , one for Server and one for Client
    What I need is to create a jar file for the server and a jar file for the clients
    but here the first problem , I have a file that named (SocketMessengerConstants.class) that is located outside the two folders and is being read by the two projects .
    I mean the server uses it while running and the client uses it too .
    the second problem is : I don't know how to create a jar file at all !
    please tell me how to do it in detail
    Thank you

    ChuckBing wrote:[Packaging Programs in JAR Files|http://java.sun.com/docs/books/tutorial/deployment/jar/index.html]
    I tried to read this tutorials before I come here but I couldn't understand it
    can you please tell me a specific steps to follow instead of the explaining .. because I understand the explanation but I can't apply it

Maybe you are looking for

  • I can't boot my MBP or reinstall snow leopard

    I have an old 2005 MBP (non unibody) using snow leopard. I urgently need to get it running again since it stopped booting up last feb 2012 and I haven't used it since as I'm using a desktop now. When I turn it on I get no chime and the screen goes gr

  • Unlimited Data Plan on USB Modem

    Hello, I'm new to forum and I apologize if this has already been discussed but I haven't seen my particular situation anywhere; I have a 3G USB modem on the much talked about unlimited data plan. What I have is a month-by-month unlimited plan which i

  • Is there a device that converts ethernet to wifi on the iPad ?

    I've heard of a device that "converts" ethernet to wifi on the Ipad..it plugs in. Does anyone know about this ? My source didn't have details.

  • 11g Grid Control in a cluster?

    Hi All, I am trying to find some official doc on how to setup an MAA architecture for 11g GC. I have already done the following: - installed 11.2.0.1 RAC database - installed wls 10.3.2 on both nodes - installed OMS on one node - added the second OMS

  • Process Integration File adapter

    file adaptor in PI was able to accumulate several messages into one file? In other words, every 30 minutes or so, we will connect to any system to collect the documents. If I get there and find a list with 50 document, can I change the adaptor betwee