Jar Files


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Jar Files

  1. #1
    Rocco Balsamo Guest

    Jar Files

    I have an applet that works great on a local machine as a bunch of class
    files. When I put it in a jar file, however, only some of the images in
    the applet load up.

    Is there something I can do (even in my HTML) to wait to run the applet
    until the entire .jar file is downloaded (if this is my problem)?

    I'd appreciate any suggestions.

    Rocco


  2. #2
    bob Guest

    Re: Jar Files


    I believe you can utilize the ImageObserver interface to receive notification
    of when an image is completely downloaded to the browser.

    sorry don't have any code for you to use.

    cheers,
    bob

    Rocco Balsamo <balsar@rpi.edu> wrote:
    >I have an applet that works great on a local machine as a bunch of class
    >files. When I put it in a jar file, however, only some of the images in
    >the applet load up.
    >
    >Is there something I can do (even in my HTML) to wait to run the applet
    >until the entire .jar file is downloaded (if this is my problem)?
    >
    >I'd appreciate any suggestions.
    >
    >Rocco
    >




  3. #3
    Rem Guest

    Re: Jar Files


    Rocco Balsamo <balsar@rpi.edu> wrote:
    > I create a jar file and include the manifest file with the Main-Class atribute

    but when I try to run the jar with java in the command line, say that not
    found entry class point, Do you can say me what is the mistake

  4. #4
    Bavo Bruylandt Guest

    Re: Jar Files


    Try using MediaTracker. When you do
    MediaTracker mt = new MediaTracker;
    mt.addImage(someimage,0);
    mt.WaitForAll();
    Your applet should wait till all is loaded that you added to mt.

    (not sure of the correctness of this code).


    Rocco Balsamo <balsar@rpi.edu> wrote:
    >I have an applet that works great on a local machine as a bunch of class
    >files. When I put it in a jar file, however, only some of the images in
    >the applet load up.
    >
    >Is there something I can do (even in my HTML) to wait to run the applet
    >until the entire .jar file is downloaded (if this is my problem)?
    >
    >I'd appreciate any suggestions.
    >
    >Rocco
    >



  5. #5
    Ruchi Dhar Guest

    Re: Jar Files


    How are you getting the image instance? Are you using the getImage() method
    of the Appletcontext? Use the method getResource() method to load the image
    from the jar file. But you have to wait till the whole jar file gets downloaded.
    You can do another thing to minimize the lag time split your class files
    into different jar files. I hope this may help you.


    Rocco Balsamo <balsar@rpi.edu> wrote:
    >I have an applet that works great on a local machine as a bunch of class
    >files. When I put it in a jar file, however, only some of the images in
    >the applet load up.
    >
    >Is there something I can do (even in my HTML) to wait to run the applet
    >until the entire .jar file is downloaded (if this is my problem)?
    >
    >I'd appreciate any suggestions.
    >
    >Rocco
    >



  6. #6
    flairn Guest

    Re: Jar Files


    I have the same question!! When I try to execute, the "main" class cannot
    be found. Let me know when you discover the secret to executing standalone
    files packaged in .jar files.

    I need this information quickly

    Thanks,

    flairn



    * * *

    "Rem" <r3ruiz@hotmail.com> wrote:
    >
    >Rocco Balsamo <balsar@rpi.edu> wrote:
    >> I create a jar file and include the manifest file with the Main-Class

    atribute
    >but when I try to run the jar with java in the command line, say that not
    >found entry class point, Do you can say me what is the mistake



  7. #7
    tejaz Guest

    Re: Jar Files


    I have a solution for you:

    >I have the same question!! When I try to execute, the "main" class cannot
    >be found. Let me know when you discover the secret to executing standalone
    >files packaged in .jar files.


    If I understand correctly, your problem is in the manifest you are trying
    to append. If you want to set the the main class whose method main() is called
    when executing via java -jar MyApp then you need to set the following in
    a text file:

    Main-class: MyApp

    save it as whatever you like in the same dir as your class files, just remember
    the name. Notice the case of the word class (it has a lowercase "c"), this
    is often the problem. Then run the jar tool with:

    jar mcf main.txt MyApp.jar *.class

    Now it should find the main class.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center