Plugin.jar  in menifest file

Hi,
I am using plugin.jar in my swing application. I don't want to bundle it with deliverables. Rather it should pick up plugin.jar from client JRE lib folder.
I want set plugin.jar in class-path attribute of menifest file of executable jar file. This class-path should point to plugin.jar in client JRE lib folder.
Message was edited by:
Maulin123

But plugin.jar is provided by JRE at client machine.
Why I need to provide it?I actually have no idea what plugin,jar you're talking about. If the JRE really is providing it, what's your problem??

Similar Messages

  • Error on extracting process: 'SDMKIT.JAR. The file is corrupt'

    Hi,
    I have both files (NW04SneakPrevJavaSP11.part1.rar and NW04SneakPrevJavaSP11.part2.rar) in the same directory but when I start the extracting process I got those messages:
    D:\SAP_portal\NW04SneakPrevJavaSP11.part1.rar:
    Unexpected end of archive
    D:\SAP_portal\NW04SneakPrevJavaSP11.part1.rar:
    CRC failed in NW04SneakPrevJavaSP11\NWSneakPreviewSP11\SneakPreviewContent\SDM\SDMKIT.JAR. The file is corrupt
    D:\SAP_portal\NW04SneakPrevJavaSP11.part1.rar:
    Cannot create NW04SneakPrevJavaSP11\DeveloperStudioSP11\J2EE-
    RUNT-CD\IDE\eclipse\plugins\com.sap.tc.ap\comp\CAF\DCs\sap.com\caf\runtime\connectivity\impl\_comp\gen\default\public\com.sap.caf.mp.core.svc\90549cee3a85b8105ec24698da254123.HASH
    Total path and file name length must not exceed 260 characters
    I wonder to know what happend and how can I fix it.
    Appreciate your help,
    Luis.

    Hi Luis,
    I dont't know about a mirror. I downloaded the files and extract without problems.
    In the following thread is an instruction how to uncompress:
    How can I extract files of kind .rar?
    Do you use Winrar? Do you select both files if you extract? Try to rename the directory SAP_portal to NW4 (or an other very short name)
    Hope that helps!
    Best regards
    Renald

  • [ImageIO] add plugin jar to classpath

    Hello Experts,
    I have built a WebDynpro application in which I need to resize images (JPG, PNG and GIF). I use standard library :
    boolean writeResult = ImageIO.write(bufferedImg, fileExtension, streamOut);
    This works fine, except for the GIF format for which there is no standard writer.
    I decided to use <a href="https://gif-plugin.dev.java.net/">gif-plugin</a> which should do the trick.
    According to the plugin documentation : "<i>Just copy the plugin jar to somewhere in the classpath.
    The jdk should automatically detect the plugin</i>".
    I added the jar in an external library, exactly the same I do for other external jars I use.
    I can see the jar in the classpath when opening 'Project > properties > Java Build Path > Libraries"
    But seems that it is not been added to the classpath at runtime because plugin is not detected.
    Do you have any hint on that ?
    Thanks a lot.
    Regards,
    Nicolas

    In your external library DC you should create public part with type assembly - and add neccessary libs to in. Build it.
    IN Webdynpro DC you should add reference on created pp with type 'build'. Build WD DC - now Wd ear file should contain required custom jar and will be able to use it on runtime.

  • Is plugin.jar included by the jre intall process

    Is plugin.jar included with an install of the JRE? Do I need to bundle a version plugin.jar with my browser based application?
    Is there a version in the manifest file to identity which plugin.jar
    If I have to include it each time, I would like to download it from a maven repository. Does anyone know of a maven repository that allows you to find plugin.jar based on the version of the JRE.
    If you load a plugin.jar that is not compatible with the current JRE shouldn't it raise an exception?

    Is plugin.jar included with an install of the JRE?yes
    Do I need to bundle a version plugin.jar with my browser based application?No
    Is there a version in the manifest file to identity which plugin.jarNo. Applets and Webstart application will always use latest version of plugin.jar available on the system.
    If your application has dependency on the minimum version of JRE then consider specifying this in the JNLP file for your application/applet using j2se tag.

  • I can't get CS6 to recognize R3D files. I put the plugin and the server files in the proper spot and I used 64 not 32 like it said. I still can't get it to work

    The only thing to do to get the R3D files working is download a plugin pack with 2 files in it. one goes in your plugin folder the other in some other folder. I found both original files and replaced them with the new ones. I have rebooted twice... nothing. it won't recognize R3D files. The Camera is a Red brand Epic Dragon and it puts our R3D files. R3D's are easily manipulated in Redcine, but I can't add my .mov files on it so I need to be able to work with these files in PP.

    I'm sad now
    Good thing I have a PC with 32-bit windows!
    Now, I can only assume apple is working on a 64-bit
    fix? I suppose that info/ETA is on the itunes page,
    I'll go take a look.
    Who knows what Apple plans are? I do know that they do not discuss upcoming releases of anything until its available.

  • Is there an easy way to suppress debug messages from plugin.jar?

    When using the plugin.jar library (included in JRE 1.4.2 and 1.5)
    my Java Console is riddled with tons of debug messages like:
    <<< ProxyClassLoader: defined LiveConnectProxy class. >>>
    <<< Here're the permissions you've got: >>>
    <<< java.security.Permissions@b614d0 (
    (java.net.SocketPermission 127.0.0.1 connect,accept,resolve)
    )I'm using the plugin.jar (replacing use of the old netscape.jar)
    to bridge communication between Java Applets and JavaScript.
    Each time the Applet calls back to the JavaScript side,
    the callback JavaScript function makes a call to parseInt() to
    convert one of the parameters passed from a string to an integer.
    Each time parseInt() is called, the message above appears
    in the Java Console.
    I traced down the source code for this message to a debug()
    statement inside the plugin.jar's class loader, but I'm not sure
    how to suppress it easily.
    Does anyone have any ideas I could try?
    Here's the code from the Java-side:
    synchronized( this )
         try
              final JSObject window = JSObject.getWindow( applet );
              if( window != null )
                   final String[] stringArgs = new String[3];
                   stringArgs[0] = labelName;
                   stringArgs[1] = labelDisplayName;
                   stringArgs[2] = labelValue;
                   log.debug(stringArgs[0]);
                   log.debug(stringArgs[1]);
                   log.debug(stringArgs[2]);
                   window.call("MyJavascriptCallback", stringArgs);
              else
                   log.error("Javascript window unavailable.");
         catch( final JSException e )
              // Note: Occasionally, getWindow() will throw an exception
              // without any meaningful reason.
              // ( http://www.raditha.com/blog/archives/000938.html )
              // Possible cause: This can send updates at a fraction of a
              // second. This may be causing issues within the Plugin.jar
              // used to handle the JavaScript callback.
              log.debug("JSException", e);
    }

    Here's what I've found out...
    The messages are coming from the MRJPlugin.jar provided by Firefox.
    Within the netscape.oji.ProxyClassLoaderFactory class,
    the following line...
    System.out.println("<<< " + message + " >>>");
    ...appears to be the cause and cannot be turned off by a configuration setting.
    The home URL for the MRJPlugin.jar is:
    http://www.mozilla.org/oji/MRJPlugin.html
    The last time this library had an update released was in 10/31/2000.
    However, this is the Mozilla source; not Firefox.
    Although changing the MRJPlugin.jar source to remove this line will appear
    to fix the problem, I'm not sure of the best way to distribute the updated
    MRJPlugin.jar without conflicting with Firefox's update process.
    Any thoughts?

  • Java - referencing external jar and class files

    When compiling (loadjava) a Java class, how can an externally referenced '.jar file' be resolved please? Using '-resolve' doesn't do the job in this case.
    Many thanks.

    I think I've seen an option for this with manifest files (or was it something that had to do with the java plug-in). There was something about the version and only download a new version if it was newer than the one on your local computer. This version thing is something you define in the manifest file at least. Take a look at jar and manifest files, there might be something there.

  • Jar (or Zip) file with problems in accents, special characters

    Hi! I've a servlet that creates a jar (or zip) file and then send it. My problem is that when I create an entry in which the filename has special characters such as accents, when I unjar or unzip de file, it brings a lot of garbage characters. For example, the nex entry:
    Ex�menes.doc
    when unzipped is:
    Ex?�menes.doc
    I've tried a lot of things:
    -Setting the locale to ES, MX
    -Replacing all the letters with special characters with its unicode (like s.replace('�','\u00E1')
    -Trying to convert it to UTF8 (new String(path.getBytes(),"UTF8") )
    -Replacing the file separator char (according to a workaround that I found in the bug database)
    But nothing of this worked, alone or together. I've read that this is (or was) a bug in the API, but don't know if a solution has been found.
    Any help will be greatly appreciated!

    It's not clear what you are asking. Maybe this will help
    http://www.cfdev.com/code_samples/code.cfm/CodeID/83/Java/Simple_Ant_build_xml_Build_Task

  • Java classes in Jar and Cab files

    Hello all,
    Our product supply java classes in Jar and Cab files that the browser downloads each time.
    The files are big and it takes a long time.
    Do you know of a way to make the cab/jar files be copied in to the user computer and that the browser would know to download files again only if there is a new version (otherwise take it from the local computer)
    Please help me
    Tamg

    I think I've seen an option for this with manifest files (or was it something that had to do with the java plug-in). There was something about the version and only download a new version if it was newer than the one on your local computer. This version thing is something you define in the manifest file at least. Take a look at jar and manifest files, there might be something there.

  • WLS 9.2.2: JSP recompile for every page load with JAR'ed tag files

    I have a small custom tag library of three tag files. With the server running in development mode and the tag files in a JAR (included in WEB-INF/lib), the server appears to be doing a JSP recompile on every page load. However, it only compiles on the first page load if the tag files are included in WEB-INF/tags (no JAR). Also, running the server in production mode with the JAR'ed tag files avoids the recompile for every page load.
              Is that how the server should behave?
              For whatever it's worth, I'm also using Eclipse 3.3.2 with WTP and WebLogic Server Tools 1.1.2. The server is running the Sun JVM (1.5_10).

    Vikram,
              I went back and created a simple example to test. Below I'm posting the Java source code generated from the two relevant files: index.jsp, and hello.tag.
              __index.java:
              package jsp_servlet;
              import java.io.*;
              import java.util.*;
              import javax.servlet.*;
              import javax.servlet.http.*;
              import javax.servlet.jsp.*;
              import javax.servlet.jsp.tagext.*;
              public final class __index extends weblogic.servlet.jsp.JspBase implements weblogic.servlet.jsp.StaleIndicator {
              private static void _releaseTags(javax.servlet.jsp.tagext.JspTag t) {
              while (t != null) {
              if(t instanceof javax.servlet.jsp.tagext.Tag) {
              javax.servlet.jsp.tagext.Tag tmp = (javax.servlet.jsp.tagext.Tag)t;
              t = ((javax.servlet.jsp.tagext.Tag) t).getParent();
              try {
              tmp.release();
              } catch(Exception ignore) {}
              else {
              t = ((javax.servlet.jsp.tagext.SimpleTag)t).getParent();
              public boolean _isStale(){
              boolean stale = staticIsStale((weblogic.servlet.jsp.StaleChecker) getServletConfig().getServletContext());
              return _stale;
              public static boolean _staticIsStale(weblogic.servlet.jsp.StaleChecker sci) {
              if (sci.isResourceStale("/index.jsp", 1207926672370L ,"9.2.2.0","America/Denver")) return true;
              if (sci.isResourceStale("/null", 1207926783245L ,"9.2.2.0","America/Denver")) return true;
              return false;
              private static void _writeText(javax.servlet.ServletResponse rsp, javax.servlet.jsp.JspWriter out, String block, byte[] blockBytes)
              throws java.io.IOException {
              if (!_WL_ENCODED_BYTES_OK || _hasEncodingChanged(rsp)){
              out.print(block);
              } else {
              ((weblogic.servlet.jsp.ByteWriter)out).write(blockBytes, block);
              private static boolean _hasEncodingChanged(javax.servlet.ServletResponse rsp){
              String encoding = rsp.getCharacterEncoding();
              if ( "ISO-8859-1".equals(encoding) || "Cp1252".equals(encoding) || "ISO8859_1".equals(encoding) || "ASCII".equals(encoding) ){
              return false;
              if (_WL_ORIGINAL_ENCODING.equals(encoding)) {
              return false;
              return true;
              private static boolean WLENCODED_BYTES_OK = true;
              private static final String WLORIGINAL_ENCODING = "ISO-8859-1";
              private static byte[] _getBytes(String block){
              try {
              return block.getBytes(_WL_ORIGINAL_ENCODING);
              } catch (java.io.UnsupportedEncodingException u){
              WLENCODED_BYTES_OK = false;
              return null;
              private final static String wlblock0 ="<!--\n * $Id$\n-->\n \n<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \n\t\t\"http://www.w3.org/TR/html4/loose.dtd\">\n \n";
              private final static byte[] wlblock0Bytes = getBytes( wl_block0 );
              private final static String wlblock1 =" \n \n\t";
              private final static byte[] wlblock1Bytes = getBytes( wl_block1 );
              private final static String wlblock2 ="\n";
              private final static byte[] wlblock2Bytes = getBytes( wl_block2 );
              private final static String wlblock3 ="\n\n<html>\n<head>\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />\n\n\t<title>Tag File Test</title>\n</head>\n<body> \n\t";
              private final static byte[] wlblock3Bytes = getBytes( wl_block3 );
              private final static String wlblock4 ="\n</body>\n</html>";
              private final static byte[] wlblock4Bytes = getBytes( wl_block4 );
              static private javelin.jsp.JspFunctionMapper jspxfnmap = javelin.jsp.JspFunctionMapper.getInstance();
              public void _jspService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException, java.io.IOException {
              javax.servlet.ServletConfig config = getServletConfig();
              javax.servlet.ServletContext application = config.getServletContext();
              javax.servlet.jsp.tagext.JspTag _activeTag = null;
              Object page = this;
              javax.servlet.jsp.JspWriter out;
              javax.servlet.jsp.PageContext pageContext = javax.servlet.jsp.JspFactory.getDefaultFactory().getPageContext(this, request, response, null, true , 8192 , true );
              response.setHeader("Content-Type", "text/html; charset=ISO-8859-1");
              out = pageContext.getOut();
              javax.servlet.jsp.JspWriter _originalOut = out;
              javax.servlet.http.HttpSession session = request.getSession( true );
              try {;
              response.setContentType("text/html; charset=ISO-8859-1");
              {_writeText(response, out, _wl_block0, _wl_block0Bytes);}
              {_writeText(response, out, _wl_block1, _wl_block1Bytes);}
              {_writeText(response, out, _wl_block2, _wl_block2Bytes);}
              {_writeText(response, out, _wl_block3, _wl_block3Bytes);}
              jsp_servlet._tags.__hello_tag __tag0 = null ;
              int __result__tag0 = 0 ;
              if (__tag0== null )__tag0 = new jsp_servlet._tags.__hello_tag ();
              __tag0.setJspContext(pageContext);
              __tag0.setParent(null);
              activeTag=_tag0;
              __tag0.doTag();
              {_writeText(response, out, _wl_block4, _wl_block4Bytes);}
              } catch (Throwable __ee){
              if(!(__ee instanceof javax.servlet.jsp.SkipPageException)) {
              while ((out != null) && (out != _originalOut)) out = pageContext.popBody();
              releaseTags(activeTag);
              pageContext.handlePageException(__ee);
              __hello_tag.java:
              package jsp_servlet . _tags ;
              import java.io.*;
              import java.util.*;
              import javax.servlet.*;
              import javax.servlet.http.*;
              import javax.servlet.jsp.*;
              import javax.servlet.jsp.tagext.*;
              public final class __hello_tag extends javax.servlet.jsp.tagext.SimpleTagSupport {
              private static void _releaseTags(javax.servlet.jsp.tagext.JspTag t) {
              while (t != null) {
              if(t instanceof javax.servlet.jsp.tagext.Tag) {
              javax.servlet.jsp.tagext.Tag tmp = (javax.servlet.jsp.tagext.Tag)t;
              t = ((javax.servlet.jsp.tagext.Tag) t).getParent();
              try {
              tmp.release();
              } catch(Exception ignore) {}
              else {
              t = ((javax.servlet.jsp.tagext.SimpleTag)t).getParent();
              public static boolean _staticIsStale(weblogic.servlet.jsp.StaleChecker sci) {
              if (sci.isResourceStale("/META-INF/tags/hello.tag", 1207926783175L ,"9.2.2.0","America/Denver")) return true;
              return false;
              protected static final String tagxTagInfo = "-84,-19,0,5,116,0,5,104,101,108,108,111,116,0,29,106,115,112,95,115,101,114,118,108,101,116,46,95,116,97,103,115,46,95,95,104,101,108,108,111,95,116,97,103,116,0,5,101,109,112,116,121,112,112,112,112,119,5,0,0,0,0,3,116,0,10,106,115,112,67,111,110,116,101,120,116,119,1,0,116,0,28,106,97,118,97,120,46,115,101,114,118,108,101,116,46,106,115,112,46,74,115,112,67,111,110,116,101,120,116,113,0,126,0,4,119,1,1,112,119,2,1,0,112,112,116,0,7,106,115,112,66,111,100,121,119,1,0,116,0,36,106,97,118,97,120,46,115,101,114,118,108,101,116,46,106,115,112,46,116,97,103,101,120,116,46,74,115,112,70,114,97,103,109,101,110,116,113,0,126,0,6,119,1,1,112,119,2,1,0,112,112,116,0,6,112,97,114,101,110,116,119,1,0,116,0,31,106,97,118,97,120,46,115,101,114,118,108,101,116,46,106,115,112,46,116,97,103,101,120,116,46,74,115,112,84,97,103,113,0,126,0,8,119,1,1,112,119,2,1,0,112,112,119,4,0,0,0,0,112,112,";
              protected JspContext jspContext ;
              public void setJspContext ( JspContext ctx ){
              super . setJspContext ( ctx );
              java.util.List nested = null ;
              java.util.List atBegin = null ;
              java.util.List atEnd = null ;
              this.jspContext = new javelin.jsp.JspContextWrapper(ctx, nested, atBegin, atEnd, null);
              }public JspContext getJspContext() {
              return this.jspContext;
              private java.io.Writer jspxsout;
              private javax.servlet.jsp.tagext.JspTag _activeTag;
              private static void _writeText(javax.servlet.ServletResponse rsp, javax.servlet.jsp.JspWriter out, String block, byte[] blockBytes)
              throws java.io.IOException {
              if (!_WL_ENCODED_BYTES_OK || _hasEncodingChanged(rsp)){
              out.print(block);
              } else {
              ((weblogic.servlet.jsp.ByteWriter)out).write(blockBytes, block);
              private static boolean _hasEncodingChanged(javax.servlet.ServletResponse rsp){
              String encoding = rsp.getCharacterEncoding();
              if ( "ISO-8859-1".equals(encoding) || "Cp1252".equals(encoding) || "ISO8859_1".equals(encoding) || "ASCII".equals(encoding) ){
              return false;
              if (_WL_ORIGINAL_ENCODING.equals(encoding)) {
              return false;
              return true;
              private static boolean WLENCODED_BYTES_OK = true;
              private static final String WLORIGINAL_ENCODING = "ISO-8859-1";
              private static byte[] _getBytes(String block){
              try {
              return block.getBytes(_WL_ORIGINAL_ENCODING);
              } catch (java.io.UnsupportedEncodingException u){
              WLENCODED_BYTES_OK = false;
              return null;
              private final static String wlblock0 ="\n<center><h1>Hello World</h1></center>";
              private final static byte[] wlblock0Bytes = getBytes( wl_block0 );
              static private javelin.jsp.JspFunctionMapper jspxfnmap = javelin.jsp.JspFunctionMapper.getInstance();
              public void doTag() throws JspException, java.io.IOException {
              javax.servlet.jsp.PageContext pageContext = (javax.servlet.jsp.PageContext) getJspContext();
              javax.servlet.http.HttpServletRequest request = (javax.servlet.http.HttpServletRequest) pageContext.getRequest ();
              javax.servlet.http.HttpServletResponse response = (javax.servlet.http.HttpServletResponse) pageContext.getResponse();
              javax.servlet.http.HttpSession session = pageContext.getSession();
              javax.servlet.ServletContext application = pageContext.getServletContext();
              javax.servlet.ServletConfig config = pageContext.getServletConfig();
              javax.servlet.jsp.JspWriter out = jspContext.getOut();
              javax.servlet.jsp.tagext.JspTag _activeTag = null;
              try {
              {_writeText(response, out, _wl_block0, _wl_block0Bytes);}
              } catch ( Throwable t ){
              if( t instanceof javax.servlet.jsp.SkipPageException )
              {throw (javax.servlet.jsp.SkipPageException)t;}
              if( t instanceof java.io.IOException )
              {throw (java.io.IOException)t;}
              if( t instanceof IllegalStateException )
              {throw (IllegalStateException)t;}
              if( t instanceof javax.servlet.jsp.JspException )
              {throw (javax.servlet.jsp.JspException)t;}
              throw new javax.servlet.jsp.JspException(t);
              finally {
              ((javelin.jsp.JspContextWrapper)jspContext).syncEndTagFile();
              Edited by Stephen Davison at 04/11/2008 9:02 AM

  • OBIEE 11.1.1.7.0 unable to extract filegroup1.jar. The file is corrupt

    Hi ,
    OBIEE 11.1.1.7.0 Zip file unable to extract filegroup1.jar. The file is corrupt
    CRC failed in bishiphome\Disk1\stage\Components\oracle.bi.biadfcomps\11.1.1.7.0\1\DataFiles\filegroup1.jar. The file is corrupt
    Tried different zipping software's like Win zip,win RAR,7Zip,windows Extractor but no luck...
    and i have downloaded the software through the oracle site and e-delivery sites.. still facing same issue..
    Please help me on this,
    Thx,

    Just in case try from here
    http://www.oracle.com/technetwork/middleware/bi-enterprise-edition/downloads/bus-intelligence-11g-165436.html
    If helps mark as correct :)

  • Apache-zip.jar name attachment file bad encoding

    I have following code. which create zip archive, but name attachment files bad encoding.
    name attachment files in encoding UTF-8. letters of Russian alphabet -"&#1080;&#1084;&#1103;.txt". get - "¯à¨ï⨥  à鸞.txt" OS - Ubuntu 9.10 64-b
    package action;
    import org.apache.tools.zip.ZipEntry;
    import org.apache.tools.zip.ZipOutputStream;
    import java.io.*;
    import java.util.Arrays;
    import java.util.List;
    public class CreateArchive {
        private byte[] getByteFromFile(String file) throws IOException {
            InputStream is = new FileInputStream(file);
            long length = file.length();
            if (length > Integer.MAX_VALUE) {
                throw new IOException("Size file bad: "+file);
            byte[] bytes = new byte[(int)length];
            int offset = 0;
            int numRead;
            while (offset < bytes.length && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
                offset += numRead;
            if (offset < bytes.length) {
                throw new IOException("Could not completely read file "+file);
            is.close();
            return bytes;
        public void createZip(OutputStream outputStream, List<String> files) {
            byte[] buf = new byte[1024];
            try {
                ZipOutputStream out = new ZipOutputStream(outputStream);
                out.setEncoding("UTF-8");
                for (String fileName: files) {
                    ByteArrayInputStream sourceStream = new ByteArrayInputStream(getByteFromFile(fileName));
                    out.putNextEntry(new ZipEntry(fileName));
                    int len;
                    while ((len = sourceStream.read(buf)) != -1) {
                        out.write(buf, 0, len);
                    out.closeEntry();
                out.close();
            } catch (IOException e) {
                System.out.print(e);
        public static void main(String[] args) throws IOException {
            CreateArchive files = new CreateArchive();
            OutputStream outputStream = new FileOutputStream("file.zip");
            files.createZip(outputStream, Arrays.asList("&#1080;&#1084;&#1103;.txt"));
            outputStream.close();
    }Sorry for me bad english
    Edited by: P1tBull on Mar 24, 2010 5:35 AM

    Real task was create general archive is selected users files and transmission he in one stream
    package action;
    import org.apache.tools.zip.ZipEntry;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.*;
    import java.util.Arrays;
    import java.util.List;
    import java.util.zip.ZipOutputStream;
    public class StreamFiles extends HttpServlet {
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            doGet(request, response);
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            OutputStream out = response.getOutputStream();
            try {
                response.setContentType("'application/zip'; charset='UTF-8'");
                response.setContentType("name=AllFile");
                response.setHeader("Content-disposition", "attachment; filename*=utf-8" + "''" + java.net.URLEncoder.encode("AllFile.zip", "UTF-8") + ";");
                if (request.getHeader("user-agent") != null) {
                    if (request.getHeader("user-agent").indexOf("Safari") != -1) {
                        response.setHeader("Content-Disposition", "attachment");
                        response.setContentType("application/octet-stream");
                    } else if (request.getHeader("user-agent").indexOf("MSIE") != -1 || request.getHeader("user-agent").indexOf("Chrome") != -1) {
                        response.setHeader("Content-disposition", "attachment; filename=" + java.net.URLEncoder.encode("AllFile.zip", "UTF-8"));
                List<String> files = Arrays.asList("catalina.bat", "startup.sh", "version.sh", "tomcat-juli.jar");
                createZip(out, files);
            } catch (Exception ex) {
                request.setAttribute("javax.servlet.jsp.jspException", ex);
                RequestDispatcher requestDispatcher = request.getRequestDispatcher("/error.jsp");
                requestDispatcher.forward(request, response);
            } finally {
                out.flush();
                out.close();
        private byte[] getByteFromFile(String file) throws IOException {
            InputStream is = new FileInputStream(file);
            long length = file.length();
            if (length > Integer.MAX_VALUE) {
            byte[] bytes = new byte[(int)length];
            int offset = 0;
            int numRead;
            while (offset < bytes.length && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
                offset += numRead;
            if (offset < bytes.length) {
                throw new IOException("Could not completely read file "+file);
            is.close();
            return bytes;
        public void createZip(OutputStream outputStream, List<String> files) {
            byte[] buf = new byte[1024];
            try {
                ZipOutputStream out = new ZipOutputStream(outputStream);
                for (String fileName: files) {
                    ByteArrayInputStream sourceStream = new ByteArrayInputStream(getByteFromFile(fileName));
                    out.putNextEntry(new ZipEntry(fileName));
                    int len;
                    while ((len = sourceStream.read(buf)) != -1) {
                        out.write(buf, 0, len);
                    out.closeEntry();
                out.close();
            } catch (IOException e) {
                System.out.print(e);
    }but mistake on real host don't repeated, so thanks for answer
    Edited by: P1tBull on Mar 24, 2010 8:14 AM

  • Jarring and unjarring files at runtime.

    I have this line
    Runtime.getRuntime().exec("jar -x foo.jar");which hangs.
    I wanted to dynamically jar and unjar files.. Can I do this with Runtime.exec()?

    Umm..
    It took some fiddling for me to realize that I have to have my class file in the directory where I want the extracted files to be for those files to be unjarred in the right place, which then created this problem during rejarring, where my class file gets jarred into it... how can I
    a) exclude my class file from being jarred? OR
    b) remove auto.class after the jar file is created?
    If I knew it was this much of a pain, I would've done it manually :D

  • What is the best software/plugin for converting Quark files to Indesign?

    What is the best software/plugin for converting Quark files to Indesign?
    I don't want to upgrade to the latest Quark now i've got CC so going to make the leap to indesign only. Does Indesign auto convert or do I need anything else?

    ID does not load QXD files. There is a respective commercial third-party plug-in to that effect, but it's rather pricey and I'm not up to speed which versions of Quark and ID it supports and which features come over. Inquire in the ID forum.
    Mylenium

  • How i can add jar or dll file to VM lib by code or installer

    iam working at project to interact with rs232 port using comm api
    to work program corectly i must insert some files(jar,dll,broperty files)
    to the VM by copy and past ...
    the problem is how i can do it by installer?
    iam will be very thanks if i get help

    Reader has to be installed on the user's machine and most folks have already installed a PDF reader. You do not supply the code, but provide a link to Reader at the Adobe site so folks can get it if needed. There are many sites that provide such. If you distribute the code yourself, you have to follow certain rules and get permission. I am not sure, but I do not think there is any issue with providing the link, though you may have to have permission to use the Adobe logo with the link.

Maybe you are looking for

  • How can I put a parenthesis around the number?

    Hi expert people!!! One question:  How can I put a parenthesis around the number because I have this write:   /123 t_bsid-pago1, 141 t_bsid-pago2,           157 t_bsid-pago3, 175 t_bsid-pago4,           193 t_bsid-pago5. and if I put the parenthesis

  • Unable to install Windows 7 x64 on Partitioned 3TB

    Since my exhaustive search of these forums and Google provided no substantive hits, I decided to do it myself and install Windows 7 x64 on partition 3 (500GB) of a Western Digital 3TB drive via Boot Camp. I can say after two days of trying that it is

  • Adobe Photoshop Elements 13 won't launch email with photos attached, why?

    Adobe Photoshop Elements 13 won't launch email with photos attached, why?

  • Problem  in merging java script and java code

    hi, i want to merge java and javascript code but it is giving some surprising results. this is my code: <script language = "javascript"> <% String query_result= "1"; String buttontype=""; buttontype=(String)session.getAttribute("buttontype"); query_r

  • My iphone email not searching all mailboxes

    My Iphone 5S with iOS 8.0.2 updated is not allowing me to search all folders when I do a search (no longer appears as an option at the top).  Also, sent messages are not being shown in my email threads on the Iphone (is working properly on my laptop/