How can an applet access a file ??

I have written an applet in Netbeans and it is working ok.. Now I need to embed this applet in an html file. I have used the following code for doing so :
<Html>
<Head>
<Title>Java Example</Title>
</Head>
<Body>
This is my page<br>
Below you see an applet<br>
<br>
<Applet Code="MyApplet.class" width=200 Height=100>
</Applet>
</Body>
</Html>Now when i run the html file.. the applet does not run. It gives an error called Applet notinited.
Java console contains this :
java.security.AccessControlException: access denied (java.io.FilePermission C:\postplotter.txt read)
     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.checkRead(Unknown Source)
     at java.io.FileInputStream.<init>(Unknown Source)
     at java.io.FileInputStream.<init>(Unknown Source)
     at java.io.FileReader.<init>(Unknown Source)
     at finalpkg.trial.init(trial.java:54)
     at sun.applet.AppletPanel.run(Unknown Source)
     at java.lang.Thread.run(Unknown Source)Please help. I think the problem is because the applet needs to access this file called C://postplotter.txt
Edited by: sauvikc on Jul 25, 2008 7:33 AM

I wrote the applet in Netbeans and its working fine when I run it.
Now I need to run this applet on a different laptop, which does not have NetBeans. It has C://postplotter.txt with the necessary data.
I am using FileReader to read the .txt file :
try {                                           // Extracting parameters from the .txt file.
            String url = "C://postplotter.txt";
            FileReader input = new FileReader(url);
            BufferedReader bufread = new BufferedReader(input);
            String[] line  = new String[15];
            for (int i=0; i<15; i++) {
                line[i] = bufread.readLine();
                System.out.println(line);
Please let me know how to go about doing this. (Opening the applet on the laptop).
I would like to be able to write an html file which has the applet embedded in it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • System memory show 0KB available. Finder will not open. How can I get access to files in order to delete them without using finder?

    My friend is running OS X Yosemite. Her kid used up all the memory on minecraft/word of warcraft files. Now no app will open including Finder to even access files for deletion. Is there a way to access any apps/files to clear space without using finder?

    Step 1   
    The first step is to secure the data. If you want to preserve the contents of the startup drive, and you don't already have at least one current backup, you must try to back up now, before you do anything else. It may or may not be possible. If you don't care about the data that has changed since the last backup, you can skip this step.
    There are several ways to back up a Mac that is not fully functional. You need an external hard drive to hold the backup data.
    a. Start up from the Recovery partition, or from a local Time Machine backup volume (option key at startup.) When the OS X Utilities screen appears, launch Disk Utility and follow the instructions in this support article, under “Instructions for backing up to an external hard disk via Disk Utility.” The article refers to starting up from a DVD, but the procedure in Recovery mode is the same. You don't need a DVD if you're running OS X 10.7 or later. 
    b. If Step 1a fails because of disk errors, and no other Mac is available, then you may be able to salvage some of your files by copying them in the Finder. If you already have an external drive with OS X installed, start up from it. Otherwise, if you have Internet access, follow the instructions on this page to prepare the external drive and install OS X on it. You'll use the Recovery installer, rather than downloading it from the App Store.
    c. If you have access to a working Mac, and both it and the non-working Mac have FireWire or Thunderbolt ports, start the non-working Mac in target disk mode. Use the working Mac to copy the data to another drive. This technique won't work with USB, Ethernet, Wi-Fi, or Bluetooth.
    d. If the internal drive of the non-working Mac is user-replaceable, remove it and mount it in an external enclosure or drive dock. Use another Mac to copy the data.
    Step 2
    You might be able to run in safe mode even though you can't run normally. Otherwise, start up from an external drive, or else use the technique in Step 1b, 1c, or 1d to mount the internal drive and delete some files. According to Apple documentation, you need at least 9 GB of available space on the startup volume (as shown in the Finder Info window) for normal operation.

  • Hey guys, how can i password protect my files in external hard drive? I want to access those files both from mac and windows PC!

    Hey guys, how can i password protect my files in external hard drive? I want to access those files both from mac and windows PC!

    If you want a cross-platform solution that doesn't require the use of third-party software, use an external drive with hardware encryption. The device will have either a physical key or a numeric keypad. I don't have a specific recommendation.

  • How can my laptop access the downloaded files like mp3 and pdf documents which are in my iphone 4G?

    how can my laptop access the downloaded files like mp3 and pdf documents which are in my iphone?

    Yes you will need to NAT at some point to go from private to public address space. Here is a basic configuration if you are interested:
    interface F8
    ip nat inside
    interface G0
    ip nat outside
    ip access-list standard NAT
     permit 192.168.11.0 0.0.0.255
    ip nat inside source list NAT interface G0 overload

  • How can I open and edit files that were developed and published by ftp to my host on my old macbook, which I can no longer access.

    How can I open and edit files that were developed and published via ftp to my host on my old macbook, which I can no longer access. The HD containing the files cannot be accessed. I want to be able to download the published files to be edited in iweb?

    You CAN'T download published files and then edit them in iWeb because iWeb can't open them - it has no import facility so is unable to open any html or css files - a previously published site.
    You can download these files yes, but you'll need to use them as a guide or to cut and paste text from there whilst you re-build your site in iWeb.
    The only other way is to download the files and then open them with an html editor such as TextWrangler or use one of the other web design programmes out there that is capable of importing html and css such as Dreamweaver of Flux 4.
    These are your only alternatives as iWeb can't import and if you want to continue to use iWeb, then you'll have to re-build your site from scratch.  If you do just remember to back up your domain.sites file this time around - it is found under your User/Library/Applicaion Support/iWeb/domain.sites.

  • When i try to access iwork on iCloud on my mac, i get an ipage logo with 2 options learn/get image. I already have ipage on my mac. How can i get to the file  management page?

    When i try to access iwork on iCloud on my mac, i get an ipage logo with 2 options learn/get image. I already have ipage on my mac. How can i get to the file  management page?

    Lion will only let you add documents to iCloud through iCloud.com, iCloud.com requires the iOS apps before you can use it.
    Mountain Lion will let you add documents to iCloud from the iWork apps themselves, you don't then need the iOS apps before they can be opened on another Mac.

  • How can I upload a (image) file through an applet ?

    How can I upload a (image) file through an applet ?

    have a look at http://www.haller-systemservice.net/jupload/
    i'm using Apache Jakarta HTTPClient to create a new HTTP connection to the webserver and sending a new POST request, which holds the image file. (So it's RFC1867 conform)
    there is also an open source implementation of such an applet on sourceforge. it's also called JUpload, but i think it's not maintained any more.

  • How can I print to a file? Msg: "Could not open the file, access denied"

    How can I print to a file? Printing itself works fine, but I get this error message when I select the "print to file" box.

    Hi gag5212, the "Print pages to PDF" extension does not use the normal print dialog. Instead, right-click the page and look for its menu there, or you can add its button to one of your toolbars.
    I'm surprised by your results with the other sites.
    The http://www.primopdf.com/ page layout is completely whacky. The product was acquired by the NitroPDF people, but what is going on here? Probably best to ignore that one for now.
    On http://www.pdfforge.org/ you should get something like the attached on the download page. I'm alarmed to hear you got something strange. Do you have any extensions that you don't recognize? You might be infected with something that redirects your downloads in some way. Although Norton is generally a solid product, you should consider some supplemental scans. This article lists tools that other Firefox users have found helpful: [[Troubleshoot Firefox issues caused by malware]]

  • How can I save adobe reader file from gmail into my adobe reader app?? i would like to open one file in place where I'm not able to access internet and for that reason i would like to save it. is that even possible?

    How can i save adobe reader file from my gmail into my adobe reader application. or is there any other way i can save it into my phone so I'm able to open in any situation not just from my gmail???

    Long hold on the document in mail and it should give you the open in... option, select adobe reader and the file is now saved locally for viewing even while offline.

  • How can a MDB access filesystem?

    Hi,everyone. Should you help me resolve this problem?
    <b>--How can a MDB access filesystem?</b>
    SOURCE CODE:
    public void onMessage(javax.jms.Message aMessage) {
    try{
    FileOutputStream fos = new FileOutputStream(new File("D:\\Temp\\a.nok"));
    fos.write("testing".getBytes() );
    fos.flush();
    fos.close();
    }catch(Exception e){
    e.printStackTrace();
    RESPONSE:
    java.security.AccessControlException: access denied (java.io.FilePermission D:\Temp\a.nok write)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
    at java.security.AccessController.checkPermission(AccessController.java:401)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
    at java.lang.SecurityManager.checkWrite(SecurityManager.java:975)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:169)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
    at neu.mid.mag.mlm.MsgMonitorBean.onMessage(MsgMonitorBean.java:51)
    at com.sun.ejb.containers.MessageBeanContainer.onMessage(MessageBeanContainer.java:653)
    at com.sun.ejb.containers.MessageBeanListenerConcurrent.onMessage(MessageBeanListenerConcurrent.java:20)
    at com.sun.jms.client.SessionImpl.onSessionMessageListener(SessionImpl.java:981)
    at com.sun.jms.client.SessionImpl.deliverMessage(SessionImpl.java:1072)
    at com.sun.jms.client.JMSClientImpl.sendMessage(JMSClientImpl.java:149)
    at org.omg.stub.com.sun.jms.client._JMSClientImpl_Tie._invoke(Unknown Source)
    at com.sun.corba.ee.internal.corba.ServerDelegate.dispatch(ServerDelegate.java:350)
    at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:250)
    at com.sun.corba.ee.internal.iiop.LocalClientRequestImpl.invoke(LocalClientRequestImpl.java:96)
    at com.sun.corba.ee.internal.corba.ClientDelegate.invoke(ClientDelegate.java:227)
    at com.sun.corba.ee.internal.corba.ClientDelegate.invoke(ClientDelegate.java:269)
    at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
    at org.omg.stub.com.sun.jms._JMSClient_Stub.sendMessage(Unknown Source)
    at com.sun.jms.service.ConnectionImpl.sendMessage(ConnectionImpl.java:475)
    at com.sun.jms.service.SessionImpl.processOutgoingMessages(SessionImpl.java:1295)
    at com.sun.jms.service.SessionImpl.access$000(SessionImpl.java:45)
    at com.sun.jms.service.SessionImpl$1.activityDetected(SessionImpl.java:1014)
    at com.sun.jms.util.WorkerThread.run(WorkerThread.java:87)

    Hi,
    Hi,everyone. Should you help me resolve this problem?
    <b>--How can a MDB access filesystem?</b>
    SOURCE CODE:
    public void onMessage(javax.jms.Message aMessage)
    ge) {
    try{
    FileOutputStream fos = new
    m fos = new FileOutputStream(new
    File("D:\\Temp\\a.nok"));
    fos.write("testing".getBytes() );
    fos.flush();
    fos.close();
    }catch(Exception e){
    e.printStackTrace();
    This is fine .......
    RESPONSE:
    java.security.AccessControlException: access denied
    (java.io.FilePermission D:\Temp\a.nok write)
    at
    at
    at
    t
    java.security.AccessControlContext.checkPermission(Acce
    sControlContext.java:270)
    at
    at
    at
    t
    java.security.AccessController.checkPermission(AccessCo
    troller.java:401)
    at
    at
    at
    t
    java.lang.SecurityManager.checkPermission(SecurityManag
    r.java:542)
    at
    at
    at
    t
    java.lang.SecurityManager.checkWrite(SecurityManager.ja
    a:975)
    at
    at
    at
    t
    java.io.FileOutputStream.<init>(FileOutputStream.java:1
    9)
    at
    at
    at
    t
    java.io.FileOutputStream.<init>(FileOutputStream.java:1
    1)
    at
    at
    at
    t
    neu.mid.mag.mlm.MsgMonitorBean.onMessage(MsgMonitorBean
    java:51)
    at
    at
    at
    t
    com.sun.ejb.containers.MessageBeanContainer.onMessage(M
    ssageBeanContainer.java:653)
    at
    at
    at
    t
    com.sun.ejb.containers.MessageBeanListenerConcurrent.on
    essage(MessageBeanListenerConcurrent.java:20)
    at
    at
    at
    t
    com.sun.jms.client.SessionImpl.onSessionMessageListener
    SessionImpl.java:981)
    at
    at
    at
    t
    com.sun.jms.client.SessionImpl.deliverMessage(SessionIm
    l.java:1072)
    at
    at
    at
    t
    com.sun.jms.client.JMSClientImpl.sendMessage(JMSClientI
    pl.java:149)
    at
    at
    at
    t
    org.omg.stub.com.sun.jms.client._JMSClientImpl_Tie._inv
    ke(Unknown Source)
    at
    at
    at
    t
    com.sun.corba.ee.internal.corba.ServerDelegate.dispatch
    ServerDelegate.java:350)
    at
    at
    at
    t
    com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:250
    at
    at
    at
    t
    com.sun.corba.ee.internal.iiop.LocalClientRequestImpl.i
    voke(LocalClientRequestImpl.java:96)
    at
    at
    at
    t
    com.sun.corba.ee.internal.corba.ClientDelegate.invoke(C
    ientDelegate.java:227)
    at
    at
    at
    t
    com.sun.corba.ee.internal.corba.ClientDelegate.invoke(C
    ientDelegate.java:269)
    at
    at
    at
    t
    org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.ja
    a:457)
    at
    at
    at
    t
    org.omg.stub.com.sun.jms._JMSClient_Stub.sendMessage(Un
    nown Source)
    at
    at
    at
    t
    com.sun.jms.service.ConnectionImpl.sendMessage(Connecti
    nImpl.java:475)
    at
    at
    at
    t
    com.sun.jms.service.SessionImpl.processOutgoingMessages
    SessionImpl.java:1295)
    at
    at
    at
    t
    com.sun.jms.service.SessionImpl.access$000(SessionImpl.
    ava:45)
    at
    at
    at
    t
    com.sun.jms.service.SessionImpl$1.activityDetected(Sess
    onImpl.java:1014)
    at
    at
    at
    t
    com.sun.jms.util.WorkerThread.run(WorkerThread.java:87)
    First of all in the specificaitons it is recommended not to use the i/o with ejb.So you should avoid doing same.
    Now the exception you are getting is due to the SecurityManager at the server side JVM.In order to make it run you have to modify the java.policy file present with in the JAVA_HOME/jre/lib/security.
    With in this file you add the following entry
    permission java.io.FilePermission "D:\\Temp\\a.nok", "read,write";
    For more details you should refer to the concept of the Security Manager which is not loaded by default in java app but in applets and in server side applications it is made for security purposes.
    Regards
    Vicky

  • How can I delete an old file from my library on iTunes

    Occasionally I have to replace PDF manuals with ones that have been updated.  But after I sync the new file the old one remains on my Mac itunes library.  How can I delete the old file?  So far all I do is deselect the old file but it's still there.  Sooner or later there will be more old files then current ones making it hard to manage.
    Thanks in advance.

    You can do this with or without the iPad connected to your Mac.
    Launch iTunes on the Mac. Click on Books under the Library heading. Click on the PDFs. Then click on the PDF that you want to delete in order to select it, and go to Edit>Delete and follow the on screen prompts.
    if you are using iTunes 11 and do not have the sidebar enabled, and wish to do so, go to View>Show sidebar or use the keyboard shortcut OPTION+Command+S.
    If you do not want to enable the sidebar, the library items can be accessed in the button in the upper left corner of the iTunes window.

  • How can I open a cc2014 file in my cs6 version of Indesign ?

    How can I open a cc2014 file in my cs6 version of Indesign ?
    I have several files that has been saved in a cc2014 version and I can't open them in my CS6 version of Indesign.
    I don t have access to anyone who have the cc 2014 version to convert the file.
    How can I do it from my cs6 version?
    THANKS!

    You can't do it from CS6.
    You have to export to IDML from InDesign CC2014 (or whatever the version it was created in) and then open the IDML in the earlier versoin of InDesign.
    All explained in the FAQ on the main forum page.

  • How can I regain access to a MAC account? -- Macbook Pro?

    Situation:  My wife has a 13" Mac Book Pro, that we received in May 2011.
    OS: Mac OS X Snow Leopard (not sure which version it came with -- 10.6?)
    My wife's computer had two administrative accounts.  She uses one regularly, and the other is the 'primary' account for downloading updates and such.
    She was unable to figure out how to use Time Machine or any of the other backup software and the like.
    Yesterday, she updated to OS X Lion, and found that a number of the programs that she enjoys using no longer function.
    She wanted to roll-back to Snow Leopard.  After transferring the majority of the 'must-save' files, she put in the install disk again for snow leopard.  This allowed her to start fresh, however, she wants to regain access to those old accounts.  She tried, but, none of the passwords work anymore.  We know what the passwords are; but, they are not working.
    Our ATTEMPTED solution:  She found a site "http://en.kioskea.net/forum/affich-7339…  This site told her to do something in the boot terminal that allowed her to add a new administrative account.
    She tried going into that new admin account and changing the passwords to the other accounts; no joy.  She changes them, but, they are not retained when she logs off or restarts.
    How can she regain access to her old files?

    Open itunes.  Sign into your account.

  • How can I restrict access to add. internal hard drive by account?

    Hello! Okay, so I am my computer's administrator, and I have a secondary 'guest' account that anyone else can use. So, I know that all my data on my main, OS hard drive is secure from the guest account accessing it, but what about the additional hard drive that I have installed?
    I have a good deal of sensitive data and files stored (and aliased) on my second internal drive that I do not care for 'guest' users to stumble upon. How can I restrict access to the secondary storage hard drive from my Guest login account, and/or just plain hide it from it? Surely, there is a need for this that has brought about a solution. Any tips/advice/solutions?
    Thanks!!!
    =)

    Click here and follow the instructions followed by placing the folders and files on the image; if the password is in the keychain, it will be supplied whenever you're logged in.
    (41018)

  • How can i password protect some files and web sites?

    How can I possword protect some files and web sites on my mac air so others using my laptop can't access them?

    Set a password for your user; create other user accounts for when other people want to use it. You can create a "guest" login which gets wiped after every logout, if that's more appropriate for them.
    Matt

Maybe you are looking for