Saving with serializing

so im starting java. but i have had some and i mean some work in C++ and Visual Basic (1 year combined in highschool) and before anyone asks yes i am a highschool student. So dont jump on my case, im just trying to learn.
Ok so here's my problem. I need to save text from a JTextArea using serialization.
private class savemenu implements ActionListener{
          @Override
          public void actionPerformed(ActionEvent e) {
               //JFileChooser fileSave = new JFileChooser();
               //fileSave.showSaveDialog(bframe);
               //saveFile(fileSave.getSelectedFile());     
          //private void saveFile(File selectedFile) {
               try {
                    //String file = null;
                    //BufferedWriter writer = new BufferedWriter(new FileWriter(file));
                    //writer.write(text4zone.getText());
                    //writer.close();
                    FileOutputStream fs = new FileOutputStream("LanguageHelper.clemu");
                    ObjectOutputStream os = new ObjectOutputStream(fs);
                    os.writeObject(text4zone.getText());
                    os.close();
               }catch(IOException ex) {
                    System.out.println("Could not write file please try again");
                    ex.printStackTrace();          
     }now don't mind the commented code as i was going to use the save menu but i tried the other way as i know. So what could i do to fix my code and make it "correct" as in making it more streamline.
And this is what happens when i try to save
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
     at CodeLanguage$savemenu.actionPerformed(CodeLanguage.java:58)
     at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
     at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
     at javax.swing.AbstractButton.doClick(Unknown Source)
     at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
     at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
     at java.awt.Component.processMouseEvent(Unknown Source)
     at javax.swing.JComponent.processMouseEvent(Unknown Source)
     at java.awt.Component.processEvent(Unknown Source)
     at java.awt.Container.processEvent(Unknown Source)
     at java.awt.Component.dispatchEventImpl(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Window.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)

But the thing is that i can fill the entire text area and it still output the very same thing. And it does not matter how many letter/number/symbols are in it, it still does it. The only problem being that i can see is that its not reading the text area and is trying to write a blank object. And does any one know what i might be doing wrong, and point me in the right direction.

Similar Messages

  • Opening files with serialized objects even if class definition has changed.

    Dear all,
    We are deploying an application wich saves serialized objects. But when changing something in the code and especially in the serialized classes we are not able to open files which have been saved with the old 'outfit' of the class.
    I think, that this is probably a common problem and therefore I am interested whether there exists also a common or practical solution.
    What is the direction I have to look in? XML, Serializable or is it something else?
    Thanks for a short answer,
    Axel

    If you add, remove or change a classes variables, then it will be serialized differently.
    Any fields which you do not need to be serialized, may be marked as transient, so you can add and remove them at will.
    In the longer term, you can override the readObject() / writeObject() methods and explicitely load/save what fields you want. This will also allow you to set intelligent defaults, if for example, you added a new field, but your old serialised classes do not have this field. You can also precede all serialised data with version numbers... might help a bit.
    So code ( psuedocode ) might look like this...
    private void readObject(java.io.ObjectInputStream in)
         throws IOException, ClassNotFoundException;
        int ver = in.readInt();
         classfield1 = in.readLong();
        if ( ver >= 2 )
            classfield2 = in.readLong();
        if ( ver >= 3 )
             classfield3 = in.readLong();
    }regards,
    Owen

  • Move of material with serial number in MB1B

    Hi
    I discovered something in our system. I wanted to transfer materials with serial numbers from one plant (one stock), into another (another stock) in MB1B. I wrote down the material number and the quantity then a window comes up where I could write the serial number. Or there was also a button saying u201Ccreate new serial numberu201D in this window. If I pressed this button and saved the material document, I was able to move the material in MM with a serial number which does not exist in reality. I look at MMBE and IQ03 to control this. Do you know how to prevent this?
    Thanks in advance,
    Esra

    Hi,
    In the serial number profile in customizing (Logistics Execution/shipping/Basic Functions/Serial numbers), you can set for each profile whether a serial number must first be created through IQ01 or whether a serial may be created in other transactions, like MB1B, VL31N or MIGO etc).
    MdZ

  • To create SD Sales Order with Serial numbers

    Hi Experts,
    I want to create a Sales Order with serial numbers info attached to the items.
    The way, i m following is:
    1. Creating the order with BAPI_SALESORDER_CREATEFORMDAT2 function module and save it.
    2. Then add the serials to the already saved SO.
    3. The delivery document is automatically created through some customizing settings.
    This approach has a problem: After SO being saved, because the delivery document is automatically created through some customizing settings. This means i need update serial numbers in both SO and delivery document as well.
    I'm looking for a way to add the serial numbers to the SO before actually saving it. By this way the serial numbers would be actually added in delivery document too. I think BAPI_SALESORDER_CREATEFROMDAT2 is of no help, in this case.
    Is there any function module?
    Grateful for all suggestions...
    Regards,
    Jeo

    Hi Shiva,
    Thanks for your quick reply.
    I have checked that link which you provided. The link actually tells about how can we add serial no after SO being saved, but i want to add serial nos before SO actually saved.
    The same FM given in the link, i m using and its working fine.
    Can you let me know, how can i add serial nos in SO before saving it?
    Is there any FM exist, that could achieve this? OR How can we achieve this by CALL TRANSACTION, if there is no FM exist for this.
    Regards,
    Jeo

  • I am in the middle of a job using CS 6, but at the same time opening the Creative Suite apps.  I created an InDesign file in CS 6, saved it, and now I can't open it. I'm getting this message: Cannot open file because it was saved with a newer version of A

    I am in the middle of a job using CS 6, but at the same time opening the Creative Suite apps.  I created an InDesign file in CS 6, saved it, and now I can't open it. I'm getting this message: Cannot open file because it was saved with a newer version of Adobe InDesign CC (10.1). You must use that version or later to open the file." AARRGGHH! So how do I access the file?

    Sounds like you opened and saved it in CC, so now you need to go back to CC and either complete the project there, or export to IDML to take it back into CS6.

  • Apple loops not getting saved with current projects tempo

    I can't seem to make an apple loop that would get saved with the current projects tempo....i recorded a single bar midi drum loop with 130 as project tempo but when i save it as an apple loop it gets saved with a tempo of 92bpm. strange thing is when i drag the same loop back on a instrument track it plays at the current tempo i.e., at 130bpm but if i drag it to an audio track it plays at 92bpm... really stuck here....any help would be greatly appreciated..thanx..

    ok now i have got half of the problem solved....i had left the "follow tempo" region parameter ticked....so now when i unticked it the loop follows the project tempo....but i dont understand y does the loops get saved with a tempo of 92 whereas the project tempo is 130bpm....moreover when i audition these loops they don't really LOOP while playin back....

  • Apple loops not getting saved with tempo info

    I can't seem to make an apple loop that would get saved with the current projects tempo....i recorded a single bar midi drum loop with 130 as project tempo but when i save it as an apple loop it gets saved with a tempo of 92bpm. strange thing is when i drag the same loop back on a instrument track it plays at the current tempo i.e., at 130bpm but if i drag it to an audio track it plays at 92bpm... really stuck here....any help would be greatly appreciated..thanx..

    ok now i have got half of the problem solved....i had left the "follow tempo" region parameter ticked....so now when i unticked it the loop follows the project tempo....but i dont understand y does the loops get saved with a tempo of 92 whereas the project tempo is 130bpm....moreover when i audition these loops they don't really LOOP while playin back....

  • CS6 Installation with serial no. that is not working

    need help badly. bought CS6 yesterday through Adobe website and the order was confirmed with serial no. when downloading and filling in the serial no, kept getting a msg saying "we are unable to validate this serial no for adobe illustrator CS6. what shall i do now? thought that if i buy from a genuine company, my life will be easy! paid 771 USD and have been facing nothing but trouble and need this software urgently. Anyone can help PLEASE!

    Hi arwa shanti,
    Please check the host file for any Adobe entries and remove them:
    Location Windows:C:\windows\system32\drivers\etc\host
                   Mac: Go/go to folder/etc/hosts
    Try to validate again.
    If you do not find any entries in host file for Adobe please disable security software from your machine and try to validate again.
    If still the same issue try updating AAM from the mentioned link:
    Win: http://www.adobe.com/support/downloads/detail.jsp?ftpID=4773
    Mac: http://www.adobe.com/support/downloads/detail.jsp?ftpID=4774
    Try installing again.
    Regards,
    Romit Sinha

  • Image Adjustments Not Saved with DNG?

    It appears that the adjustments (i.e. all of the work you do to "develop" your pictures) are not saved with the image file. They appear to be saved in the LR Library. So if anything happens to your library, your developing work is gone. I thought my adjustments were saved with the DNG, but this does not appear to be the case.
    So, to be sure that my work is saved with the image, it appears that the processed files must be saved to a different format like JPG, TIFF, or PSD. With JPG quality is lost, and your ability to edit is severely compromised. With PSD and TIFF, you have another copy of extremely large files to deal with.
    Is my understanding correct?
    What are your suggestions to deal with this?
    Thank you.

    Geoff and John,
    Thank you very much.
    You confirm the critical point that your work is saved in the Library, and the Library must be closely supervised and backed up.
    Beside my on-site backups, I set up a Stuffit schedule to back up a daily version of my library. My current library is 57.6MB and Stuffit compresses it to 8.7MB and automatically FTPs it to my web site for archiving.
    I found that my 2GB file of previews is unnecessary, since my computer creates new previews almost as quickly as it reads the preview file, at least on a folder basis. So, I removed my preview files, and I have them saved for only one day in prefrences.
    For my DNGs, beside my on-site backups, I create a DNG with the RAW (NEF) file embedded and back them up on my web site. Then I create DNGs with Adobe DNG converter, without embedded RAWs (LR embeds the RAWs)to use for my working files.
    One of the reasons I decided to use DNGs is to avoid having separate XMP files. However, it sounds like you can export the XMP to the DNG without creating separate XMPs. I'll look in to that. I assume that exporting the XMPs to the DNGs will allow me to open them directly in CS2 (not by exporting from LR) or other programs with my adjustments intact. This would solve the problem of losing adjustments if the Library becomes dysfunctional.
    Thanks again.
    Eric

  • Good afternoon.I have a computer with W Vista 8, Windows office home and business 2013. I recently tried to install Photoshop Elements by CD with serial number but on the desktop appears the following message: error 1 (configuration problem) try to uninst

    What's error 1 in adobe photoshop elements configuration? I have a computer with W Vista 8, Windows office home and business 2013. I recently tried to install Photoshop Elements by CD with serial number but on the desktop appears the following message: error 1 (configuration problem) try to uninstall and reinstall. I have done this but the message continues to appear

    You haven't mentioned which version of PSE. If it is PSE 13, that requires a minimum of windows 7.

  • I need to use agilent34970A with serial cable;but i'm not able to build a routine.

    Hi, i'm learning labview and i'm not able to build a routine to communicate with my Agilent34970A with serial cable only and to use the data. Anyone can help me? thanks. lucky

    Are you using the driver from the LabVIEW Instrument Driver CD or that you downloaded from here? If you are, what problems are you having? Are there error codes generated and what are they? Have you verified that the serial cable is correct and the the comm parameters (baud rate, stop bits, etc.) are the same in the program and the instrument?

  • I have Adobe Design Standard CS6 purchased 2013 with serial number but cannot find to download it onto a new mac laptop. When I try and add the 24-digit serial number to my account it doesn't seem to work?

    I have Adobe Design Standard CS6 purchased 2013 with serial number but cannot find to download it onto a new mac laptop. When I try and add the 24-digit serial number to my account it doesn't seem to work?

    CS6 - http://helpx.adobe.com/x-productkb/policy-pricing/cs6-product-downloads.html
    You can also download the trial version of the software thru the page linked below and then use your current serial number to activate it.
    Be sure to follow the steps outlined in the Note: Very Important Instructions section on the download pages at this site and have cookies enabled in your browser or else the download will not work properly.
    CS6: http://prodesigntools.com/adobe-cs6-direct-download-links.html

  • Goods Receipt entry for items with serial number

    Hi All,
    When I try to create a Goods receipt entry, for items with serial number, i'm always getting the following error message.
    [OSRI] , 'The selected quantity of serial/batch numbers is greater than the quantity in row Id'
    The following is the code that I'm using
    Dim oInvetoryGenEntry As SAPbobsCOM.Documents
    Dim oSerialNumber As SAPbobsCOM.SerialNumbers
    Dim ErrCode As Long
    Dim ErrMsg As String
    Dim ret As Long
    Set oInvetoryGenEntry = oCmp.GetBusinessObject(oInventoryGenEntry)
    Set oSerialNumber = oInvetoryGenEntry.Lines.SerialNumbers
    oInvetoryGenEntry.DocDate = Now
    oInvetoryGenEntry.DocRate = 1
    oInvetoryGenEntry.TaxDate = Now
    oInvetoryGenEntry.PaymentGroupCode = "3"
    oInvetoryGenEntry.Comments = "GRN Entry11"
    oInvetoryGenEntry.Lines.ItemCode = "A00004"
    oInvetoryGenEntry.Lines.Price = 100
    oInvetoryGenEntry.Lines.Quantity = 1
    oSerialNumber.SystemSerialNumber = 55555
    oSerialNumber.InternalSerialNumber = "2354"
    oSerialNumber.BatchID = "bt1"
    oSerialNumber.Add
    ret = oInvetoryGenEntry.Add
    If ret <> 0 Then
            oCmp.GetLastError ErrCode, ErrMsg
            MsgBox ErrCode & " " & ErrMsg
        Else
            MsgBox "GRN Entry made."
        End If
    It would be wonderful if anyone help me out to trace the exact reason for this issue.
    Thanks
    John

    Hi John I'm almost sure that your working with SDK 6.5 with SP1 or lower, visit this address
    https://www.sdn.sap.com/sdn/collaboration.sdn?node=linkFnode6-1&contenttype=url&content=https://DI: Add more than one serial numbers in Invoice
    Maybe you can find your answer if you can fix it let me Know my email address is [email protected] because i had the same problem.
    Regards

  • Creation of sub item with serial numbers in outbound delivery

    Hi All,
    We need to create a sub item for an Outbound Delivery main item in change mode with serial numbers for sub item.
    Process flow:
    1. Sales order item created with main item
    2. Outbound Delivery created with main item
    3. Outbound Delivery interfaced to external logistics sytem
    4. External logistics system pick the main item and a sub item (packaging) from warehosue and ship to customer
    5. External logistics sytems send delivery pick confirmation interface with main item details and serial numbers for sub item
    Now we have to create a sub item with serial numbers in the delivery referencing the same main item.
    NB: Delivey can have multiple similar main items but there is only material number in SAP for sub item. Hence the requirement to identify relevant sub item serial numbers to each delivery main item.
    Can you kindly tell me in what possible ways we can create sub item with serial numbers for a deliveyr main item in change mode.
    Thanks in advance
    Best  Regards
    Veer

    Hi,
    Does anybody have an answer?
    Thanks in advance.

  • Problem with *serial no. profile* in work sheduling view of material master

    Hi ! !
    I am here with a problem with serial no. profile in work sheduling view of material master.
    By mistake for some FHMI type ( PRODUCTION RESOURCE TOOLS )materials, serial no profile exist in 'work sheduling' view. Due to that we are facing problem in GRN.
    when I am trying to remove that with MM02. i m getting a message as Serial numbers already assigned to this material
    Please suggest how to remove serial no. profile.
    Thanks in advance,
    Prab

    Hi,
    go to MMBE and check the Current Serial number...for  FHMI type
    and go to IQ02 and close the Serial number range at the Current number range...
    Now you can assign this serial number range to another material type...
    Thx
    Raju

Maybe you are looking for

  • How to set  Non Cumulative Init flag for Generic datasource

    Hi all,    I need to create a generic datasource which can be used to initialize the Non Cumulative Cube. Eg. setting the opening balance.    The STOCKUPD field in the ROOSOURCE should be set to X so that the infopackage will have the "Generate Initi

  • Do I have to use iCloud to use Calendar?

    I cannot add entries to my Calendar on my iPhone (the plus is greyed out).  I suspect it is because I have not setup an iCloud account.  Do I have to use iCloud to use the Calendar?  I do not want to use iCloud, I do not want to share my calendar wit

  • InDesign captions

    Hi all, I have a few questions regarding generating captions in InDesign CS5 (Windows). I am designing school leavers books. Most pages are images with captions beneath, which for the past few years I have imported and generated respectively via a sc

  • When will iphone 5 factory unlocked be released ?

    ??????

  • Brand New Imac 20": Kernel error on normal start up.

    I have a Imac G5 with bluetooth keyboard and mouse (just moved from pc to mac) . I took it out of the box and just after it ended the setup it said that had losted connection with the mouse and keyboard and froze, i had to rebot it and since then it