Results 1 to 4 of 4
  1. #1
    Wataru is offline Member
    Join Date
    Jul 2009
    Posts
    9
    Rep Power
    0

    Default Creating a .jar file

    First off...what exactly is a .jar file good for and when should it be used? Is it a direct location to run a full Java app from? Because that's all I can gather from what I've read on them.

    Second, whilst trying to create a .jar file from my terminal, the tutorial said to type, for example
    Java Code:
    jar cmf mainClass.txt example.jar *.class
    All of this I understand and have manipulated to my needs and it all seems to work except for the "*.class" part. The tutorial says that that part tells the system to make a .jar file named "Example" that includes all files that end in "-.class". However, I get an error when I put that in that reads
    Java Code:
    *.class : no such file or directory
    I've tried directing this to the public class (since it seems like it's asking for a specific file) but I get the exact same error, despite the fact that the public class Beer.class/Beer (I've tried both ways) DOES exist. What am I doing wrong?

  2. #2
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    You probably don't have the directory correct. can you type this: "dir" and post it here. I'll let someone else explain what jar are...
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  3. #3
    Wataru is offline Member
    Join Date
    Jul 2009
    Posts
    9
    Rep Power
    0

    Default

    Huh...looky there, I found a .jar file I made in the dir. xDD It reads:

    99Bottles.jar examples.desktop java Pictures workspace
    cron.txt~ Firefox_wallpaper.png Java1 Public
    Desktop gimpshop_2.2.11-1_i386.deb Music Templates
    Documents Photos Videos

    But I got that .jar file by just completely leaving out the "*.class" part...

  4. #4
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    But I got that .jar file by just completely leaving out the "*.class" part...
    Silly wataru, that would only create an empty jar. No cookies inside, I'm afraid.
    Best start from the beginning: Lesson: Packaging Programs in JAR Files (The Java™ Tutorials > Deployment)
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

Similar Threads

  1. Creating Make File
    By kiki2009 in forum New To Java
    Replies: 7
    Last Post: 07-11-2009, 02:20 PM
  2. Creating a Jar File Using Command Prompt
    By hitmen in forum New To Java
    Replies: 6
    Last Post: 03-18-2009, 05:37 PM
  3. Creating jar file
    By Heather in forum Advanced Java
    Replies: 4
    Last Post: 02-11-2009, 10:58 AM
  4. creating jar file
    By po0oker in forum Advanced Java
    Replies: 3
    Last Post: 04-04-2008, 08:49 PM
  5. creating .ear file
    By psn in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 01-06-2008, 06:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •