How to create a jar having the contents of the jar in a byte array?

Hi,
I have a server and client application. My server returns the contents of the jar in the form of byte array to the client on a particluar method call. Now at the client end, i want to reconstruct the jar to be used. How do I do this?
The server uses the JarInputStream to read the contents of the jar to be returned. I have tried using the JarOutputStream, but looks like this works fine if we have spearate class files to be added to the jar. Now that I have the contents of the jar itself, how do i recreate the jar?
Can anyone please help me with this?
Thanks
Rajani

Have you ever gotten the raw byte copy to work? If so, how?
I download a jar via InputStream and save into a jar file via fileoutputstream. It always gets corrupted in the process. The new Jar file has the exact same number of bytes, but doesn't get past the Manifest on a -tvf. In fact, Winzip can open it fine, but can't extract. So close...yet so far.
Here is a snapshot of my code:
BufferedInputStream data1=new BufferedInputStream(con.getInputStream());
DataInputStream data=new DataInputStream(data1);
StringBuffer buf=new StringBuffer();
try{
while((theChar=data.read()) != -1)
{ buf.append((char)theChar); }
} catch (Exception z){ logger.info("UpdateThread.read Done Reading jar file");}
data.close();
File newFile = new File("C:/MyJar.jar");
FileOutputStream outstream2 = new FileOutputStream(newFile);
DataOutputStream outstream1 = new DataOutputStream(outstream2);
BufferedOutputStream outstream = new BufferedOutputStream(outstream1);
byte [] bytes = buf.toString().getBytes();
logger.info("Bytes of new Jar file = " + bytes.length);
int i;
for(i=0;i<bytes.length;i++){
outstream.write(bytes);
outstream1.close();
outstream.close();
Any ideas where I'm going wrong?

Similar Messages

  • I got some books from the itunes store and put them into my library.  I created a playlist so that I could burn them to cds.  The title is there but no contents.  It won't even play the playlist.  How do I get the contents of the book?

    I got some books from the itunes store and put them into my library.  I created a playlist so that I could burn them to cds.  It won't even play the book, there are no contents.  How do I get the contents of the book?

    I'm guessing this is a problem unique to me as there have been no replies at all...  Thanks a bunch folks

  • How can I create an active table of content in the sidebar to help readers to get to the section?

    How can I create an active table of content in the sidebar to help readers to get to the section?

    You can create bookmarks with Adobe Acrobat.

  • How should I tag content created in a master page when addressing accessibility before exporting to Acrobat?  I can't add the content to the articles pannel because it's locked.  I would also like to know how I shold tag my cove content.  I dont' want rea

    How should I tag content created in a master page when addressing accessibility before exporting to Acrobat?  I can't add the content to the articles panel because it's locked.  I would also like to know how I should tag my cove content.  I don't want the reader to get lost in content other than the body of the report, but I also don't want to ignore some content completely by tagging it as artifacts.  What should I do y'all?
    Thanks,
    Josh

    Hi Rob,
    From the screen shots it looks like your script is not formatted properly (you may refer to 'Paladin Script' in 'Sample Project' to get an idea of how the script should be formatted.).
    Further please follow the steps mentioned below to use Story to PP workflow.
    Create a new Film script in Adobe Story
    Create  scene heading – INT. LOCATION – Day (these will show up in the outline view panel on left hand side)
    Hit enter, hit TAB
    Enter the name of the speaker, hit TAB or ENTER
    Copy over the transcribed text
    Build your script this way
    Number scenes from the production menu
    Export ASTX file for your script : File->Export->.astx
    Open Premiere Pro
    Create a new project, bring in media
    In the project pane, find the "Scene" column
    For the clip that contains the spoken text, assign the same scene number to the clip as you have in the story script (lets say both are scene 1)
    Click out of the scene box in the project panel in Ppro
    Right click on the scene that you just assigned a scene number to and select – attach Story script
    Select the .astx fle you exported in step 8
    Click ok
    You should now see the script data in the metadata panel for the clip in the metadata panel.
    You can now run speech to text based on "Embedded Script metadata" to time align spoken word to the script.
    Let us know if this is helpful.
    Thanks
    Rashi - Story Team

  • How can i optimize my SEARCH ENGINE???I use godaddy.i contact them and they give me this conclusion:Search engines are not pulling up your other pages on your website because it is created with javascript. the content on the pages, (photo gallery.....

    conclusion from godaddy:
    Search engines are not pulling up your other pages on your website because it is created with javascript.
    the content on the pages, (photo gallery, My Recipes/Blog, History, Friends) need to be formatted to HTML, PHP or CSS. No search engines (google, Yahoo, Bing) can crawl//analyze webpages built with javascript.
    See if Apple allows iweb to create the pages in HTML format and ask how to make those changes.
    I spend more then 1 hour on the phone with them but we didn't find the solution...
    please i need help because like this nobody can rich my website...
    www.chefdiego.com
    thank you

    The part of iWeb pages that give the search engines problem is the navbar.  That's javascript based.  One way to get around that is to create another blank page in the site that's not  included in the navbar. 
    Add a text based navbar in that page with just the other pages in the site. 
    Also you can use that page for creating the sitemap for Google at Create your Google Sitemap Online - XML Sitemaps Generator.
    Have you let Google know your site exists? This website describes how to get it recognized: Get your iWeb website found in search engines like Google Yahoo MSN and Bing.
    OT

  • How to extract the contents of the Jar file?

    Hello,
    Can anyone tell me how to extract the contents of the Jar file?
    An example will be highly appreciated.
    Thanks.

    From command line, or from within a java application?
    Kaj
    Btw. Why do you need to do it. You do know that you can add jars to the classpath and read resources from them without extracting the file?

  • How to create a user  y which will have the same content of existing user x

    how to create a user y which will have the same content of existing user x ,
    like all the tables,procedures,functions and packages

    You can do the following.
    1. Use CREATE USER to create the new account/schema
    2. Use exp to export old schema
    3 Use imp with fromuser=<old user> and touser=<newuser>

  • How can I view the content within the message without having to double click on the message. I used to be able to see content of the message alongside it .

    How can I view the content of the message without having to double click on it; I used to be able to see content of the message next to it .

    Is this in Mail?
    You can (I do all the time). The oreview window can be resized by dragging the message list window border - you might accidentally have closed it up

  • URGENT !!! How to fecth the content of the mail

    HI All,
    I having a problem regarding how to fetch the body of the mail as well as attachment of the mail.
    i get sender name, subject but i having the problem how to fetch the content of the mail.
    i used
    System.out.println(message[msgno].getContentType());
    but it showing
    javax.mail.internet.MimeMultipart@480457
    it won't showing the content.
    How can i fetch the content !!!!
    Please help
    I fetching accessing the mail server using "imap"
    By
    Ravi
    email : [email protected]

    Code which i used
    import java.io.*;
    import java.util.Properties;
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.lang.*;
    import java.lang.Object;
    public class GetMessageExample
         public static void main(String args[]) throws Exception
              String host = "...";
              String username = "....";
              String password = ".....";
              // Create empty properties
              Properties props = new Properties();
              // Get session
              Session session = Session.getDefaultInstance(props, null);
              // Get the store
              Store store = session.getStore("imap");
              // Connect to store
              store.connect(host, username, password);
              // Get folder
              Folder folder = store.getFolder("INBOX");
              // Open read-only
              folder.open(Folder.READ_ONLY);
              // Get directory
              Message message[] = folder.getMessages();
              for (int i = 0, n = message.length; i < n; i++)
                   // Display from field and subject
                   System.out.println("From : "+message[0].getFrom()[0]);
                   System.out.println("Subject :"+message[0].getSubject());
                   // Display message content     
                   System.out.println("ContentType :"+message[0].getContentType());
                   System.out.println("Content :"+message[0].getContent());
              // Close connection
              folder.close(false);
              store.close();
    i got this output :
    From : Ravi Lal <[email protected]>
    Subject :Testing
    ContentType :multipart/alternative;
    boundary="----=_Part_63386_12145160.1189402168311"
    Content :javax.mail.internet.MimeMultipart@480457
    As i having only one mail in my inbox.
    I able to fetch everything from, subject but i fails to get the content i.e text of the mail.......
    What i do ????????
    !!! Help Me !!!
    Ravi
    Edited by: Ravi_InSun on Sep 13, 2007 10:51 AM

  • How To:  Create a link to gatewayed content (e.g. in email)

    I apologize if this is too basic of a question but I can't find any results after looking for several hours.
    I would like to generate a URL in an email that points to the portal and a specific portlet in the portal. The portlet has limited access rights so the URL should cause the portal to go through the login page and then redirect to the portlet. Can anyone point me to the documentation that describes this or give me an example?
    Thanks in advance!
    Mike

    Using the PTARGS might also solve another difficulty I've encountered passing (dynamic) querystring parms to portlets through the gateway. Your example seems to work great for portlets, but now trying to access a Community page containing a portlet to retain branding elements.
    For portal pages, should the ObjectID be the pageID (i.e PageID=0 for the default page) or is the ObjectID for a community page some other value (where in PlumDB is this stored) ? I changed the ClassIDView to 514 which should indicate a Community Page but it's still not loading my page. Adding to my confusion, the PTCOMMPAGES table stores the PageID as a negative value.
    Here's my example:
    http://portalserver/portal/server.pt/gateway/PTARGS_0_0_0_201_0_514/http%3B/portletserver/ApplicationName/default.aspx?querystring=value
    Any thoughts?
    re: How To: Create a link to gatewayed content (e.g. in email) Posted by Mike Beniston 5/5/05 9:45:40 AM It turned out that I was pretty close.
    If anyone else is interested, here is one way that works.
    The PTARGS are _0_userid(leave at 0)_objectid(of portlet)_communityID(if any)_0_ClassIDView(43 = view for portlet)
    "http://portalserver/portal/server.pt/gateway/PTARGS_0_0_348_208_0_43/http://portletserver/ApplicationName/pagename?querystring arguments.

  • I have Photoshop cs6 Ext on an ASUS laptop. How can I increase the font size of the contents of the FILTER Panel situated on bottom left of screen. The font size is extreamly small and almost unreadable. I have changed display parameters, not the resoluti

    I have Photoshop cs6 Ext on an ASUS laptop. How can I increase the font size of the contents of the FILTER Panel situated on bottom left of screen. The font size is extreamly small and almost unreadable. I have changed display parameters, not the resolution, to no avail.
    David.

    Paragraph breaks are good for readability. ;-)
    Have you noticed any difference between your MacBook and others at the Apple store? Wondering whether this is a configurable setting at the system level, i.e., DPI.
    You can default Firefox to a larger zoom level to avoid having to zoom every page. You'll still be able to adjust the size for individual sites as needed. It sounds as though you are aware of these add-ons:
    * Default FullZoom Level: https://addons.mozilla.org/firefox/addon/default-fullzoom-level/
    * NoSquint: https://addons.mozilla.org/firefox/addon/nosquint/
    There are some discussions about changing coming in Firefox 22 (I think) to address higher density displays like the Retina display. So perhaps there will be a built-in setting to address this in the future.

  • How to create user Exits for selecting ranges of the month

    Hi Bw Experts,
    Right now i need to create a user exits for my report which is coming from Infocube which has 12 months and 12 qtys. But if my client want to see the content of the report for e.g 1 to 3 months in selection screen means then we need to create a variable and user exit to accomplish this problem or is there any solution by which we can solve the problem. Try to suggest me and steps to achieve.
    Thanks in advance,

    Hi,
    Thanks for your input. But the questions is 12 amounts and 12 qtys not 12 months sorry for the typoerror. We are not carrying month field. But the User want to see the for e.g 1 to 3 months data means then how it is possible to accomplish this issue. Try to suggest me.
    Thanks in advance
    Message was edited by:
            mano_biw durai

  • How to create a clickable Table of contents using Crystal Reports 8.5

    How to create a clickable Table of contents using Crystal Reports 8.5. I was able to create the table of contents using subreport and temporary table. but not able to link to the pages.
    how to make it clickable ?
    -Vivek

    Hi Vivek,
    To you may create on demand sub report.
    In main report only the link will be shown when you click on the link the sub report will be opened in a new tab.
    It can be placed in a Group header and to show the data for that particular group only.
    Click on the Help menu in the crystal Reports Designer and open the Crystal Reports Help
    Go to Index tab and type in subreport
    Select Creating On demand you will get lot of information on that.
    Please let us know if that is enough to solve your problem
    Regards,
    Aditya Joshi

  • How to access the content in the configuration files

    Hi, Folks,
    To make it easy, the questions can be like this:
    how to access the content in web.xml in a web application?
    Through ServletConfig and context?
    how to access the content in ejb-jar.xml in an ejb?
    initial context?
    Thanks

    There is no documented way to delete data stored in archived log files: you can only remove the archived log files if needed.

  • While I appreciate the Adobe training videos, I would like to be able to print a hard copy of the content of the videos so that I have something to refer to without returning to the video but how can I do that?

    I really enjoy the helpful videos when finding an Adobe Acrobat answer but I would like to be able to print the content of the video so that I can refer to it for help whenever I want without having to find the helpful training video all over again and have to watch it all over it again so can this be done and if so how?? - thanks

    Thanks and yes, of course I could bookmark them but then I would have go continually go back and look at them all over again when I needed them which is not much of a time saver.
    I guess I will have to do what the reply suggested and that is make screen shots and a combined PDF file from the screen shots in order to get exactly what I want.  However, I feel this kind of  defeats the real purpose of  real "Help" in some way.  Why not offer a print option on these video tips as I know there must be others who would often prefer a hard copy for referral as opposed to having to go to a bookmarked video again, just seems like a waste of time when you are in a hurry which is often the case.

Maybe you are looking for