PROBLEM IN INTERNET EXPLORER WITH THE  fileupload API

i written a servlet to upload a file which will upload a file to a specific directory..............
this program is working with opera or Mozilla browser.......but it is not working in internet explorer 8.
i can not understand what is the problem..............
code working with opera or Mozilla and also for other browser but not with explorer 8..
my code is
index.jsp is a welcome file which is used to select a file  which i want to upload
index.jsp
<html>
<head><title>Upload page</title></head></p> <p><body>
<form action="uploadFile" method="post" enctype="multipart/form-data" name="form1" id="form1">
<center>
<table border="2">
<tr>
     <td align="center"><b>Multipale file Uploade</td>
     </tr>
<tr>
     <td>
          Specify file: <input name="file" type="file" id="file">
     <td>     </tr>
     <tr>
     <td>
<div align="center">
<input type="submit" name="Submit" value="Submit files"/>
</div></td>
</table>
     <center>
<p>
     </p>
</form>
</body>
</html>
uploadFile.java is servlet file which is used to upload the file in the specific location....
the code of uploadFile.java is
uploadFile.java
import java.io.IOException;
import java.util.Iterator;
import java.lang.Object;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.List;
import java.io.*;
import java.io.File;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload.disk.DiskFileItemFactory ;
import org.apache.commons.fileupload.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class uploadFile extends HttpServlet
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws IOException,ServletException {
HttpSession session=request.getSession();
PrintWriter out=response.getWriter();
ServletConfig config=getServletConfig();
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if(!isMultipart)
else
     FileItemFactory factory = new DiskFileItemFactory();
     ServletFileUpload upload = new ServletFileUpload(factory);
     List items = null;
     try {
          items = upload.parseRequest(request);
     } catch (FileUploadException e) {
          e.printStackTrace();
     Iterator itr = items.iterator();
     while (itr.hasNext()) {
     FileItem item = (FileItem) itr.next();
     if (item.isFormField()) {
     } else {
          try {
               String itemName = item.getName();
               if(itemName.equals(""))
               session.setAttribute("itemName",itemName);
               response.sendRedirect("index.jsp");
               File savedFile = new File(config.getServletContext().getRealPath("/")+"uploadedFiles/"+itemName);
               item.write(savedFile);
               out.println("Your file has been saved at the loaction:"+"\n"+config.getServletContext().getRealPath("/")+"uploadedFiles"+"\\"+itemName);
          } catch (Exception e) {
               e.printStackTrace();
Now i want to solve my problem in my code...............
pleasde help me.............

First of all, please do not shout in topic titles. It is rude.
Secondly, please buy a new keyboard. Your dot key hangs all the time, it reads annoying.
Back to your problem: did you read the FAQ available at the [FileUpload homepage|http://commons.apache.org/fileupload]? There´s something stated about a misbehaviour in IE and how to fix it using Commons IO. It is namely sending the complete client´s file path instead of only the file name.

Similar Messages

  • Does firefox have the same problem as internet explorer with flash player

    IE is having problems with adobe flash player. Before I download it on Mozilla platform I need to know if Mozilla is also having issues with flash player.

    There are some known issues with the Shockwave Flash plugin for Firefox that some are suffering from, so you will have install the plugin to see if you need to take action and how the plugin works.
    In case there are problems with current Shockwave Flash plugin versions, you can try this:
    *disable protected mode in the Flash plugin (Flash 11.3+ on Windows Vista and later)
    *disable hardware acceleration in the Flash plugin
    See also:
    *http://kb.mozillazine.org/Flash#Troubleshooting
    A possible option is to set the Flash plug to click-to-play by setting the permissions for Flash to "Ask To Activate" in "Firefox/Tools > Add-ons > Plugins".<br />
    That way you can activate the Flash plugin when you need it via the Lego block icon on the location bar.

  • The firefox page constantly says "Connecting" and will not load any websites. I've also updated the firefox software via internet explorer with the same reslults can you help?

    Internet explorer works perfectly and firefox will not load any websites

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    * https://support.mozilla.com/kb/Safe+Mode
    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")
    In Firefox 4 you can use one of these to start in <u>[[Safe mode]]</u>:
    * Help > Restart with Add-ons Disabled
    * Hold down the Shift key while double clicking the Firefox desktop shortcut (Windows)
    * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • When in firefox, I get a message that says no version of windows media player is supported. When I euse internet explorer with the same website, no error occurs. Why?

    I am working in the H&R Block website. When I get ready to take a test in their system, I get that error message described above. If I exit Firefox and use internet explorer instead there is no problem.

    Let's try a standalone Apple Mobile Device Support install. It still might not install, but fingers crossed any error messages will give us a better idea of the underlying cause of why it's not installing under normal conditions.
    Download and save a copy of the iTunesSetup.exe (or iTunes64setup.exe) installer file to your hard drive:
    http://www.apple.com/itunes/download/
    Download and install the free trial version of WinRAR:
    http://www.rarlab.com/
    Right-click the iTunesSetup.exe (or iTunes64setup.exe), and select "Extract to iTunesSetup" (or "Extract to iTunes64Setup"). WinRAR will expand the contents of the file into a folder called "iTunesSetup" (or "iTunes64Setup").
    Go into the folder and doubleclick the AppleMobileDeviceSupport.msi (or AppleMobileDeviceSupport64.msi) to do a standalone AMDS install.
    (If it offers you the choice to remove or repair, choose "Remove", and if the uninstall goes through successfully, see if you can reinstall by doubleclicking the AppleMobileDeviceSupport.msi again.)
    Does it install (or uninstall and then reinstall) properly for you? If so, does your device connect without that message now?

  • I get an "unable to connect" message yet I can connect and use Internet Explorer with no problem. I tried updating to Firefox4 and still get the same message. What do I do?

    I get an "unable to connect" message yet I can connect and use Internet Explorer with no problem. I tried updating to Firefox4 and still get the same message. What do I do?

    JungleTaxi Cabbie wrote:
    Csound1: iCloud: Configuring Mail with Mac OS X v10.6 or iOS 4
    Enter your Incoming Mail Server, User Name, and Password using the following settings:
    Incoming Mail Server: mail.me.com
    User Name: Your iCloud email address (excluding @me.com)
    Password: Your password
    Last Modified: Jun 27, 2013
    Maybe you should test these things before calling people out, because these settings do function perfectly well.
    iCloud is not supported on Snow Leopard or lower, why bother to mention it?
    The OP has an iCloud account, and that can not be opened without Lion or Mountain Lion (on a Mac), IOS5 or 6 (on an iPhone/iPad)
    The document I linked to is Apples documentation for iCloud on current devices,I don't care whether you believe that you know better than they do, but it will affect the people who follow your advice as it won't work
    JungleTaxi Cabbie wrote:
    Also, if you're not running Lion or Mountain Lion, there is no "Mail, Contacts & Calendars" prefpane.
    I never said that there was, perhaps you imagined it.

  • I cant use the "google search" button but no proble, with internet explorer. The" feeling lucky" works.

    i cant use the "google search" button with firefox 3.6.6 or even 3.5. I have no problem with searching google on internet explorer. The" Im feeling lucky" button works. The google search tab on the top right corner of firefox browser works fine. But the main google search button on the google site doesnt work. I havent changed anything. i cant do anymore google searches.
    == URL of affected sites ==
    http://www. google.com

    When click on search, the Google search result didn't update (the google search page didn't change). BUT the url bar on top did have the Google URL updated with the new search term.
    Something like
    http://www.google.com/#hl=en&q=firefox+3.6+problem+with+google+search+button&aq=f&aqi=&aql=&oq=&gs_rfai=&fp=dd2d1939af06a5a
    So the URL is changed when I click the Google SEARCH button on the page. Just the page not changed nor updated.
    And when I click "Reload current Page", then the page is reloaded with the new google search result.

  • HT203200 i have a windows 7 laptop, and my itunes account wont log in, it is logged in on internet explorer on the website but when i come to log in on the itunes software on the laptop it comes up with error (-51) i defo have the right password, help!

    i have a windows 7 laptop, and my itunes account wont log in, it is logged in on internet explorer on the website but when i come to log in on the itunes software on the laptop it comes up with error (-51) i defo have the right password, help!

    fighter19lisa wrote:
    that only makes it say its synced, when its not.
    No, it does not.  It transfers purchases from the iDevice to the computer.  The computer must be authorized for the Apple ID that the content was acquired with.
    fighter19lisa wrote:
    my playlists wont show up on the phone.
    Are they selected to sync?  Is Manually Manage content on the device selected?
    fighter19lisa wrote:
    i had to change my password for my aol account again and i still cannot get my email on my phone to even work
    What does that have to do with syncing content to the device?  FYI, nothing.

  • Java Applet problem in Internet Explorer 7 with Tab Key

    Hi
    I am developing some web pages in which iam using a java applet. so far the intended user are supposed to be using Internet Explorer 7. the problem i am facing is that when i press the tab key within the applet. the control get transferred to new tab position in the web page outside the applet and i have to click back to the applet to get control again transferred to the applet.
    i want to restrict the control of tab so that when tab is pressed within the applet the tab should not move to next tab position in the page and remain confined within the applet.
    Can someone please help me how can i achieve this and whether i have to do coding for it in the applet or in the web page...so that within the applet the Internet Explorer tab control should remain disabled..

    Hello all,
    I have the same problem, but I don't found a solution. Could you resolved the problem and who??
    Thank you.
    Jorge

  • How do I get Firefox to open when I dial up to connect to the internet, instead of internet explorer for the internet service provider?

    I have a dial up connection for the internet through Netzero.com, and when I click on it to dial up to the internet, it brings up the Netzero home page on Internet Explorer. I've changed my default home page from Internet Explorer, to Firefox, but when the internet is connected, Internet Explorer is the one that brings up the Netzero home page, not Firefox, so I have to click on the icon for Firefox, and then it opens, with Netzero home page on it, so I have to go through 2 different processes to get to use Firefox. I downloaded Firefox because it's suppose to be faster that Internet Explorer, especially since Internet Explorer keeps not responding when I'm in the middle of doing something. So I thought I'd try Firefox, but it doesn't seem to be faster than Internet Explorer, since the ISP that I have has a web accelerator, but it doesn't work on Firefox for some reason, I can see on a meter on my desktop when it's accelerating, and Firefox doesn't accelerate ever, if I change over to Internet Explorer, I can see the meter accelerating the web page. Hope you can help me with this problem, as I like Firefox. Thank you very much.

    Try changing firefox to the default browser: [http://kb.mozillazine.org/Setting_Your_Default_Browser]. That will probably get firefox to open when you dial up.
    I'm not sure what you mean by "the meter accelerating the web page". Can you explain that?
    Thank you

  • Java Applet Background Color Problem on Internet Explorer

    Hi,
    Please check out the following URL:
    http://www.utopiainteractive.com/clients/AkonFinal/glossary.htm
    The menu bar is writting in Java Applet. If you scroll down the page, and scroll back up, I see white background as I scroll back up. It happens only on Internet explorer. Neither Java Applet nor HTML Body bg color is white. I am kinda lost, and any help would really be appreciated.
    Thank you and look forward to hearing from someone soon.
    Sachin

    Hi,
    Well I used HtmlConver utility to generate applet html code, so I assume nothing is wrong with Object tag. Do you know what could cause this problem on Internet explorer? To be honest, I spent last couple of days, but I am just lost. It absolutely works fine on Netscape.
    Thanks,
    Sachin

  • Strange image-cacheing in Internet-Explorer with Java1.5-Applet

    I have written a Java-Applet for showing image-slideshows.
    In short words, the applet loads an image, scales it to screen-size,
    and loads the next image when one clicks on the applet.
    The applet causes a problem in MS Internet Explorer. The memory allocated by an image is never freed. After about 30-40 images, more tham 100MB are allocated by the JVM and the JVW crashes throwing an OutOfMemoryError.
    The same Applet runs fine on Netscape and Mozilla. Here, the memory allocated is always between 8 and 25 MB, even after sliding through hundreds of images.
    Some more coordinates:
    The applet is written in Java1.5 source code. My test-system is a P4 with Windows XP SP2. I have tried out Sun's JVM 1.5.0_03 and BEA's JVM JRockit 1.5.0_02 as browser-plugins, both cause the same problem in MS-IE6.
    I have tried to replace Applet.getImage() by com.sun.image.codec.jpeg.JPEGCodec.decodeAsBufferedImage() - same results.
    I have tried to flush any loaded images explicitely in the Applet.stop()-method, but no effort.
    The images are definitely not stored in some static containers inside my applet. The problem occurs on the level of the JVM/browser-constellation.
    Now my question: Is there any trick to affect the cacheing-mechanisms of the JVM? Image.flush() does not solve the problem.
    Is this a Java1.5 bug? Or a MS-IE bug?
    Is there anything that I did not consider?
    Thanks in advance

    I have written a Java-Applet for showing image-slideshows.
    In short words, the applet loads an image, scales it to screen-size,
    and loads the next image when one clicks on the applet.
    The applet causes a problem in MS Internet Explorer. The memory allocated by an image is never freed. After about 30-40 images, more tham 100MB are allocated by the JVM and the JVW crashes throwing an OutOfMemoryError.
    The same Applet runs fine on Netscape and Mozilla. Here, the memory allocated is always between 8 and 25 MB, even after sliding through hundreds of images.
    Some more coordinates:
    The applet is written in Java1.5 source code. My test-system is a P4 with Windows XP SP2. I have tried out Sun's JVM 1.5.0_03 and BEA's JVM JRockit 1.5.0_02 as browser-plugins, both cause the same problem in MS-IE6.
    I have tried to replace Applet.getImage() by com.sun.image.codec.jpeg.JPEGCodec.decodeAsBufferedImage() - same results.
    I have tried to flush any loaded images explicitely in the Applet.stop()-method, but no effort.
    The images are definitely not stored in some static containers inside my applet. The problem occurs on the level of the JVM/browser-constellation.
    Now my question: Is there any trick to affect the cacheing-mechanisms of the JVM? Image.flush() does not solve the problem.
    Is this a Java1.5 bug? Or a MS-IE bug?
    Is there anything that I did not consider?
    Thanks in advance

  • Css problem in internet explorer

    Hi to all!
    On my page as part of the page template I have build in a little drop-down user panel on the left top of the page.
    html:<div id="userpanel">
      <span><img src="'#APP_IMAGES#openSlidedown.png" /> <a>logon: &APP_USER.</a>
      <div id="userpanel_hsreg"><p>Autorisiert für: &APP_CODES_DISP.</p>
      <p>| #NAVIGATION_BAR#</p>
      </div></span>
    </div>css:#userpanel,
    #userpanel * {
            position:relative;
         font-family:verdana; font-size:12px;
         margin:0; padding:1px; border:0;
         white-space:nowrap;
    #userpanel a,
    #userpanel span { display:inline-block; }
    #userpanel>span>a { color:#999; }
    #userpanel span:hover div { display:block; }
    #userpanel>span:hover > a { color:black; }
    #userpanel_hsreg {
              display:none;
              position:absolute;
              left:+5px;
              top:+24px;
              background:#fff;
              padding:10px 18px;
              line-height:180%;
              border:1px solid silver;
              border-radius: 6px;
              box-shadow:1px 2px 5px #aaa;
              z-index:99;
    #userpanel>span>a {
              border-bottom:1px solid silver;
              margin-top: 5px;
              }So what happens is this: if the user hovers over the "+logon: username+", a little box pops up with some further information (the item &APP_CODES_DISP.) and the logout-link. Below this link, the Navigation bar starts. So while the box pops up, it covers a part of the region below, what its meant to do.
    The promlem is, that this doesnt work in Internet Explorer properly, when its launched from apex. Instead, the popup-box is displayed behind the region below. In Mozilla, as always, everything worls fine. This problem ocured already, when I opened the html-file from desktop, but I fixed that by putting the z-index-attribute in. Only now, in Apex, its still now working in IE. I am not that of an expert in css. I have tried different XHTML declarations in the header, all no difference.
    The current one:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">This might be a bit of a tricky issue, so I dearly hope, someone can help me. (Similar problem like the other threat I started recently here where the round-corner attribute is not working in IE-Apex, but this time its a bit more vital. :) )
    I have v 4.0.2.
    Thanks and greetings,
    tobi

    Hi again!
    This turns out not to be an APEX-issue, as I tought first, but rather a css-problem. Maybe therefore I'm in the wrong forum, but maybe someone can help me anyway.
    I have created two pages with the relevant element: (login with test/test please) one page with standard tabs and another with my own html-navigation. Now Internet Explorer has the option "Compatibility View" which in our company is activated by default. On page 1 it makes no difference, but on the second, with Compatibility View on, the drop-down box apeares behind my selfimplemented navigation bar. WHY IN GODS NAME DOES THIS HAPPEN??
    I have posted the same question in a german web-developer forum (here) also, because its quite urgent that I solve this, and as I mentioned above, many colleagues work with IE.
    So if anyone here is a css-IE9-expert... :)
    Thanks and best regards,
    Tobi
    edit: ok, its solved. The userpanel-div needed a "z-index:1;" attribute for IE. :)
    Edited by: tpetri on 03.09.2012 09:53

  • Weird text problem in Internet Explorer (Again)

    Hi all,
    I wonder if anyone out there can help me with this issue. I have just finished a website I have been working on for months. Through the whole process I have been testing the site in Firefox and internet explorer 8 however when I published the site online and tested the site internet explorer sometimes shows the page all jumbled up as displays the pages as detailed in the image below.
    The thing is it seems to show different on different computers I have 4 here and some show ok and some don’t which is puzzling?
    The weirdest thing of all is that i published the same site to both my domains www.ezway.co.uk and www.windows7dvd.com and on the computer I am using now (using internet explorer 8) the windows site shows as it should and the ezway site shows all messed up as displayed in the attached image.
    I know this is a puzzling one but is anyone familiar with a problem like this.
    ( Please ignore the gap halfway down the image as I needed to upload it in two separate halves )
    Also the red boxes are to highlight the errors on the page..
    Hope you can help.
    ezway.

    Hi all,
    I wonder if anyone out there can help me with this issue. I have just finished a website I have been working on for months. Through the whole process I have been testing the site in Firefox and internet explorer 8 however when I published the site online and tested the site internet explorer sometimes shows the page all jumbled up as displays the pages as detailed in the image below.
    The thing is it seems to show different on different computers I have 4 here and some show ok and some don’t which is puzzling?
    The weirdest thing of all is that i published the same site to both my domains www.ezway.co.uk and www.windows7dvd.com and on the computer I am using now (using internet explorer 8) the windows site shows as it should and the ezway site shows all messed up as displayed in the attached image.
    I know this is a puzzling one but is anyone familiar with a problem like this.
    ( Please ignore the gap halfway down the image as I needed to upload it in two separate halves )
    Also the red boxes are to highlight the errors on the page..
    Hope you can help.
    ezway.

  • Can I create a cert with the Java API only?

    I'm building a client/server app that will use SSL and client certs for authenticating the client to the server. I'd like for each user to be able to create a keypair and an associated self-signed cert that they can provide to the server through some other means, to be included in the server's trust store.
    I know how to generate a key pair with an associated self-signed cert via keytool, but I'd prefer to do it directly with the Java APIs. From looking at the Javadocs, I can see how to generate a keypair and how to generate a cert object using an encoded representation of the cert ( e.g. java.security.cert.CertificateFactory.generateCertififcate() ).
    But how can I create this encoded representation of the certificate that I need to provide to generateCertificate()? I could do it with keytool and export the cert to a file, but is there no Java API that can accomplish the same thing?
    I want to avoid having the user use keytool. Perhaps I can execute the appropriate keytool command from the java code, using Runtime.exec(), but again a pure java API approach would be better. Is there a way to do this all with Java? If not, is executing keytool via Runtime.exec() the best approach?

    There is no solution available with the JDK. It's rather deficient wrt certificate management, as java.security.cert.CertificateFactory is a factory that only deals in re-treads. That is, it doesn't really create certs. Rather it converts a DER encoded byte stream into a Java Certificate object.
    I found two ways to create a certificate from scratch. The first one is an all Java implementation of what keytool does. The second is to use Runtime.exec(), which you don't want to do.
    1. Use BouncyCastle, a free open source cryptography library that you can find here: http://www.bouncycastle.org/ There are examples in the documentation that show you how to do just about anything you want to do. I chose not to use it, because my need was satisfied with a lighter approach, and I didn't want to add a dependency unnecessarily. Also Bouncy Castle requires you to use a distinct version with each version of the JDK. So if I wanted my app to work with JDK 1.4 or later, I would have to actually create three different versions, each bundled with the version of BouncyCastle that matches the version of the target JDK.
    2. I created my cert by using Runtime.exec() to invoke the keytool program, which you say you don't want to do. This seemed like a hack to me, so I tried to avoid it; but actually I think it was the better choice for me, and I've been happy with how it works. It may have some backward compatibility issues. I tested it on Windows XP and Mac 10.4.9 with JDK 1.6. Some keytool arguments changed with JDK versions, but I think they maintained backward compatibility. I haven't checked it, and I don't know if I'm using the later or earlier version of the keytool arguments.
    Here's my code.
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.security.KeyStore;
    import java.security.KeyStoreException;
    import java.security.NoSuchAlgorithmException;
    import java.security.cert.CertificateException;
    import javax.security.auth.x500.X500Principal;
    import javax.swing.JOptionPane;
    public class CreateCertDemo {
         private static void createKey() throws IOException,
          KeyStoreException, NoSuchAlgorithmException, CertificateException{
         X500Principal principal;
         String storeName = ".keystore";
         String alias = "keyAlias";
         principal = PrincipalInfo.getInstance().getPrincipal();
         String validity = "10000";
         String[] cmd = new String[]{ "keytool", "-genKey", "-alias", alias, "-keyalg", "RSA",
            "-sigalg", "SHA256WithRSA", "-dname", principal.getName(), "-validity",
            validity, "-keypass", "keyPassword", "-keystore",
            storeName, "-storepass", "storePassword"};
         int result = doExecCommand(cmd);
         if (result != 0){
              String msg = "An error occured while trying to generate\n" +
                                  "the private key. The error code returned by\n" +
                                  "the keytool command was " + result + ".";
              JOptionPane.showMessageDialog(null, msg, "Key Generation Error", JOptionPane.WARNING_MESSAGE);
         KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
         ks.load(new FileInputStream(storeName), "storePassword".toCharArray());
            //return ks from the method if needed
    public static int doExecCommand(String[] cmd) throws IOException{
              Runtime r = Runtime.getRuntime();
              Process p = null;
              p = r.exec(cmd);
              FileOutputStream outFos = null;
              FileOutputStream errFos = null;
              File out = new File("keytool_exe.out");
              out.createNewFile();
              File err = new File("keytool_exe.err");
              err.createNewFile();
              outFos = new FileOutputStream(out);
              errFos = new FileOutputStream(err);
              StreamSink outSink = new StreamSink(p.getInputStream(),"Output", outFos );
              StreamSink errSink = new StreamSink(p.getErrorStream(),"Error", errFos );
              outSink.start();
              errSink.start();
              int exitVal = 0;;
              try {
                   exitVal = p.waitFor();
              } catch (InterruptedException e) {
                   return -100;
              System.out.println (exitVal==0 ?  "certificate created" :
                   "A problem occured during certificate creation");
              outFos.flush();
              outFos.close();
              errFos.flush();
              errFos.close();
              out.delete();
              err.delete();
              return exitVal;
         public static void main (String[] args) throws
              KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException{
              createKey();
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStream;
    import java.io.PrintWriter;
    //Adapted from Mike Daconta's StreamGobbler at
    //http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=4
    public class StreamSink extends Thread
        InputStream is;
        String type;
        OutputStream os;
        public StreamSink(InputStream is, String type)
            this(is, type, null);
        public StreamSink(InputStream is, String type, OutputStream redirect)
            this.is = is;
            this.type = type;
            this.os = redirect;
        public void run()
            try
                PrintWriter pw = null;
                if (os != null)
                    pw = new PrintWriter(os);
                InputStreamReader isr = new InputStreamReader(is);
                BufferedReader br = new BufferedReader(isr);
                String line=null;
                while ( (line = br.readLine()) != null)
                    if (pw != null)
                        pw.println(line);
                    System.out.println(type + ">" + line);   
                if (pw != null)
                    pw.flush();
            } catch (IOException ioe)
                ioe.printStackTrace(); 
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import javax.security.auth.x500.X500Principal;
    public class PrincipalInfo {
         private static String defInfoString = "CN=Name, O=Organization";
         //make it a singleton.
         private static class PrincipalInfoHolder{
              private static PrincipalInfo instance = new PrincipalInfo();
         public static PrincipalInfo getInstance(){
              return PrincipalInfoHolder.instance;
         private PrincipalInfo(){
         public X500Principal getPrincipal(){
              String fileName = "principal.der";
              File file = new File(fileName);
              if (file.exists()){
                   try {
                        return new X500Principal(new FileInputStream(file));
                   } catch (FileNotFoundException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                        return null;
              }else{
                   return new X500Principal(defInfoString);
         public void savePrincipal(X500Principal p) throws IOException{
              FileOutputStream fos = new FileOutputStream("principal.der");
              fos.write(p.getEncoded());
              fos.close();
    }Message was edited by:
    MidnightJava
    Message was edited by:
    MidnightJava

  • Problem in Internet Explorer

    Dear all
    I have just completed my first JavaFX animation which I have tried to upload to my website. I used NetBeans to make it, set the program properties to "browser" mode and copied the contents of the "dist" folder to my website (also renaming the JNLP codebase and homepage paths to those of my website)
    The situation I have now is that, when I point internet explorer to the html page the applet SOMETIMES loads, and sometimes just gets stuck with the java animation going round and round. However, if I use Chrome instead it ALWAYS works. Since Chrome always works then I must have set the files up correctly, so why is internet explorer doing this? I am a teacher and unfortunately I am aware that most of my colleagues who may use the animation probably have the dreaded Internet Explorer installed.
    Any thoughts on this folks?
    You can try for yourselves here: [http://www.mpklein.co.uk/filter/driven_oscillator/driven_oscillator.html]
    Thank you
    Matt

    Hi PhiLho
    It is IE8 and I am running Windows 7.
    I have noticed that if I click refresh it usually helps get past the java loading animation where it gets stuck. I also emailed a few friends and some of them reported the same, that it sticks at that point.
    Strange though that Chrome ALWAYS works, but IE just SOMETIMES.
    These are the other files that I uploaded:
    http://www.mpklein.co.uk/filter/driven_oscillator/driven_oscillator.jnlp
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://www.mpklein.co.uk/filter/driven_oscillator/" href="Driven_Oscillator.jnlp">
    <information>
    <title>Driven_Oscillator</title>
    <vendor>Matt</vendor>
    <homepage href="http://www.mpklein.co.uk/filter/driven_oscillator/"/>
    <description>Driven_Oscillator</description>
    <offline-allowed/>
    </information>
    <resources>
    <j2se version="1.5+"/>
    <extension name="JavaFX Runtime" href="http://dl.javafx.com/1.3/javafx-rt.jnlp"/>
    <jar href="Driven_Oscillator.jar" main="true"/>
    </resources>
    <application-desc main-class="com.sun.javafx.runtime.main.Main">
    <argument>MainJavaFXScript=driven_oscillator.Main</argument>
    </application-desc>
    <update check="always"/>
    </jnlp>
    and
    http://www.mpklein.co.uk/filter/driven_oscillator/driven_oscillator.jnlp
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://www.mpklein.co.uk/filter/driven_oscillator/" href="Driven_Oscillator_browser.jnlp">
    <information>
    <title>Driven_Oscillator</title>
    <vendor>Matt</vendor>
    <homepage href="http://www.mpklein.co.uk/filter/driven_oscillator/"/>
    <description>Driven_Oscillator</description>
    <offline-allowed/>
    </information>
    <resources>
    <j2se version="1.5+"/>
    <extension name="JavaFX Runtime" href="http://dl.javafx.com/1.3/javafx-rt.jnlp"/>
    <jar href="Driven_Oscillator.jar" main="true"/>
    </resources>
    <applet-desc name="Driven_Oscillator" main-class="com.sun.javafx.runtime.adapter.Applet" width="800" height="500">
    <param name="MainJavaFXScript" value="driven_oscillator.Main"/>
    </applet-desc>
    <update check="always"/>
    </jnlp>
    The html file, jar and both jnlp files are all in the same [www.mpklein.co.uk/filter/driven_oscillator|http://www.mpklein.co.uk/filter/driven_oscillator] folder.
    Cheers
    Matt

Maybe you are looking for