Page 2 of 2 FirstFirst 12
Results 21 to 23 of 23
  1. #21
    typedef is offline Member
    Join Date
    Feb 2014
    Posts
    52
    Rep Power
    0

    Default Re: Need Help (Sorry to post another thread) - My Jar is not working

    Quote Originally Posted by JosAH View Post
    That is not entirely true: a .jar file is a .zip file, but it can also contain a MANIFEST entry that controls the behaviour of the JVM; if there is no such entry, there is no difference between a .jar file and a .zip file. Note that the MANIFEST entry is an ordinary entry as far as any zip utility is concerned.

    kind regards,

    Jos
    My bad you guys I asserted more than I should have. I meant to say they are like zip files in which they compress ect. (which is still wrong as it seems they use the same compression scheme as Jos states). Thanks for the clarification.

  2. #22
    jashburn is offline Senior Member
    Join Date
    Feb 2014
    Posts
    219
    Rep Power
    1

    Default Re: Need Help (Sorry to post another thread) - My Jar is not working

    Quote Originally Posted by Based Elliott View Post
    03/04/2014 07:24 PM 1,054 Formula.zip.jar
    As typedef implied, by default Windows hides the file extension (i.e., the .jar part), and therefore renaming a file via Windows Explorer would rename just the file name part without changing the file extension. Microsoft assumes you'd never want to change the file extension because it is used to indicate the application that will used to run the file when the file is double-clicked upon. However in this case this is exactly what you want to do.

    In the future if you need to rename a file via command line on Windows, see https://www.microsoft.com/resources/....mspx?mfr=true (this page refers to Windows XP, but it should be exactly the same on Windows 7.)

    If after changing the file extension and you are not able to use 7-zip or Winzip to open the file when double-clicked upon, then the problem is due to a corrupted jar file - recreate your jar file.

    If you can open the file using 7-zip or Winzip, then try the following:

    1. Run the following via command prompt. What is the result?

    java -cp Formula.jar package.name.MainClass

    (Replace package.name.MainClass with the appropriate name of the package and class that contains the main method.)

    2. If that works, run the following. What is the result?

    java -jar Formula.jar

  3. #23
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: Need Help (Sorry to post another thread) - My Jar is not working

    Can the OS read the zip file created by doing the rename suggested? That tests if the file is corrupted.

    You can get the same error the OP showed in post#1 by renaming a file like a txt file to a jar file and double clicking on it.
    The jar program won't recognize the internal format and will give the error message shown above.
    If you don't understand my response, don't ignore it, ask a question.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 10
    Last Post: 11-23-2013, 06:47 PM
  2. HTTP Post working with WCF webservice
    By harshal82 in forum Advanced Java
    Replies: 0
    Last Post: 09-03-2010, 06:36 PM
  3. Thread Stop() method not working
    By charan reddy in forum Threads and Synchronization
    Replies: 18
    Last Post: 10-03-2009, 03:01 PM
  4. Replies: 3
    Last Post: 05-04-2009, 03:15 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
  •