Works as an application but not an applet

I have a swing program that works perftectly fine if ran from the command prompt as an application, but once it is run as an applet through a browser some parts are not working. i have narrowed it down to the following lines of code that are the culprits through troubleshooting:
public static void writeServers(LinkedList serverList) {
     String filename = "C:/jdk/TS2/serverlist.dat";
     try {
          FileOutputStream fout = new FileOutputStream(filename);
     catch(IOException e) {}          
Apparently it doesn't want to create the FileOutputStream, even though this works fine if the program is run as an application. Does anyone know why this isn't working as an applet but works fine as an application?

Ok, here is what I've got:
public static void writeConfig(Config configuration, ClassLoader cl) {
String filename = (cl.getResource("configuration.dat")).toString();
filename = filename.substring(6);
try {
FileOutputStream fout = new FileOutputStream(filename);
ObjectOutputStream oout = new ObjectOutputStream(fout);
oout.writeObject(configuration);
oout.close();
catch(IOException e) { }
And both this file and the configuration.dat are in a jar file that is signed, however it will still not write the configuration.dat file. It will read it with no problem. But no writing.

Similar Messages

  • Why would code work for an application but not an applet?

    Hey there,
    i'm trying to build a java ftp upload applet. I'm using the enterprisedt ftp class.
    The code works fine when i run it as an application but not when i put it in the applet. The applet has been signed and is running off a plug in. I get no error messages, just nothing happens.
    Would really appreciate some comments.
    regards
    hagen
    the code
    FTPClient ftp = new FTPClient("****");
    ftp.login("user1", "***");
    ftp.put("C:/INSTALL.log","test.log");

    hi
    im a manuel, from argentina
    i would appreciate too much if you can give me that piece of code
    i need for a site, an applet that could read files the visitor chosse from his pc and then upload that files to a server
    is it possible?? you could help me ?
    i think i need to sing my applet alright? how i do this? how it cost??
    if anyone can give my a bit of code, to star�t programming, ill be very happy!
    thanks!
    mi mail: [email protected]

  • NewDataAvailable works on Desktop Application, but not in it's Applet port

    Hello everyone.
    I'm getting lost in trying to adapt an application i wrote using swings to an applet.
    I followed the basics, changed extends JFrame to JApplet, removed main and replaced it with init() and everything, and the applet does display.
    Sadly though, i've been having a hard time trying to have the applet update it's graphic as the data behind it changes.
    Basically, in the desktop version, i have a DefaultTableModel, a JTable (vector of vectors rows, vector columns). Each time i call my own method createVector(string a); a new vector is added to rows (the vector of vector of the jtable) and afterward a
    model.newRowsAdded(new TableModelEvent (table.getModel(), table.getRowCount()-1, table.getRowCount()-1, TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
    is also called (model being an instance of the DefaultTableModel object).
    This doesn't work with the applet version though, and i'm totally lost trying to understand why and how to fix it.
    Thanks everyone,
    Rob

    The console doesn't always provide info i guess, at the moment for example i fixed the issue of the thread topic, but i'm having a hard time opening a stream from a url defined like
    URL url = new URL("file", "\\\\10.170.35.34\\my_dir\\", "my_file.txt");
    InputStream fs = url.openStream();
    which works on the desktop version, but not in the applet one, whilst not throwing any exception in the console.
    EDIT: the thread title issue is me being ignorant about applets, and the differences between the class constructor, the run(), start() and init() methods. Having placed that call in the right method, it now works again.

  • Error 1097 - function works in C++ application, but not in LabView

    Good afternoon,
    I have a C++ OpenCV application that I am trying to port to LabView for a co-worker. The application is fully functional when it's compiled standalone as an .exe. When called from LabView it reports error 1097.
    However, this error is not being caused by not allocating momeory space or the way I am calling the DLL, because I can successfully run the DLL from LabView if I omit one function "findContours(..)" from being called inside my rotuine. Meaning that without this function I can send and receive an Image to my DLL and display it in LabView without a problem. This function is not being called directly from LabView either, it's called inside the main function that is being called by LabView.
    That being said, the function allocates memory on its own for it's internal calculation purposes, I do not know what they are, but I know it works perfectly well in a standalone C++ application. 
    My DLL application consistenly uses 180Mb of memory without any leaks
    My Question is:
    Is it possible that LabView or windows may be preventing the DLL from allocating enough memory (I have 12Gb total)?
    Is it possible to run the DLL as a separate application or in a different configuration that would prevent error 1097 from occuring?
    How could LabView possibly be restricting the DLL?
    Thanks,

    error 1097 means that the function somewhere and somehow overwrote memory areas that LabVIEW monitors as its own during the call. This could be memory buffer function parameters  that are unallocated or to small or stack variables or some other memory areas LabVIEW puts in place around the DLL call when the highest debugging level is selected for the Call Library Node. But lowering the debugging level is not the solution as the function certainly does something that it should not do.
    What that could be is impossible to say without analyzing the actual C source code of the function and possibly all the other functions involved in this as well as all the Call Library Nodes. It could even be that its something that is not even directly evident from the C source code but an effect of some (falsely invoked) optimization from the used C compiler.
    I assume that you have actually a self written wrapper DLL here and that is where I would focus on in my search. It is quite unlikely that the OpenCV source code itself would still contain such errors after that much of time.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • GetDeviceList() works in an Application, but not in an Applet.

    When running in a local application, getDeviceList() successfully returns 1 capture device, that's all good.
    However, when running in a self-signed applet on the same computer, getDeviceList() returns NULL; it cannot find any devices.
    Does the applet need to access the JMFRegistry in order to see the list of capture devices? But this doesn't make sense either, because how would you ever deploy remote JMF applets without forcing the client to install JMF and run JMFRegistry? It just seems to defeat the whole purpose of deploying applets. The client should not have to install JMF and change the JMFRegistry settings in order to run an applet; she might as well just download the application!
    Why doesn't getDeviceList() work in a self-signed applet?
    Any help would be greatly appreciated. Thanks!

    Ok, here is what I've got:
    public static void writeConfig(Config configuration, ClassLoader cl) {
    String filename = (cl.getResource("configuration.dat")).toString();
    filename = filename.substring(6);
    try {
    FileOutputStream fout = new FileOutputStream(filename);
    ObjectOutputStream oout = new ObjectOutputStream(fout);
    oout.writeObject(configuration);
    oout.close();
    catch(IOException e) { }
    And both this file and the configuration.dat are in a jar file that is signed, however it will still not write the configuration.dat file. It will read it with no problem. But no writing.

  • My applet works in the appletviewer but not in the navigator

    My applet works in the appletviewer but not in the navigator
    exceptions problem1 and problem2 are throwed
    this is my code
    import java.applet.*;
    import java.net.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ValiderHtml extends Applet implements ActionListener {
    JButton send =new JButton("Connexion");
    JScrollPane jscrollpane= new JScrollPane();
    DefaultListModel lignes=new DefaultListModel();
    JList lstURL = new JList(lignes);
    BufferedReader reader = null;
    String ligne;
    URL url;
    URLConnection conn;
       public void init(){   
       this.setSize(900,400);
       setLayout( new GridLayout(2,1));
       jscrollpane.setBounds(new Rectangle(19,53,160,73));
       jscrollpane.getViewport().add(lstURL,null);
       send.addActionListener(this);
            this.add(send);
       this.add(jscrollpane);
        public void actionPerformed(ActionEvent evt) {
             Send();
       public void Send(){
            try {
       url=new URL("http://www.developpez.com");
       conn = url.openConnection();
       reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    while ((ligne = reader.readLine()) != null) {
                     lignes.addElement(ligne);
        }//fin bloc try
       catch (Exception e) {
                   lignes.addElement("probleme1");     
                finally{
                   try{reader.close();}catch(Exception e){ lignes.addElement("probleme2");}
       }// fin Send
          public void paint(Graphics g) {
                super.paint(g);
    }// fin Applet

    As for tracking the source of your problem your applet sucks.
    Try e.printStackTrace() on a cought exception and check the (full) trace.
    url=new URL("http://www.developpez.com");
    Unless yor applet is on www.developpez.com this will throw an exception in an unsigned
    applet without special policies.
    Signing applets:
    http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
    second post and last post for the java class file
    http://forum.java.sun.com/thread.jsp?forum=63&thread=409341
    4th post explaining how to set up your own policy with your own keystore

  • Applets work under older compilers, but not newest

    The applets I compile using the latest release of javac (with the JDK 1.4 package) work in the appletviewer but not in IE 6.0. However, if I use an older version of javac from a couple years ago (not sure the version), the applets work in IE suddenly. Is there something I need to install in IE to make it compatible with the Sun 1.4 javac compiler? Should I just reinstall the JRE? Has anyone heard of this before? Thanks!!

    You could try installing the Java 1.4 plugin.
    http://java.sun.com/getjava/

  • How do I troubleshoot installation/distribution of a LabVIEW .exe which processes data using Matlab when it works on some computers but not others?

    I've been given the unenviable task of troubleshooting and installing/distributing software written by a former co-worker. I've modified the LabVIEW code and built an .exe file. I've successfully installed the Labview .exe file on several computers, but it won't work on some others. What's more baffling is that I installed it successfully on one computer, uninstalled it, and tried reinstalling it with no success. In fact, it's a new error (Dr. Watson for Windows NT application error). It doesn't help that I have different versions of LabVIEW and Matlab on the target computers. Some have LabVIEW 5.1, some
    have 5.0, and some don't have it at all. Some have Matlab 5.2, some have 5.3 (R11) and some have 6.0 (R12). It's also not clear to me where the Matlab m files should be located. I'm not sure if it's a LabVIEW Runtime Engine problem, or if it's a Matlab problem. I've also wondered how LabVIEW and Matlab talk to each other. When LabVIEW calls Matlab, it seems that Matlab is running in the background. In other words, clicking on the Matlab Command Window and typing "whos" or any other command/variable doesn't work.

    Jay del Rosario wrote:
    >
    > How do I troubleshoot installation/distribution of a LabVIEW .exe
    > which processes data using Matlab when it works on some computers but
    > not others?
    Poke around zone.ni.com and
    http://digital.natinst.com/public.nsf/$$Search/ .
    Good luck, Mark

  • On imac 10.6.8 using current version of Aperture.  How can I access the Aperture Library  on my external hard drive that I use with time machine for backup?  I can only access the application but not the library..

    On imac 10.6.8 using current version of Aperture.  How can I access the Aperture Library  on my external hard drive that I use with time machine for backup?  I can only access the application but not the library..

    Go into Time Machine (the program not the bundle on the extrnal disk) and using Time Machine's browser go to the Folder where the library lives. You could look in the library bundle in Time Machine but that won't really tell you much,
    If you want to make sure it truely has backed up your library you will need to restore it and open the restored library with Aperture.
    If all this still has you confused you need to read up on Time Machine in order to get a feel for how it works, for what it is doing and for how to restore files from it.

  • The scroll function on my mousepad is disabled when viewing a pdf file in firefox version 5.0. The scroll works on the pdf, but not on the other tabs. When the pdf is closed, the scroll function returns to normal. Any ideas?!

    The scroll function on my mousepad is disabled when viewing a pdf file in firefox version 5.0. The scroll works on the pdf, but not on the other tabs. When the pdf is closed, the scroll function returns to normal. Any ideas?!

    Hey thanx for the help, it worked like a charm.
    I think firefox changed the application lay out, as I used to be able to choose my PDF opener from the list at " Adobe Acrobat Forms Document' where I could choose Nitro-PDF reader, but it has now moved all the way to the bottom like you suggested to the obvious place of "Portable Document Format" section.
    If someone didn't tell me , I wouldn't have scrolled all the way down to be able to find it... it really should be with all its cousins up the top...
    Cheers again..

  • Did download OS X Mountain Lion and see the features in my applications, but not reflecting in my APPS purchases.

    did download OS X Mountain Lion and see the features in my applications, but not reflecting in my APPS purchases.
    also this takes huge amount of time, almost 10 hours to download, even using 3G Net connection.

    Hi kiwirudy,
    I've had the same problem more than once since I started trying to download my 14 April purchase of OS X Mountain Lion.
    I found a property list called manifest.plist in my ~/Library/Application Support/AppStore folder which had a Boolean property called failed checked. I unchecked it and afterwards I was able to resume my download.
    Here are some steps I've found useful:
    Close the Mac App Store.
    make a copy of the  ~/Library/Application Support/AppStore folder. For some strange reason the Mac App Store likes to just delete it in some circumstances, which will mean that one has to start one's download again from the very beginning.
    Double click on the manifest.plist in one's ~/Library/Application Support/AppStore folder.
    This should open it in Property List Editor.
    Expand all the nodes (holding down the alt key and clicking on the highest collapsed node should do it.
    Find a key called failed of type Boolean and uncheck it.
    Save the manifest.plist and close it.
    Open the Mac App Store.
    The red message "an error has occured" should now be gone and one should be able to resume one's download.
    In the event that the ~/Library/Application Support/AppStore folder gets deleted:
    start the download again (it will start from the beginning), pause it and close the Mac App Store.
    copy your backup copy of the pkg file back to its sub-folder (it's a numbered folder in the ~/Library/Application Support/AppStore folder).
    Open the Mac App Store and resume your download.
    It should continue from where it left off.
    This has worked for me so far. I'm holding my breath. Don't know if I'll still be alive when it's finished.
    Regards
    Nic
    Message was edited by: n c h

  • It works on my Computer, but not in my DVD Player

    I burned a DVD, It works on my Computer, but not in my DVD Player...why?

    still am trying to figure out how to burn at a slower speed, I see no optiond on iDVD.
    You need to create a disk image out of iDVD, then burn. See below.
    Suggest you create a disc image and then burn the DVD. File/Save as Disc Image...
    http://docs.info.apple.com/article.html?path=iDVD/6.0/en/18.html
    http://www.kenstone.net/fcphomepage/image_to_diskstone.html
    This will isolate any encoding/burning issues you may encounter. Once the disc image is created, double-click the .img and burn the virtual disc that should appear on your desktop, using Toast to burn the DVD. Disk Utility to burn the .img file. Usually, you can select a burning speed in Disk Utility.
    There are variations to this process based on which OS X you are using...
    Open Disk Utility (in Utilities folder in Applications folder), click on the virtual disc (maybe the .img) in the left-hand window. Click the Burn icon. A new window should drop down and your SuperDrive tray will open after clicking the Burn icon. Insert a recordable DVD. (Verbatim DVD-R preferred by me.) Click the Close button. Wait. Select a burn speed. If you hold your mouse cursor over the pop-up it says: "Select a slower speed to work around burn failures," so select 4x or slower for best results. Then click the Burn button.
    -->If the virtual disk selection won't allow you to click the Burn icon, use the .img file instead. This may have changed in 10.3.9 and did change in Tiger.
    Also, you can use DVD Player to play the virtual disk to check your iDVD project before burning to DVD. Launch DVD Player. File/Open VIDEO_TS (Open DVD Media... in Player 4.6). Find the VIDEO_TS folder and open that. (The audio folder is for DVD-Audio disks.)
    http://docs.info.apple.com/article.html?artnum=93006

  • Trouble playing .swf - works offline in browser but not online on website

    Hi there,
    I'm having trouble displaying a flash .swf file properly on my website: http://dreamriderproductions.com/fun/game-test/
    When I view the .swf file locally on Chrome, I get a text box to enter my name and I can click Go and keep playing the game. For some reason, when it's up on the website, there's no text box so I can't progress. Can you?
    Background: The game did used to connect to a database, but the upgrade of our website (and relocation of the swf) seems to have broken the database connection. People couldn't progress past the first screen presumable because the information on which city they were in couldn't be submitted to the database. We've got a version of the game with the database connection disabled and so the game should now work - it works locally for me but not on the website!
    Any ideas?
    Thanks
    Sion

    The code you have posted is not the same code as used in:
    <div id="gallery">
    in the link above.
    The reason that the Flash is not displaying in FF is that the portion of the code used by FF was omitted. The code currently used on the page only works in IE.
    I'm no great fan of the IE conditional statements used in the code you posted so I don't blame you for not using it. But you do need to provide something for FF.... the old, out dated method would be to add and <embed> for FF... here's the newer method..
    So either use code you posted above or better yet, get rid of that and replace the current <object> with
    <div id="gallery">
    <object id="FlashID" data="flash/201.swf" type="application/x-shockwave-flash" width="958" height="242">
       <param name="movie" value="flash/201.swf">
       <param name="quality" value="high" />
         <param name="wmode" value="opaque" />
         <param name="swfversion" value="6.0.65.0"/>
    </object>
    </div>
    Give that a try. Will work in both FF and newer IE versions.
    Best wishes,
    Adninjastrator

  • Have Sony reader 505, ADE doesn't recognize when attached to mac OX 10.6.8. works with reader library but not with ADE

    Have Sony reader 505, ADE doesn't recognize when attached to mac OX 10.6.8. works with reader library but not with ADE

    YEAY!
    I just got the solution (that worked for me, anyway) from a Sony support rep. No PC or VMWare needed.
    OK, you've installed Sony eBook Library v3, and Adobe Digital editions, you've set up your acocunts and authorized your computer on both of them, and you've authorized your Reader with the Sony Library application.
    You go to the public library ebook download page, either through the Sony Library or just through a bookmark.
    You check out a book, and open it in Adobe Digital Editions, which still won't recognize your Reader.
    BUT, in the Sony Library app, you can now click "File, Import.." and go find the pdf you downloaded with the Adobe app.
    On my Mac, it was in ~/Documents/Digital Editions
    Import it, and drag it to your Reader.
    The first time you do this, it will ask you to authorize the Reader with your Adobe ID.
    Worked like a charm.

  • Site works in the app, but not in the browser.

    Hello iWeb experts,
    I've got problems.
    Last night I published my site. And while it appears, and functions, properly in my iWeb app, it doesn't do the same in Safari, Firefox, and Internet Explorer.
    Two issues...
    FONTS
    I chose Bellamie, Univers Condensed, and Marydale as my fonts. From reading these forums, I've discovered those won't wysiwyg on other computers if the fonts aren't available and open on them. So my two choices are to make every bit of text a graphic or to use a set of more universal fonts, correct? So my questions are...One, is there a list somewhere of fonts that will work in any browser? And, two, is there a short-cut, or easy way to transform type into a graphic without having to create image files?
    FUNCTIONS
    Here are the functions that work fine in iWeb but have gone haywire in all of the browsers I tested...
    • The type in one nav link appears smaller than all the rest.
    • Some links are active, others are not.
    • Rollover highlighting works on some links, but not others.
    • Most of the rollover links appear in the proper static color, a few do not.
    I've tested these functions on three Macs, one PC, and in the three browsers mentioned above. All of them show the exact same problems. So something must be going wrong with iWebs coding, or my host server musn't like iWeb.
    Any thoughts, suggestions on these two issues? Thanks much for any advice.
    John
    PS - For reference, see: www.johnrunk.com

    Fascinating, Kirk (+he types with one raised eyebrow+).
    QuickTimeKirk wrote:
    When I drag across your page most of your links do not change. The "text" portion of them doesn't change, either. Something is covering them.
    I can see that. But for the life of me, I don't know what could be covering those links. In my app, when I click in the area of the links, the type is the first item selected. Unless, possibly, it could somehow be the faint reflection of my black-and-white image (me & the ground I stand on). Hmmm...
    QuickTimeKirk wrote:
    Single click (outside the boundaries of your page contents) and an "outline" will appear. It shows the image file dimensions and locations.
    This I don't see. An outline? As in "an object outline," or as in "a list of dimensions and locations?" When I click outside my page contents, I get nothing.
    Thanks, QTK. I truly appreciate your troubleshooting here.
    John

Maybe you are looking for

  • Mail not getting all messages from server and other strange behavior

    Hello All, Mail has been doing some odd things for me of late (at least the last week) and I'm lost for a solution to my problem. As far as I can tell, perhaps my Prefs. have become corrupted, or at least something in relation to Mail has become corr

  • How to edit PDF/ebook data?

    I'm not sure if this is the right place to ask this, but is it possible to edit PDF information (author/title/year etc.) within Snow Leopard, or do I require additional software? If so, can anyone recommend a simple application that can do this?

  • Problem in BDC for CA02

    hello all,          i am doing BDC for change routing (ca02) transaction. in that my need is to assign PRT allocation for operations. i have written a program for it but if suppose for a particlular operation i want to assign PRT and if there are no

  • Net requirement in MRP

    Hi I have following scenario In production order of  material  A there is one bought out  material  B with quantity 10 KG. Quantity of material B require can be +/- 5 % in any production order Overdelivery of 5 % allowed from vendor. After MRP, PR is

  • Mandatory/Default field for mrp/forecast profile mrp area

    Dear guru, In MM01/MM02 when i create a new mrp area for a material I want Mrp profile field and forecast profile field as mandatory field. Or as alternative solution purposed with a default. How can I do that ?