Is it possible to download jar programatically?

Hello to all the java experts. Is it possible to download a jar programatically? I created an applet that uses some big jars and I want to download part of them just if a specific button was pressed.
Is it possible?
If the answer is yes how can it be done?

Hi,
I hope the code given below will help you.
URL url = new URL(serverLocation + jarName);
try {
URLConnection connection = url.openConnection();
connection.setAllowUserInteraction(true);
InputStream instream = connection.getInputStream();
BufferedInputStream in = new BufferedInputStream(instream);
FileOutputStream file = new FileOutputStream(JarLocation +
jarName);
BufferedOutputStream out = new BufferedOutputStream(file);
int i;
while ( (i = in.read()) != -1) {
out.write(i);
out.flush();
out.close();
file.close();
in.close();
stream.close();
catch (IOException exp) {
exp.printStackTrace();
}

Similar Messages

  • Download .jar to handphone

    Hello,
    is it possible to download .jar file to nokia 7650 handphone over the air. Because I need to build a website for user to choose which applications he or she want ,download into the phone and install it.
    What steps are required.
    Is there any documentation on this.
    Thank for your reply.

    See:
    http://wireless.java.sun.com/midp/articles/deploy/
    http://wireless.java.sun.com/
    http://forum.java.sun.com/wireless/thread.jsp?forum=82&thread=427682
    Colin.

  • Accessing a file in the downloaded jar

    Is it possible for an applet to access a file in a downloaded jar file?
    In other words, the applet class and say a text file are placed in a jar file on the server. Once the jar file is donwload and the applet is started, can the applet read data from the text file in the jar?

    This URL should help you solve your problem.
    http://developer.java.sun.com/developer/qow/archive/76/index.html
    Have a nice day.
    nathan

  • Downloading JAR for temporary in-memory use or saved to local system?

    Hi all,
    I would like to be able to download and create a .jar file in memory, without writing it to disk, as an "option". My app should allow the user to reference an http://file.jar that gets "created" in memory on the client for temporary use, or they can optionally specify to download it and save it as a .jar file. I can't seem to find much info on either.
    For the first case, basically, each time the app runs it should get the .jar file from the location specified, but without actually creating it on disk. Is it possible to download the binary of a .jar file from a web server and create it in memory so that it can be used? Or does it have to be stored on the local file system? If so, then I suppose I could use a "temporary" on disk .jar file, then delete it.
    For the latter, how is a .jar file downloaded and saved to the local system?
    Thanks.

    I don't fully understand your question, but I think
    you want to use JarInputStream.
    -Ron

  • Download jar only when it is used

    Hello,
    I have an applet that uses some jar files, is it possible download the jar file only when it is called by the applet?
    Thanks,
    Pati

    If you add an index file in the first jar file on the
    applet's class path, the Java Plug-in downloads jar
    file only when necessary.
    You can find more information at:
    http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#JAR%20Index
    Regards

  • Need to download JAR files from more than ONE HTTP-server ?

    Hello,
    We have a need to download JAR files for an application, from more than ONE HTTP-server, i.e. any specified HTTP-server in an extremely secure network.
    Does a solution exist for this requirement ? Is it possible to design a solution our selfes for this problem ?
    Best Regards
    Peter

    We have a need to download JAR files for an
    application, from more than ONE
    HTTP-server, That can be done using the extension element
    from within the resources element of the main JNLP.
    http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/syntax.html#resources
    The extension element should refer to another JNLP
    (on the other site) that refers to the Jars. The jar files
    in any such (foreign) JNLP need to be signed, and the
    JNLP files should declare itself as a <component-desc>.
    For any level of detail on using extensions/components,
    download the spec. mentioned in the second paragraph
    of that section linked above. Unfortunately I can find no
    web browsable form of the information.
    Here is an example though..
    http://www.javasaver.com/testjs/jws/04/glclock.jnlp
    This (sandboxed) screenaver demo comes off my
    javasaver site. It refers to the JOGL API via an
    extension element in the JNLP, that points directly
    to the JOGL site. You might notice the security
    warning that is produced mentions..
    Name:      JOGL
    Publisher: sun microsystems, inc
    Source:    https://jogl.dev.java.net
    ..i.e. any specified HTTP-server in an
    extremely secure network. I do not know about an extremely secure network,
    but if it is OK to launch a normal JNLP for an
    application with a 'main()' from the server, I guess
    it should be OK to launch extensions off it - you
    might need to set up some tests.

  • Error in downloading jars through jnlp from Oracle 10.1.3 App Server

    I am working on migrating an application (containing two WARs) from Resin servlet server to Oracle 10.1.3 App Server. The migration was unit tested successfully. One of the WARs was implemented as a web service that downloaded JARs to the client PC through jnlp. When I tried to combine the two WARs into one (application) WAR, some of the JARs failed to download with an error message stating that they were "corrupted". 5 of the 6 "corrupted" contain native code, although two other native code JARs were able to download successfully.
    Most of the time the jnlp failure was accompanied with this error: WARNING: Exception returned by remote server: {0}
    javax.naming.NoPermissionException: Not allowed to look up java:comp/ServerAdministrator, check the namespace-access tag setting in orion-application.xml for details
         at com.evermind.server.rmi.RMIClientConnection.handleLookupResponse(RMIClientConnection.java:819)
         at com.evermind.server.rmi.RMIClientConnection.handleOrmiCommandResponse(RMIClientConnection.java:283)
         at com.evermind.server.rmi.RMIClientConnection.dispatchResponse(RMIClientConnection.java:242)
         at com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RMIClientConnection.java:224)
         at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:152)
         at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)
         at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:814)
         at java.lang.Thread.run(Thread.java:595)
    Error: Unexpected error during lookup : Lookup error: javax.naming.NoPermissionException: Not allowed to look up java:comp/ServerAdministrator, check the namespace-access tag setting in orion-application.xml for details; nested exception is:
         javax.naming.NoPermissionException: Not allowed to look up java:comp/ServerAdministrator, check the namespace-access tag setting in orion-application.xml for details
    Why is the jnlp failing when the WARs are part of the (main) application, but OK when it is part of a web service WAR? How can I overcome this problem?
    Thanks for your help.

    Hi Marc ,
    Thanks for your reply.....
    Did you mentioning the script (upgrade_10131_
    10133_oracle.sql) in the orabpel. I had run this script after applying the patch.
    Still iam facing the same issue.
    what need to be done?
    Could you please help me on this, because I need to do the Fault Handling Framework in BPEL and so i need the faultpolicy folder to be present.
    Since I got the folder by applying the patch, but what happend is when i try to check out for the activity status in the BPEL Console Activity tab it is showing the error as mentioned earlier. Any problem with patch implementation or any bug is there. So far i done the patch installation successfully without error and i upgraded the orabpel schema using the mentioned script also. Any other things i need to do?
    Regards,
    Ashok.

  • Is it possible to download iOS  5 from one iMac and not get them totally wiped of apps and stuff. We have an iPad each and a communal email address and an iCloud address each. One iPad now is totally screwed up.

    Is it possible to download iOS  5 from one iMac on two ipads and not get them totally wiped of apps and stuff. We have an iPad each and a communal email address and an iCloud address each. One iPad now is totally screwed up.

    Thank you for your reply.
    I am somewhat new to iOS and OS having grown up with DOS and Windows. I am not familiar with IMAP and iCloud and I am not even sure which types of servers my various emails use.
    The problem I would anticipate with iCloud is that (I assume) it would limit my access to data (including mail) on the iCloud to when I happen to be logged onto the internet. I also assume(?) that large files (photos etc.) would require some time to download whenever I wish to access them from whichever device I happen to be using (I hope I am wrong about this).
    I have kept my devices to 500gb - 1TB for OS and 32gb - 128gb for iOS but since I have pretty slow WiFi (shared with DirecTV Whole Home and Netflix streaming) it is my impression that iCloud might be quite limited due to data transfer times.
    Perhaps a factor would be that I have 2 DSL lines and my main DSL line is connected to two wireless routers (to also provide WiFi in a metal building that blocks WiFi and Cellular signals)
    I may be totally wrong in my assumptions regarding iCloud. My mail is not so urgent that I need access to it instantly and I could wait until I had internet access or I can get it on my iPhone. My main concern with iCloud would be my data files (Word, Pages, Excel, Numbers etc.).
    On the other hand, if I wanted to keep my 10,000 emails that would take up a lot of iCloud memory and I don't know how to measure how much storage it would take or how to move Hotmail or even iCloud mail to iCloud.
    It may take me some time to figure this out.

  • Is it possible to download ÿōür purchased app into ÿōür other device by signing in iTunes?

    Is it possible to download ÿōür purchased app into ÿōür other device by signing in iTunes?

    yes. But I would recomend using Icloud. If you have purchaed the app or ownloaded it you can serch it on any of your other devices app store and you will se a different icon where the download button is  suposed to go. Like a cloud. Click it and you will get it.

  • Error while downloading Jar/Jad by air

    Hi All,
    I am using netbeans as my IDE while compiling I m getting Jar and Jad file only I have uploaded both the files to VPN server now I want to download Jar/Jad file yesterday it downloaded fine on worked well on Blackberry bold device but from today it started creating a problem & display error messages as *"in jad file descriptor missing for midlet 1"*
    So while downloading it says download fail
    My Jad file information is given below
    MIDlet-1: myproject, , myproject
    MIDlet-Jar-Size: 6335
    MIDlet-Jar-URL: myproject.jar
    MIDlet-Name: myproject
    MIDlet-Vendor: vendor
    MIDlet-Version: 2.1
    MicroEdition-Configuration: CLDC-1.1
    MicroEdition-Profile: MIDP-2.0
    Please tell me it works fine on simulator but not on my device

    Try writing the complete url for your jar file location and make sure the jar size is exactly the same.
    Ex.:
    MIDlet-1: myproject, , myproject
    MIDlet-Jar-Size: *6335*
    MIDlet-Jar-URL: http://www.myserver.com/ota/myproject.jar
    MIDlet-Name: myproject
    MIDlet-Vendor: vendor
    MIDlet-Version: 2.1
    MicroEdition-Configuration: CLDC-1.1
    MicroEdition-Profile: MIDP-2.0

  • Is het mogelijk om een trial te downloaden op windows vista (mn Indesign en Photoshop)? Is it possible to download a trial on windows vista (indesign 6 en photoshop6)?

    Is het mogelijk om een trial te downloaden op windows vista (mn Indesign en Photoshop)?
    Is it possible to download a trial on windows vista (indesign 6 en photoshop6)?

    Some might be too old and no lomnger have trial downloads available.   ‘DDL’ Articles at ProDesignTools

  • I have lost my iMovie program and I can not install a new one. My computer says that it is not possible to download anything on my main drive

    I have lost my iMovie program and I can not install a new one. My computer says that it is not possible to download anything on my main drive

    How full is your drive?  You need at least 10/15% of free space.

  • Hi, can anyone please tell me if it is possible to download Google chrome (or similar) on the New Ipad... Thanks!

    Hi, can anyone please tell me if it is possible to download Google chrome (or similar) on the New Ipad...
    I keep getting an a message that reads "Safari cannot download this file" ... is there any other browser that can run on the New Ipad
    Thanks!

    You can't download programs via Safari. The only programs (i.e. apps) that you can install are those that are in the iTunes app store on your computer and the App Store app directly on the iPad - PC and Mac programs are not compatible with the iPad, they are different operating systems.
    There are a number of browser that are available in the store e.g. Atomic Web and iCab Mobile are two of the most popular, and there is also a free Opera browser (though what is available in the store may depend upon what country that you in and therefore what is available in your country's store).

  • Is it possible to download a book in Russian?

    Is it possible to download a book in russian?

    LEbEdEV_AU wrote:
    It can't be published in russian store! In " Edit Territory and Pricing" no Russia
    Let Apple know you want one via
    http://www.apple.com/feedback

  • Is it possible to download firefox onto a jumpdrive so i can install it on a computer with no internet connectivity?

    Hi, after the auto update ruined my internet explorer in windows, I am unable to open any kind of browser window, I cannot get to the Internet Properties from my computer or the programs. I am unable to uninstall ie8 because of missing files that came from microsoft update. I still have a connection to the internet, however, with no way of getting to it...So I am wondering if it is possible to download firefox onto a jump drive and install it on my otherwise, useless, computer.

    You can download Firefox 4.0.1 from here: http://www.mozilla.com/ directly to a USB drive provided there's enough space and then move it to your PC. The installation file is only 12MB

Maybe you are looking for