How to read a local file from Applet Code

Hi
I am developing a application and i want to access a local file from the applet
So pls help me in coding for this

You can't do that, at least not with an unsigned applet.
Sign your applet and it should work just like normal file access.

Similar Messages

  • How to read a local file from Forms10g using PJC/Bean

    I'm trying to read a file on the client machine using a Bean.
    The code in the Bean is:
    File fp = new File(mFileName);
    printToConsole( "AFTER creating a File object " );
    if (fp.exists())
    I get the message after creating File object. But at the next statement - fp.exists() - the Forms session terminates giving a FRM-92100 - Your connection to the server was interrupted.
    Any ideas?
    Thanks in advance for your help.
    Amit

    Frank, Thank you for your response on signing the jar. That was exactly what I was missing. After signing the jar, I am able to do client level operations.
    Grant, Thank you for asking about WebUtil. To give you a background as to what we are trying to do - to integrate our Forms 10g application with another software - in this case a client-server app. We want to send a message from this app. to our Forms10g app.(a pre-defined Form in the app.) which would initiate certain Forms navigation based on the message. In essence, Forms needs to be "listening" to this app. (in a non-blocking mode, the Forms app. should not be "locked-out" while listening for a message)
    The only way I could think of was to write a Bean (modified version of Frank's Dispatch Event sample on his blog) which would spawn a thread and listen for a message from the other app. For our prototype, I started off with watching for a file on the client machine. The final goal is to listen for a message on MQ. This will facilitate us to integrate our Forms10g app. with any other app.
    Regarding WebUtil, I did not find a way to do the listening/polling in a non-blocking way. Maybe I must have missed the obvious - Frank can very well attest to that.
    Any feedback is most welcome.
    Thanks.
    Amit

  • How to Read a CAB File from JAVA?

    Hi,
    Anyone knows how to read a CAB File from java. I need to read a property file of txt file that is packaged in CAB file & then based on that, I have to do processing. Is there anyway to do it.
    I had tried using java.util.zip.ZipFile Class, but it does work for JAR, but not for CAB.
    siva.

    Perhaps there's something in the Cabinet SDK that will help:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncabsdk/html/cabdl.asp

  • How to call a .bat file from java code?

    How to call a .bat file from java code? and how can i pass parameters to that .bat file?
    Thanks in advance

    thanks for ur reply
    but still i am getting the same error.
    I am trying to run a .bat file of together tool, my code looks like below
    import java.lang.Runtime;
    import java.lang.Process;
    import java.io.File;
    class SysCall{
         public static void main(String args[]){
              String cmd="D://Borland//Together6.2//bin//Together.bat -script:com.togethersoft.modules.qa.QA -metrics out:D://MySamples//Metrics// -fmt:html D://Borland//Together6.2//samples//java//CashSales//CashSales.tpr";
              //String path="D://Borland//Together6.2//bin//Together.bat ";
              Runtime r= Runtime.getRuntime(); //Declare the system call
              try{
                   System.out.println("Before batch is called");
                   Process p=r.exec(cmd);
                   System.out.println(" Exit value =" + p.exitValue());
                   System.out.println("After batch is called");
              /*can produce errors which must be caught*/
              catch(Exception e) {
                   e.printStackTrace();
                   System.out.println (e.toString());
    I am getting the below exception
    Before batch is called
    java.lang.IllegalThreadStateException: process has not exited
    at java.lang.Win32Process.exitValue(Native Method)
    at SysCall.main(SysCall.java:17)
    java.lang.IllegalThreadStateException: process has not exited

  • How to open a local file from javascript in a jsp-page

    Hi
    I have created an iview from a PAR file. In the par file I have a jsp-page with some javascript code. From the javascript coe I want to open a new window with an Excel file.
    I have tried window.open("c:
    test.xls", "test_window"), but it doesn't seem to work. I have created a small HTML page locally with the same command and there a new window opens with the Excel file.
    If I change the local file path with an URL it also works.
    Any idea how to open a local file ?
    Thanks
    /Jakob

    Jacob,
    I'm not 100% (but 99,9%) and it has to do with security ristrictions of the browser not allowing to have local workstation interation from the web. This is ofcourse very dangerous if the browser would allow it... So therfore it is blocked. What if somone would point to a file/executable that formats your drive so for that reason it is not allowed to have web interaction with a local file. Only with Java Applets this is possible but still with many limitations, and what I remember Google Gears and Adobe Air do have some limited web 2 local file interaction... So best and most simple solution you are left with is pointing to a url instead of a file on a c:\ drive.
    PS The reason why it works when you start the html from your local PC has todo with the fact that the browser detects that the html is not running in the web at that moment therefor allowing the access.
    Cheers,
    Benjamin Houttuin

  • How to call a .jsp file from Applet

    Could any one guide me how to call a .jsp file from a Applet using action Event.
    Thanks

    http://javaalmanac.com/cgi-bin/search/find.pl?words=URL+post

  • How to read time capsule files from iphone

    any one knows how to do this?
    i have used in the past an application call Soonr to access the mac but haven't tried if it works with time capsule.
    thanks for any thoughts/suggestions...

    Hi Harish,
    U can read all the files from a App's dir with this FM.
      CONCATENATE  '' '.'
             INTO LV_FILE1.
    *FM lists out the files present in App Server directory matching with given pattern.
      CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
        EXPORTING
          DIR_NAME                     = DIR_NAME
          FILE_MASK                    = LV_FILE1
       IMPORTING
    DIR_NAME                     =
         FILE_COUNTER                 =  FLE_CNT
    ERROR_COUNTER                =
        TABLES
          DIR_LIST                     = IT_DIRTAB
       EXCEPTIONS
         INVALID_EPS_SUBDIR           = 1
         SAPGPARAM_FAILED             = 2
         BUILD_DIRECTORY_FAILED       = 3
         NO_AUTHORIZATION             = 4
         READ_DIRECTORY_FAILED        = 5
         TOO_MANY_READ_ERRORS         = 6
         EMPTY_DIRECTORY_LIST         = 7
         OTHERS                       = 8
    Regards,
    KC

  • How to read an audio file from the disk and play it?

    Do you know who to read an audio file from the hard disk and play it. It's for an application and not an applet. I tried with the Applet.newAudioClip(URL url) thing, but I keep getting a MalformedURLException.
    And is there a way to get the path of the file you are using? Currently I'm doing this:
    File file = new file("randomname");
    string = file.getAbsolutePath();
    file.delete();
    I'm sure there's a better way. And this is not for an applet, just a normal app.

    Below is a class that should be of use to you.
    package com.sound;
    import java.io.File;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.Clip;
    import javax.sound.sampled.DataLine;
    public class SoundPlayer implements Runnable {
         String filename;
         public SoundPlayer(String filename){
              this.filename = filename;
              Thread t = new Thread(this);
              t.start();
         }//SoundPlayer constructor
         public void run(){
              playSound();
         }//run method
         public boolean playSound(){
              try {
                   File file = new File(filename);
                   AudioInputStream stream = AudioSystem.getAudioInputStream(file);
                   AudioFormat     format = stream.getFormat();
                   DataLine.Info info = new DataLine.Info(Clip.class, format);
                   Clip clip = (Clip)AudioSystem.getLine(info);
                   clip.open(stream);
                   clip.start();
                   while (clip.isRunning()) {
                       Thread.sleep(100);
                   clip.close();
              catch (Exception e) {
                  System.err.println("Error in run in SoundPlayer");
                   return false;
              return true;
         }//playSound() method
    }//Class SoundPlayer

  • How to read a text file from a Jar file

    Hi
    How can I read a text file from a Jar file?
    Thanx in advance..

    thanx
    helloWorld it works.damn, I didn't remove it fast enough. Even if it is urgent, it is best not to mention it, telling people just makes them take longer.

  • How to read an xml file from headers

    Hi ,
    I am not getting how to read an xml file sent by client device in header to server.
    Thankx.

    There is a getHeader() in HttpServletRequest interface
    String locationURL=request.getHeader("Location");If URL of your file was set in Location attribute of header.
    Edited by: ngpgeeta on Dec 19, 2008 8:03 AM

  • How to read a XML file from BLOB column and insert in a table - PL/SQL Only

    Hi,
    To make data load more simple to end user instead placing file on the server and use SQL-LOADER, I came up with new idea that using oracle ebusiness suite attachment functionality. that loads a XML file from local PC to a database column(table is fnd_attachments, default data type is BLOB over here).
    I tried with DBMS_LOB and didnt get around.
    Please can anyone tell me how to read the BLOB column using PL/SQL and store the data in a oracle table. Here's the sample XML file and table structure FYI.
    <?xml version="1.0" encoding="UTF-8"?>
    <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Corporate_alloc.xsd" generated="2009-07-07T14:17:49">
    <Corporate_alloc>
    <PKG_CODE>BKCORP</PKG_CODE>
    <PKG_NAME>Corporate Edition - Books</PKG_NAME>
    <DET_CODE>B9780080543758</DET_CODE>
    <DET_NAME>Waves, Tides and Shallow-Water Processes</DET_NAME>
    <ALLOCATION_RATIO>0.000041</ALLOCATION_RATIO>
    </Corporate_alloc>
    <Corporate_alloc>
    <PKG_CODE>BKCORP</PKG_CODE>
    <PKG_NAME>Corporate Edition - Books</PKG_NAME>
    <DET_CODE>B9780080534343</DET_CODE>
    <DET_NAME>Hydrostatically Loaded Structures</DET_NAME>
    <ALLOCATION_RATIO>0.000127</ALLOCATION_RATIO>
    </Corporate_alloc>
    </dataroot>
    CREATE TABLE TEST_XML
    ( PKG_CODE VARCHAR2(50),
    PKG_NAME VARCHAR2(100),
    DET_CODE VARCHAR2(20),
    DET_NAME VARCHAR2(500),
    ALLOCATION_RATIO NUMBER )
    Thanks
    EBV

    In regards to #3, use the COLUMNS functionality of XMLTable instead of using Extract. Two simple examples are
    Re: XML Data - Caliculate fields
    Re: Extractvalue function not recognised

  • Writing local files from applet

    Hi, I want to write an image file from an applet (appletviewer) to the local file system. Does anyone have any idea how I can do it? I tried using the FilePermission class but failed in doing so.
    Thanx for any help in advance

    I need to do this too.
    Specifically I need to allow the user of an applet to write (text) files to his own local file system.
    The applet displays graphical material to the user and I want the user to be able to type in comments to a text box which are then recorded by the applet - and ideally can be retrieved and used by the applet on subsequent occasions - as well as, of course, being available to the user via other programs.
    Presumably I need to use a signed applet.
    I want this to be as simple as possible so that the user (who will be unsophisticated) can be on Mac, Windows, Unix, Linux etc.
    Anyone know a good reference text or tutorial?
    (I am currently working with JAVA 2 fourth ed by Herbert Schildt)
    HRT

  • How to read a local file using as3 in a flash object in HTML? [urgent]

    My web site contains a flash object.
    I want to use as3 to read some local .txt file
    by getting the user directory of the file.
    i know AIR can support this by sth like:
    File.desktopDirectory.resolvePath
    but when i open a AIR file for this, it seems
    the action cant be run when i embed it in html.
    And i tried to use the above function in a normal
    flash file in the action script.
    But it cant recognize the File. class..
    How can it be done ?
    It's reli urgent,
    please help...
    Thanks !

    a web based flash app can't detect user directories.  you can use the filereference class'es browse method to let the user locate a file in any directory the user wants.  flash can then retrieve the file's name and type.  but, as mentioned before,  flash can't determine the file's directory.

  • How to read a PDF file from server

    Hi All,
    I am strucked while creating new file instance .
    Here i know the URL.
    How to create the File instance by using this URL.
    I tried the following way:
    URI uri = url.toURI();
    File f = new File(uri);
    Here i got the following exception :
    <code>
    Exception in thread "main" java.lang.IllegalArgumentException: URI scheme is not "file"
    </code>
    Can any one help me?
    Thanks in advance......

    Can any one help me how can i down load a file
    from server by using URL?RTFAPI. Url.openStream().

  • How to print a local file from jsp

    Hi,
    I want to print a local file(eg. .doc,.pdf) from a jsp.
    Please help me with any answer or any example code
    Thanks in advance
    Regards,
    Sanjeev

    Try this:
    index1.jsp:
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <Link rel='alternate' media='print' href=null>
    <script Language=JavaScript>
    function setPrintPage(prnThis){
    prnDoc = document.getElementsByTagName('Link');
    prnDoc[0].setAttribute('href', prnThis);
    window.print();
    </script>
    </head>
    <body >
    <a href="#" onclick="setPrintPage('index.jsp');"> Click to Print </a>
    </html>This will print index.jsp without opening it in browser. Hope this helps!

Maybe you are looking for

  • Quantity is not getting conformed in sales order

    HI SD Gurus, i have one issue we are not able to solve i need your help, it is very urgent, My issue:we created sales order but quantity was not getting conformed is sales order even though we have enough stock but it was consumed the stock in MD04,

  • Not working imessage!! I can not send imessage than after apple id. There are problems with Apple ?? Thanks!

    Not working imessage!! Credit card and I can not send imessage than after apple id. There are problems with Apple seeverele?? Thanks! Before the service reset function. Wait 24 hours to activate imessage.

  • Speed grade CS6 crashes every time I try to open it

    I looked up my Speed Grade CS6 and it stated it worked with OS6.8 and OS7. Well, mine will not open, it crashes every time i try to open it.  I have and older Mac Pro 1.1 and can back door it and different processor but am I wasting my time and money

  • Xorg hang after update, HELP

    Hi, after a massive update now cant login to X, the logs, here (EE) HID 1267:0103: failed to initialize for relative axes. (**) HID 1267:0103: (accel) keeping acceleration scheme 1 (**) HID 1267:0103: (accel) acceleration profile 0 (II) HID 1267:0103

  • Where can I get a replacement TBD power & thunderbolt combo cable?

    I noticed that the plastic "casing" at the TB connector end of the cable is broken and you can actually see the bare cable inside -- I want to have a new/backup one just in case this one bugs out -- I need a replacement power + TB built-in cable, as