Signed jh.jar Problem

I'm deploying my app by java webstart and since it needs to access local resources, I signed my app and other jar files. THe problem now is that when my app loads jh.jar (JavaHelp) from classpath, it says that jh.jar is signed more than once. Is there anywhere I could download a non-signed jh.jar? Thanks

i placed in keystore URL the following "c:\program files\java\jdk1.6_13\jre\lib\security\cacerts "The keystore URL, if points to a file on the local system,. should look like
file:c:/program files/java/jdk1.6_13/jre/lib/security/cacerts

Similar Messages

  • Sign the jar problem, HELP

    Hi All
    Now I can successfully use this command as below and and get the tmpfoo file
    appletviewer http://java.sun.com/security/signExample12/signedWriteFile.html
    while doing my sign the jar it come out the below message
    jarsigner: Certificate chain not found for: duke. duke must reference a valid K
    eyStore key entry containing a private key and corresponding public key certific
    ate chain.
    Also .java.policy file added as below by policytool
    grant signedBy "Duke", codeBase "file:/c:/final_project/my.jar" {
    permission java.io.FilePermission "<<ALL FILES>>", "read, write, delete, execute";
    What can I do now :(

    Are you trying to use a self signed certificate or one you obtained from Verisign, etc

  • Problem Signing midlet .jar file.

    Hi,
    Step - 1 :
    ======
    - I have created a keystore first like.
    - c:> keytool -genkey -alias <alias> -keystore c:/abcd.sks -keyalg RSA*
    o/p : So it created a keystore.
    Step - 2:
    ======
    - I imported my certificate from Verisign into the keystore..
    - keytool -import -alias <alias> -keystore c:/abcd.sks -file <CompanyCert.cer>
    o/p : The certificate imported successfully.
    Problem :
    =======
    Problem occurs at the time of signing the jar file with jarsigner
    jarsigner Myjar.jar <alias>
    o/p :Jar is signed and It says, "your certificate will expire in six months". But our certificate has an expiry in 2011.
    Also when the jar file installed in the mobile, it occurs as an invalid application.

    The following may help you..
    JavaJar(written by java) can compress and decompress jar,war, ear and.zip...
    it can deal with manifest file and executable .jar file .specially.
    may download from http://www.qwerks.com/download/4114/JavaJar.zip
    the tool is very verygood tool.
    but the homepage(www.pivotonic.com) of JavaJar cannot be accessed.
    it is funny.
    good lucky.

  • Problems Signing a Jar File.

    Hi Everyone
    I'm having problems signing a jar file.
    The applet in the jar file was previously signed by Duke.
    Now I want to re-sign it with my company name.
    So I unzip the jar file. I was careful to remove the manifest and the Duke .sa and .rsa. I re-signed it with the netscape signtool.
    The applet works. It presents the prompt that it is signed by my company. I grant session. Then another prompt appears and it says it is signed by duke.
    but i was careful to remove the duke signature and manifest file when i unzipped it. Is it possible that the fact that it is signed by duke is stored in the bytecode ??
    It is using the <object tag by the way.
    <OBJECT classid="clsid:CAFEEFAC-0013-0001-0002-ABCDEFFEDCBA"
         WIDTH = "100%" HEIGHT = "50" border="0"
         codebase="http://www.homework911.com/java/j2re-1_3_1_02-win.exe#Version=1,3,1,2">
         <PARAM NAME = "CODE" VALUE = "com.s.SApplet"/>
         <PARAM NAME = "CODEBASE" VALUE = "/_phone"/>
         <PARAM NAME = "type" VALUE="application/x-java-applet;version=1.3"/>
    stev

    great suggestion - there are no other signed jar files on the browser for it to access. There is a winzip file but it has no rsa/dsa and signature file in it.
    perhaps it is accessing something else that was signed by duke ?
    Would it be possible for it to connect to a server program that was signed by duke and therefore present the prompt. ?
    I'm trying to get the original unsigned classes and see if i can recompile and sign it just in case then name duke is in byte code.
    any other thoughts as to what this code be ?
    stephen

  • Applet Signed JAR Problem

    Hi Members,
    * I am trying to uplaod a file to FTP server using apache API in Applet...
    * I have Signed the JAR(TestApplet.jar) file by the following steps,
    Generated the keytool for my created JAR file by the following command,
    keytool -genkey -alias TestApplet -validity 365
    Signed the JAR file by the following command,
    jarsigner TestApplet.jar TestApplet
    * The following is my HTML code to call my signed JAR file,
    +<HTML>+
    +<HEAD>+
    +</HEAD>+
    +<BODY>+
    +<APPLET ALIGN="CENTER" CODE="AppletExample.class" archive="AppletExample.jar" WIDTH="800" HEIGHT="500"></APPLET>+
    +</BODY>+
    +</HTML>+
    * The below is the my code in applet to upload a file to FTP server,
         public void upload(){
              try {
                   FTPClient client = new FTPClient();
                   FileInputStream fis = null;
                   client.connect("ftp.tnq.co.in");
                   client.login("workflow", "workflow");
                   String filename = "D:/Temp/upload.txt";
                   fis = new FileInputStream(filename);
                   client.storeFile("/home/workflow/TEST/javaupload.txt", fis);
                   client.logout();
                   fis.close();
                   System.out.println("File Uploaded Susccessfully.........");
              } catch (SocketException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (FileNotFoundException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
         }* The File is successfully uploaded to FTP server machine while running it in Eclipse IDE, but not in browser(Mozilla FireFox)
    * When i run it by browser it throws the following exception,
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.net.SocketPermission ftp.tnq.co.in resolve)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkConnect(Unknown Source)
         at java.net.InetAddress.getAllByName0(Unknown Source)
         at java.net.InetAddress.getAllByName(Unknown Source)
         at java.net.InetAddress.getAllByName(Unknown Source)
         at java.net.InetAddress.getByName(Unknown Source)
         at java.net.InetSocketAddress.<init>(Unknown Source)
         at org.apache.commons.net.SocketClient.connect(SocketClient.java:176)
         at org.apache.commons.net.SocketClient.connect(SocketClient.java:268)
         at AppletExample.upload(AppletExample.java:88)
         at AppletExample.actionPerformed(AppletExample.java:111)
         at java.awt.Button.processActionEvent(Unknown Source)
         at java.awt.Button.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)* Please let me know, why it is not running in browser....?
    * Thanks in advance
    Regards,
    JavaImran

    * Thanks for your thoughts....
    * As sabre said to me sign external also, so that now i did the following upload program by sun API only(now there is no external API jar file)
    public void upload( String ftpServer, String user, String password,
             String fileName, File source ) throws MalformedURLException,
             IOException
          if (ftpServer != null && fileName != null && source != null)
             StringBuffer sb = new StringBuffer( "ftp://" );
             // check for authentication else assume its anonymous access.
             if (user != null && password != null)
                sb.append( user );
                sb.append( ':' );
                sb.append( password );
                sb.append( '@' );
             sb.append( ftpServer );
             sb.append( '/' );
             sb.append( fileName );
              * type ==> a=ASCII mode, i=image (binary) mode, d= file directory
              * listing
             sb.append( ";type=i" );
             BufferedInputStream bis = null;
             BufferedOutputStream bos = null;
             try
                URL url = new URL( sb.toString() );
                URLConnection urlc = url.openConnection();
                urlc.setDoOutput(true);
                //urlc.setUseCaches(false);
                bos = new BufferedOutputStream( urlc.getOutputStream() );
                bis = new BufferedInputStream( new FileInputStream( source ) );
                int i;
                // read byte by byte until end of stream
                while ((i = bis.read()) != -1)
                   bos.write( i );
             finally
                if (bis != null)
                   try
                      bis.close();
                   catch (IOException ioe)
                      ioe.printStackTrace();
                if (bos != null)
                   try
                      bos.close();
                   catch (IOException ioe)
                      ioe.printStackTrace();
          else
             System.out.println( "Input not available." );
       }* Now also, it is executing well in eclipse, but not in browser both IE and Mozilla2.0
    * I got the following error, when i run it in browser,
    java.net.ProtocolException: cannot write to a URLConnection if doOutput=false - call setDoOutput(true)
         at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
         at sun.net.www.protocol.ftp.FtpURLConnection.getOutputStream(Unknown Source)
         at FileUploadAndDownload.upload(FileUploadAndDownload.java:76)
         at UploadAndDownload.actionPerformed(UploadAndDownload.java:67)
         at java.awt.Button.processActionEvent(Unknown Source)
         at java.awt.Button.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)* The erroe gives me to set setDoOutput(true) as true..., i did like that only in my coding........but throws erroe..... Why that...?
    * Please let me know your suggestions........
    Thanks and Regards,
    JavaImran

  • How to sign multiple jar files using the same certificate..?

    hi,
    I want to run my application using Java Web Start.. i am using around 16 different jar files out of which around 13 are 3rd party component jars. I want to sign these jars using the same certifcate..., i am using the follwing code to sign the jars:
    (for the jar file ischeduler.jar)
    keytool -genkey -alias signFiles91 -keystore dtss -keypass dtss1351 -dname "cn=dtss" -storepass decisioncraft
    jarsigner -keystore dtss -storepass decisioncraft -keypass dtss1351 -signedjar signedischeduler.jar ischeduler.jar signFiles91
    keytool -export -keystore dtss -storepass decisioncraft -alias signFiles91 -file ischeduler.cer
    keytool -import -alias DCA2 -file ischeduler.cer -keystore Impischeduler -storepass ischeduler
    (for the jar file ischedulerclient.jar)
    keytool -genkey -alias signFiles92 -keystore dtss -keypass dtss1351 -dname "cn=dtss" -storepass decisioncraft
    jarsigner -keystore dtss -storepass decisioncraft -keypass dtss1351 -signedjar signedischedulerclient.jar ischedulerclient.jar signFiles92
    keytool -export -keystore dtss -storepass decisioncraft -alias signFiles92 -file ischeduler.cer
    keytool -import -alias DCA3 -file ischeduler.cer -keystore Impischeduler -storepass ischeduler
    but when i use the above signed jars in my application i get an error saying:
    "jars not signed by the same certificate"
    can someone plz tel me wher is the error....thanx
    andy

    Well for mulitple signing of jar files you can use ANT tool. Its easier and faster.
    Regarding the present problem -- hmm.. well it looks like you are using 2 different alias names for signing the jar file. Try using the same alias name and that might solve your problem.
    regards
    Saby

  • There were warnings or errors while signing the jar  - webutil

    As oracle 10g comes with webutil, i am now trying to configure it with jocob and trying to run webutil_demo form, but I am getting bean not found error, I searched many forums but could not resolve my problem, everything seems to be at its place, but I am also getting error when i try to sign jacob.jar and webutil.jar files.
    First is it necessary to sign these files if yes then what cause will be preventing it to be signed.
    I am using forms AS 10.1.2, JRE 1.6, on Windows XP,
    Looking for help
    Thanks
    Naveed

    Hello,
    +"...but I am also getting error ..."+
    Are you a developer ? if so, what do you answer to your end-user when he/she calls you saying "I have an error" ?
    Francois

  • Sign jacob.jar In Oracle fusion

    Hi,
    Forms [32 Bit] Version 11.1.1.6.0 (Production)
    I am trying to sign jacob.jar but i can't syntax error.
    C:\Program Files\Java\jdk1.6.0_25\bin>C:\Oracle\Middleware\as_1\forms\templates\
    scripts\sign_webutil.bat C:\Oracle\Middleware\as_1\forms\java\jacob.jar
    regards,
    Edited by: kingadmin on May 14, 2012 6:52 PM
    Edited by: kingadmin on May 14, 2012 9:55 PM

    I am try to solve this problem :
    Exception in thread "thread applet-oracle.forms.engine.Main-2" java.lang.NoClassDefFoundError: com/jacob/com/ComFailException
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at oracle.forms.handler.UICommon.instantiate(Unknown Source)
         at oracle.forms.handler.UICommon.onCreate(Unknown Source)
         at oracle.forms.handler.JavaContainer.onCreate(Unknown Source)
         at oracle.forms.engine.Runform.onCreateHandler(Unknown Source)
         at oracle.forms.engine.Runform.processMessage(Unknown Source)
         at oracle.forms.engine.Runform.processSet(Unknown Source)
         at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
         at oracle.forms.engine.Runform.onMessage(Unknown Source)
         at oracle.forms.engine.Runform.sendInitialMessage(Unknown Source)
         at oracle.forms.engine.Runform.startRunform(Unknown Source)
         at oracle.forms.engine.Main.createRunform(Unknown Source)
         at oracle.forms.engine.Main.start(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.ClassNotFoundException: com.jacob.com.ComFailException
         at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)

  • Netbeans 5.0 Executable Jar Problem--One Solution

    Hi all.
    This issue seems to constantly come up with all the Netbeans IDEs. I managed to solve the problem I was having so I felt obligated to post my solution since it can be mind-numbingly frustrating to deal with.
    This may not work for you, but it worked for me in my situation so you may want to give it a shot.
    This is what I did to solve the problem:
    a) make sure a file called manifest.mf is in the root of your project folder. The manifest file should contain the following text (do not include the lines with ----------- on them of course):
    Manifest-Version: 1.0
    X-COMMENT: Main-Class will be added automatically by build
    To be safe:
    Note the trailing carriage return after the X-COMMENT line--LEAVE THIS IN.
    Note the case of the file name manifest.mf--MAKE SURE YOU DO NOT ADD CAPITAL LETTERS.
    b) In the nbprojects folder of your main project folder, open the file project.properties and add the line:
    manifest.file=manifest.mf
    Clean and build your project. If you check the manifest in the main jar file, you'll see (hopefully) it has the Main-Class attribute set, as well as the class path to any other jar files you've put in your project classpath.
    BTW1:
    Make sure you don't have any files open in the directories that will need to be deleted by the 'clean' step or you'll get an error.
    BTW2:
    Also, make sure you've set your main class in your project by right-clicking the project node, click Properties, select Run from the tree on the left side, and fill in the 'Main-Class' text field.
    This worked for me. I hope it helps others with the overly-confusing executable jar issues the Netbeans series of IDEs always seem to have. I think the complexity lies in its use of Ant in the build process. While Ant adds a ton of flexibility--it also a ton of complexity.
    For example, this jar issue has been very annoying, but I wouldn't have been able to add a hook into my build process that signs my jar files (for use with Java Web Start) without the Ant system.
    Netbeans 5.0 is still currently my favourite Java IDE though.
    Cheers!
    Michael N. Christoff

    Genius! thank.

  • Digitally sign a jar file for distribution?

    I recently got a jar of mine hosted for client use though a web page.
    The problem is that the jar needs to access the internet for several functions. JWS prompts the user for security reasons every time it makes a connection to a new url endpoint. Since one operation alone can hit 56 url's i thought this could be a bit of a hassle to the users.
    The solution, as I understand it to be, is to digitally sign the jar file, so the user is prompted once on download.
    I found a site ascertia which offers free certificates, but for the life of me I canb not get this to work.n I have seen keytool generate numerous errors, none of which mean anything to me. (too long >59, cant read chain from reply, invalid cert)
    Does someone know a clear and thorough tutorial on digital code signing and certs? Or a CA that provides certs for free, and has some instructions to go along?
    Thanks so much.
    The step i have trouble on is turning the CSR into a cert, and importing the returned cert back into the keystore.

    Masterkeedu wrote: !! It worked.
    Congratulations. :-)
    Masterkeedu wrote: So it's not certified, but is signed.
    So as I understand this, it means the end-user has no way to know it was me that truly signed it. But relies on their common sense I suppose.
    That is correct. The CA has verified, and is certifying, that you are who you claim to be. If you or I use a 'self signed' certificate, it does not carry the same level of trust. As you might understand already, the dialogs are different between the two certificate types, and some users cannot accept trusted code from an unverified (self-signed) certificate.
    I have been meaning to write a page on the differences between the two certificates. It is well worth looking into getting a cert. from a CA.
    There was a stage when one of the major CAs were offering 'freemail' certificates that came emblazoned not with your name, but 'free mail' itself. I did not like them because of that, and continue to use a self-signed certificate.

  • Using System.getProperty in the app, but still not signing the jar file

    Is there a way to use the System.getProperty call in the app but not sign the jar? I get the security exception when launched using WebStart?
    Any help appreciated.

    Yes. Don't use Web Start, and you'll have no problems.
    Seriously, the security exception is there by design. If you must call System.getProperty, you need to sign your jars -- though personally, I think there are situations where signing your jars to make Web Start work is a needless complication.
    However, if you still need a tool to deploy updates and such, I recommend Deploy Director from Sitraka.

  • Error not alloving sign my jar file - help needed

    hi guys i am getting the following error while trying to sign the jar file.
    unable to sign the jar ; jar.util.zip.zip exception: invalid entry compressed size .
    i got this while signing the msbase and msutil of MS jdbc jar files.
    what am i suppose to do.
    I am unable to understand one more thing. Do i need to have both jdbcodbc.dll library and msbase,msutil, mssqlserver jar files to connect using jdbc or its ok if i only have the jar files. I would appreciate if somebody can help me in this regard.
    thanks,
    ravi.

    hi guys i got the problem solved i unzipped the files and zipped them agian. Its working well .
    thanks,
    ravi.

  • Issue while signing a jar using RSA certificate

    Hi,
    I am trying to sign a java applet using trusted certificate with the help of Java keytool and jarsigner of JRE1.6. For this I have followed the following steps:
    1.Generated key pair in a keystore - keytool -genkeypair -keyalg RSA -alias eaikey -keystore eaikeystore  -validity 3650 -keysize 2048
    2.Generated CSR using command keytool -certreq -alias eaikey -file eaicert.csr -keystore eaikeystore and send the .csr file to the CA
    3.CA has returned the certificate reply (.cer file)that contained a root certificate
    4.When I tried to import the certificate using command keytool -import -file eaicert.cer -alias eaicertkey  -keystore eaikeystore to keystore, initially it gave me error as Input not an X.509 certificate.So I opened the .cer file in my text editor and removed the texts before the Begin And End Certificate.Then it got imported correctly by running the
    5.When I tried to sign the jar using command  jarsigner application.jar eaicertkey  -keystore eaikeystore
    it gave the exception as jarsigner: Certificate chain not found for: eaicertkey.  eaicertkey must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.
    Please help me with the step I am missing here.I doubt I am doing something wrong in the import step.
    Thanks in advance.

    you can mail me directly to [email protected], and I'll try to help.
    no guarenty :-)
    Tal
    [email protected]

  • From JavasSript called signed (FileDialog) Applet Problems...

    Hallo,
    I want to read a by JavaScript opened selected file with the FileDialog in a Byte[], and give this Byte[] back to JavaScript. I have this code for my unsigned applet working fine without reading the selected file in a byte[], but give the filepath and name back to JavaScript:
    import java.applet.Applet;
    import java.awt.FileDialog;
    import java.awt.Frame;
    import netscape.javascript.JSObject;
    public class OpenFileDialogJava6 extends Applet
         private static final long serialVersionUID = -1401553529888391702L;
         private Frame m_parent;
        private FileDialog m_fileDialog;
    *Displays a file dialog, calling standard JavaScript methods when the*
    user selects a file or cancels the dialog.
    *    public void newFileDialog(String onFileJS, String onCancelJS)*
    *          System.out.println("open Dialog...");*
    *         openDialog(onFileJS, onCancelJS);*
    *Displays a file dialog, calling the specified JavaScript functions when*
    the user selects a file or cancels the dialog.
    @param onFile The name of the function to call when the user selects a
    *file.*
    @param onCancel The name of the function to call when the user cancels
    *a dialog selection.*
        public void openDialog(final String onFile, final String onCancel)
             System.out.println("Calling open dialog...");
             if (m_parent == null)
                 m_parent = new Frame();
            if (m_fileDialog == null)
                 m_fileDialog = new FileDialog(m_parent, "Medien hinzuf&uuml;gen", FileDialog.LOAD);             
            m_fileDialog.setVisible(true);       
            m_fileDialog.toFront();
            final String directory = m_fileDialog.getDirectory();  
            final String returnFile = m_fileDialog.getFile();
             m_fileDialog.setVisible(false);     
            m_parent.setVisible(false);
            if (returnFile == null)
                 System.out.println("onCancel");
                 callJavaScript(onCancel);     
            else
                 System.out.println("onFile");
                 System.out.println(directory+returnFile);
                 callJavaScript(onFile, directory+returnFile);
         private void callJavaScript(final String func, final Object... args)
              final JSObject window = JSObject.getWindow(OpenFileDialogJava6.this);
              if (window == null)
                  System.out.println("Could not get window from JSObject!!!");
                  return;
              System.out.println("Calling func through window");
              try
                   window.call(func, args);
              catch (final Exception e)
                  System.out.println("Got error!!"+e.getMessage());
                  e.printStackTrace();
                  showError(e);
              System.out.println("Finished JavaScript call...");
         private void showError(final Exception e)
              final String[] args = new String[]{e.getMessage()};
              final JSObject window = JSObject.getWindow(this);
              try
                   window.call("alert", args);
              catch (final Exception ex)
                   System.out.println("Error showing error! "+ex);
    }I self-sign the Jar and write that byte[] test = (byte[]) java.security.AccessController.doPrivileged(
              new java.security.PrivilegedAction() to the code in where I want to read the file.....
    So now I started to change the code in the public void openDialog(final String onFile, final String onCancel) to get the Byte[] of the selected File
            final String directory = m_fileDialog.getDirectory();  
            final String returnFile = m_fileDialog.getFile();
            final File file = new File(directory+
                    File.separator +returnFile);
            byte[] test = (byte[]) java.security.AccessController.doPrivileged(
              new java.security.PrivilegedAction()
                   public Object run()
                      try
                          FileInputStream fileInputStream = new FileInputStream(file);
                          byte[] data = new byte[(int) file.length()];
                          try
                               fileInputStream.read(data);
                               fileInputStream.close();
                               return data;
                          catch(IOException iox)
                                System.out.println("File read error...");
                                iox.printStackTrace();
                                return null;
                     catch (FileNotFoundException fnf)
                           System.out.println("File not found...");
                           fnf.printStackTrace();
                           return null;
             m_fileDialog.setVisible(false);     
            m_parent.setVisible(false);
    .......Without signing the jar: I get this in IE 8:
    Meldung: java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\xampp\htdocs\index.php" "read")
    Zeile: 6
    Zeichen: 1
    Code: 0
    URI: file:///E:/FH%20Kempten/Semester%206/Java/Java%20Projekte/OpenFileDialogJava6/bin/Neues%20Textdokument.html
    Ok this I understand, but when I sign it, I open my FileDialog, select a file, ok -> nothing happens: Firfox and IE show me:
    uncaught exception: java.lang.reflect.InvocationTargetException*
    And in Java Console nothing: Just my Output:
    open Dialog...
    Calling open dialog...

    Hallo,
    I want to read a by JavaScript opened selected file with the FileDialog in a Byte[], and give this Byte[] back to JavaScript. I have this code for my unsigned applet working fine without reading the selected file in a byte[], but give the filepath and name back to JavaScript:
    import java.applet.Applet;
    import java.awt.FileDialog;
    import java.awt.Frame;
    import netscape.javascript.JSObject;
    public class OpenFileDialogJava6 extends Applet
         private static final long serialVersionUID = -1401553529888391702L;
         private Frame m_parent;
        private FileDialog m_fileDialog;
    *Displays a file dialog, calling standard JavaScript methods when the*
    user selects a file or cancels the dialog.
    *    public void newFileDialog(String onFileJS, String onCancelJS)*
    *          System.out.println("open Dialog...");*
    *         openDialog(onFileJS, onCancelJS);*
    *Displays a file dialog, calling the specified JavaScript functions when*
    the user selects a file or cancels the dialog.
    @param onFile The name of the function to call when the user selects a
    *file.*
    @param onCancel The name of the function to call when the user cancels
    *a dialog selection.*
        public void openDialog(final String onFile, final String onCancel)
             System.out.println("Calling open dialog...");
             if (m_parent == null)
                 m_parent = new Frame();
            if (m_fileDialog == null)
                 m_fileDialog = new FileDialog(m_parent, "Medien hinzuf&uuml;gen", FileDialog.LOAD);             
            m_fileDialog.setVisible(true);       
            m_fileDialog.toFront();
            final String directory = m_fileDialog.getDirectory();  
            final String returnFile = m_fileDialog.getFile();
             m_fileDialog.setVisible(false);     
            m_parent.setVisible(false);
            if (returnFile == null)
                 System.out.println("onCancel");
                 callJavaScript(onCancel);     
            else
                 System.out.println("onFile");
                 System.out.println(directory+returnFile);
                 callJavaScript(onFile, directory+returnFile);
         private void callJavaScript(final String func, final Object... args)
              final JSObject window = JSObject.getWindow(OpenFileDialogJava6.this);
              if (window == null)
                  System.out.println("Could not get window from JSObject!!!");
                  return;
              System.out.println("Calling func through window");
              try
                   window.call(func, args);
              catch (final Exception e)
                  System.out.println("Got error!!"+e.getMessage());
                  e.printStackTrace();
                  showError(e);
              System.out.println("Finished JavaScript call...");
         private void showError(final Exception e)
              final String[] args = new String[]{e.getMessage()};
              final JSObject window = JSObject.getWindow(this);
              try
                   window.call("alert", args);
              catch (final Exception ex)
                   System.out.println("Error showing error! "+ex);
    }I self-sign the Jar and write that byte[] test = (byte[]) java.security.AccessController.doPrivileged(
              new java.security.PrivilegedAction() to the code in where I want to read the file.....
    So now I started to change the code in the public void openDialog(final String onFile, final String onCancel) to get the Byte[] of the selected File
            final String directory = m_fileDialog.getDirectory();  
            final String returnFile = m_fileDialog.getFile();
            final File file = new File(directory+
                    File.separator +returnFile);
            byte[] test = (byte[]) java.security.AccessController.doPrivileged(
              new java.security.PrivilegedAction()
                   public Object run()
                      try
                          FileInputStream fileInputStream = new FileInputStream(file);
                          byte[] data = new byte[(int) file.length()];
                          try
                               fileInputStream.read(data);
                               fileInputStream.close();
                               return data;
                          catch(IOException iox)
                                System.out.println("File read error...");
                                iox.printStackTrace();
                                return null;
                     catch (FileNotFoundException fnf)
                           System.out.println("File not found...");
                           fnf.printStackTrace();
                           return null;
             m_fileDialog.setVisible(false);     
            m_parent.setVisible(false);
    .......Without signing the jar: I get this in IE 8:
    Meldung: java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\xampp\htdocs\index.php" "read")
    Zeile: 6
    Zeichen: 1
    Code: 0
    URI: file:///E:/FH%20Kempten/Semester%206/Java/Java%20Projekte/OpenFileDialogJava6/bin/Neues%20Textdokument.html
    Ok this I understand, but when I sign it, I open my FileDialog, select a file, ok -> nothing happens: Firfox and IE show me:
    uncaught exception: java.lang.reflect.InvocationTargetException*
    And in Java Console nothing: Just my Output:
    open Dialog...
    Calling open dialog...

  • It's urgent : Signing the JAR

    In my application there is a applet which tries to open a socket connection on client machine.
    And as per JAVA specification it throws a security exception.
    Which is absolutely right.
    But I want to test this application.
    Is there any utility or temporary signing clause which allows me to test the above thing with some limitations like u must have server and client (browser) running on same machine or anything.
    Regards,
    Sachin.

    if you want to test it temporarily, sign the jar and install its certificate on your local machine and feel free to test the Applet. When finished, you can uninstall the certificate. If you need help about Java security, refer to the Java Security tutorial 1.2 at the sun tutorials.
    Regards,
    Mohammed Saleem

Maybe you are looking for

  • Problem with Terminal Paths

    I was trying to set up my terminal to use for my computer science class and when i used the instructions from my professor to be able to run the binaries I get this when i open terminal. -bash: export: `/Library/Frameworks/Python.framework/Versions/3

  • I want to replace the body of iPhone gold 5s

    My iPhone fell down on the floor by mistakenly. So I want to change the body of my iPhone. Now I have got a small scratch on the side of the iPhone. It's just above the silent button. Will you be able to replace it or should I buy a new case for the

  • What is my sound format?

    I'm trying to submit my short through withoutabox and I'm not sure what to put as the audio format. I edited it with all the defaults coming off a minidv and exported it with quicktime conversion. Here are my choices: Dolby Digital EX SepMag/Cardband

  • How to reduce max buffer/cache size?

    Hi, every time I copy a file which is bigger or similiar in size to my total RAM (4gb) I notice very low responsibility from firefox (which is totally unresponsive, can't switch tabs or scroll for 30-60s). Of course my free memory is very low (someth

  • How to use PROCESS_HU_INBOUND_DLVRY to pack HU to another HU

    Hi Experts! I was able to use PROCESS_HU_INBOUND_DLVRY to pack a material to an HU. I am now trying to pack the HU created earlier to another HU. Anybody who has tried it? What parameters should I pass to the FM? Am I passing the correct ones? i_save