1131:Packages must not be nested

Hai all,
I m working on a Flex Application, in which I have to
communicate with the server through TCP Socket. I am using
XMLSocketClass. I got a code from help, but I am getting
"1131:Packages must not be nested" error whenever I m trying to
compile it. Pls tell me the reason for this error.
==========================================================================
XMLSocketExample.as
==========================================================================
package //ERROR// 1131:Packages must not be Nested
import flash.display.Sprite;
import flash.events.*;
import flash.net.XMLSocket;
public class XMLSocketExample extends Sprite {
private var hostName:String = "localhost";
private var port:uint = 8080;
private var socket:XMLSocket;
public function XMLSocketExample() {
socket = new XMLSocket();
configureListeners(socket);
socket.connect(hostName, port);
public function send(data:Object):void {
socket.send(data);
private function
configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.CLOSE, closeHandler);
dispatcher.addEventListener(Event.CONNECT, connectHandler);
dispatcher.addEventListener(DataEvent.DATA, dataHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR,
ioErrorHandler);
dispatcher.addEventListener(ProgressEvent.PROGRESS,
progressHandler);
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
securityErrorHandler);
private function closeHandler(event:Event):void {
trace("closeHandler: " + event);
private function connectHandler(event:Event):void {
trace("connectHandler: " + event);
private function dataHandler(event:DataEvent):void {
trace("dataHandler: " + event);
private function ioErrorHandler(event:IOErrorEvent):void {
trace("ioErrorHandler: " + event);
private function progressHandler(event:ProgressEvent):void {
trace("progressHandler loaded:" + event.bytesLoaded + "
total: " + event.bytesTotal);
private function
securityErrorHandler(event:SecurityErrorEvent):void {
trace("securityErrorHandler: " + event);
============================================================================
Flex File
============================================================================
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script source="XMLSocketExample.as"/>
<mx:Button x="202" y="140" label="Button" id="sendButton"
name="sendButton" />
<mx:Label x="204" y="110" id="conn_txt"
enabled="true"/>
</mx:Application>

Hi, Thanks for your help. I added the follwoing code in my
Flex Application.
<mx:Script>
<![CDATA[
private var aa:<ClassName> = new <ClassName>();
]]>
</mx:Script>
Thanks. No I am facing one more problem. I can't receive any
reply messages from the server, when I am trying to get some
responses through TCP Socket using XMLSocket Class.
addEventListener(DataEvent.DATA, dataHandler) is not working.. I
have posted the problem in the forum. Can u pls go through that??
Thanks in advance,
Sunil NaIR

Similar Messages

  • Classes must not be nested??

    I created a new Flash file (Actionscript 3) and typed this
    code on the first frame on the movie:
    class TestClass1 extends Object {
    public function identify() {
    trace('i am class one');
    var obj:Object;
    obj = new TestClass1();
    obj.identify();
    I get this error:
    1131: Classes must not be nested.
    What is going on?

    On publish, the compiler creates a class called MainTimeline
    for all of the code in frames. By creating a class in a frame, it
    is being nested inside the MainTimeline class... thus, producing
    the error.

  • [Solved] "source tarball may not contain nested subdirectories"

    Hey guys,
    I'm trying to upload (my first!) package to the AUR, however I'm getting the error "Error - source tarball may not contain nested subdirectories."
    I've created the package using `makepkg --source`, it's just a single PKGBUILD file.
    Running tar tvf looks fine:
    $ tar tvf setcolors-git-0.0.0-1.src.tar.gz
    drwxr-xr-x root/root 0 2013-08-17 08:25 setcolors-git/
    -rw-r--r-- root/root 685 2013-08-17 07:19 setcolors-git/PKGBUILD
    I searched around, but it looks like only a few people had this issue, and it was due to SELinx (which I'm not using).
    I must be missing something really simple and I'm sure I'll feel dumb.
    Here's the tarball in question.
    Last edited by EvanPurkhiser (2013-08-19 01:46:07)

    Ichimonji10 wrote:
    I'm also getting this error. The exact error thrown is:
    Error - source tarball may not contain nested subdirectories.
    I'm trying to submit this PKGBUILD: https://github.com/Ichimonji10/PKGBUILD … ybeans-git
    And here's the contents of my package:
    [ichimonji10@hardhack:tmp]$ ls
    vim-jellybeans-git-v1.5.25.gc173b85-1.src.tar.gz
    [ichimonji10@hardhack:tmp]$ tar tfv vim-jellybeans-git-v1.5.25.gc173b85-1.src.tar.gz
    drwxr-xr-x root/root 0 2013-08-17 11:55 vim-jellybeans-git/
    -rw-r--r-- root/root 1094 2013-08-17 09:08 vim-jellybeans-git/LICENSE.txt
    -rw-r--r-- root/root 1022 2013-08-17 11:39 vim-jellybeans-git/PKGBUILD
    Ahhh I get that too, your tar isn't the problem (I think), like mr. developer said, it's probably PHP5.5 that's the problem, it's the site.
    My theory is that PHP5.5 probably upgraded their parsing stuffs and the site's code just isn't compatible yet.

  • Team package will not deploy

    Hello - I must be missing something simple as I am totally unable to create packages and deploy them to our Creative Cloud for Team members.
    From the reading I have done, the following seems to be correct, but I have had no success.
    Create Package:
    1. Clean install Windows 7 64-bit Sp1 on new hard drive.
    2. Create local administrator on machine named "Builder" and Logon to Builder.
    3. Logon to Creative Cloud as Team administrator, download and install CCP and logon as Team administrator
    4. Cache preference set to default C:\Users\Builder\AppData\Local\Adobe\CCP\
    5. Package details set to: name=Image; Save=C:\Users\Builder\Downloads\AdobeCloud; Named Licensing; 32-bit
    6. Package configurations set to: Disable desktop app; ignore conflicts; disable update mgr; enable remote update; deploy to default directory
    7. Select English (North America), Select Apps: Dreamweaver, Fireworks, Acrobat, Flash, Illustrator, InDesign, Photoshop
    8. Packager starts at 7:25pm and completes with no error messages at 9:15pm (roughly 2hrs).
    9. Image folder is about 5GB in size; Copy image folder to the \\NAS\ClientApps\Adobe folder on a network attached storage device.
    Deploy Package:
    1. Clean install Windows 7 64-bit Sp1 on new hard drive.
    2. Create local administrator on machine named "Builder" and Logon.
    3. Run a cmd session as administrator; map \\NAS\ClientApps to Z: drive, change directory to Z:\Adobe\Image\Exceptions
    4. From cmd line execute ExceptionDeployer --workflow=install --mode=pre; completed without error displayed
    5. Verified Adobe Acrobat XI Pro installed using control panel uninstall/change program
    6. From windows explorer, navigate to \\NAS\ClientApps\Adobe\Image\Build and Run setup.exe as administrator
    7. Progress bar gets just past half way, rolls back to no progress, and setup exits without error displayed
    8. Verified no additional Adobe apps are installed.
    9. Trying to run Acrobat causes an error message requesting an uninstall and reinstall Acrobat.
    Any help would be much appreciated, as I am sure it is something simple I have overlooked.
    Thank you,
    Keith

    Hi
    EllenWeldonDesignLLC,
    Deploying CCP package does not require installation of any other software. I have your log file and 1603 is the error what I see. 1603 is a generic error which is computer specific. Please go through the mentioned kb: http://helpx.adobe.com/creative-suite/kb/error-1603-install-cs3-cs4.html and try the steps and try to install again. Please do not run the msi but instead try to run the setup within the build folder as run as admin and let me know whether it worked. If still it rolls back enable hidden admin: http://www.howtogeek.com/howto/windows-vista/enable-the-hidden-administrator-account-on-wi ndows-vista/ and try installing again. Please let me know whether it worked.
    Regards,
    Romit Sinha

  • Can't download itunes - "this installation package could not be opened.....

    please help!!. I cannot download the itunes 7.4.2 (?) i get the error
    "this installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid windows installer package."
    I am so frustrated. I tried everything and cannot download the new itunes. I got the new nano video and can't even use it!

    no, I never have resolved it. I spent 1 1/2 hrs on the phone with apple and couldn't figure it out. they finally said it must be something with my windows installer - but I have no problem downloading/installing any other programs.
    go figure.

  • The following import prerequisites of OCS Package " " have not been met

    Hi SAP gurus,
             Am in upgrading ECC 6.0 to EHP4. in th configuration Phase am facing this erro:
    " Severe error(s) occured in phase PREP_EXTENSION/SUBMOD_EXTENSION_NEW/EHP_INCLUSION!
    Last error code set: unable to generate package queue, return code =3, reason=package SAPKNA7019: import prerequisites are not fulfilled".
    The log says,
    3 ETN431    Calculate the queue part for "SAP_AP" rel."700" with target SP "SAPKNA7021" (level "0021")
    3 ETN245 The following import prerequisites of OCS Package "SAPKNA7019" have not been met:
    3 ETN264   In the (alternatively) Requirement set "01":
    3 ETN246    Support Package "SAPKNA7018" must be available or already imported in the system
    2WETN423 Package "SAPKNA7019": Import prerequisites are not fulfilled
    3 ETN245 The following import prerequisites of OCS Package " " have not been met:
    3 ETN246    Support Package "SAPKNA7018" must be available or already imported in the system
    the existing patch level of SAP_AP is 015. so i planned to update the patches manually using SPAM. but its throwing this error:
    Caution: Upgrade or PREPARE is still r
    import not permitted
    even i tried stopping the upgrade.
    What should i do now? without satisfying the pre-requisite i can't able to continue my upgradation. Please help me guys...
    Thnaks in advance,
    Santhosh Kumar.

    Procedure for UNIX and Windows:
    1. Change to the EHPI/abap/bin directory (Windows: EHPI\abap\bin)
    2. Enter the following command:
    ./SAPehpi reset prepare (Windows: .\SAPehpi. exe reset prepare)
    3. Delete the EHPI directory
    4. Start SAPehpi again (Install and run)
    Once the reset is done properly then u can start patching
    Nirmal.K

  • FTPClient Package does not exist?

    I have an FTP program. I'm trying to use this package. Here is a link to the class package overview:
    http://www.enterprisedt.com/downloads/ftp/doc/com/enterprisedt/net/ftp/FTPClient.html
    When I attempt to compile, I get the error that the package does not exist. I am importing these packages:
    import java.lang.Object.*;
    import java.lang.*;
    // This package causes the error
    import com.enterprisedt.net.ftp.FTPClient.*;
    Is there something I need to download, or some other package to import?
    Thanks,
    Logan

    Hi,
    I finally found the ftp.jar and downloaded it and put it in the /j2se/jre/lib/ext.
    I can now compile with this import line:
    import com.enterprisedt.net.ftp.*;
    Now my problem is trying to get this to work:
    String server = "192.168.1.100";
    String user = "logan";
    String passwd = "passwd";
    try {
    FTPClient ftp = new FTPClient(server);
    } catch (IOException ex) {
    System.out.println("Caught exception: "+ex.getMessage());
    But I get this error when compiling:
    unreported exception blah blah must be caught or declared to be thrown
    Thanks.
    - Logan

  • [Java 7] Zip file system does not handle nested zip files

    The ZIP FileSystem which is shipped as an extension with Java7 does not support nested ZIP files. I.e., you can open the outer zip file as a FileSystem, but if you try to open an inner zip as a FileSystem, you get this exception:
    java.nio.file.ProviderNotFoundException: Provider not found
         at java.nio.file.FileSystems.newFileSystem(FileSystems.java:403)Since the ZIP FileSystem is an extension, and not a part of the core JDK, I'm posting this here (and on Xueming's blog) in the hope that it will get resolved. It doesn't seem right to report it as a JDK bug.

    872883 wrote:
    The zip file system definitely allows zip entries to be read without extracting them first. And--based on reviewing the ZipFS source code that Oracle has included with the JDK--it doesn't appear to be silently extracting the data to a temporary file.you missed the point of what Peter Lawrey said. in order to create a ZipFS on a zip file, it must be a file in the first place (i.e. have random access). there is no way to do random access on an entry within an existing zip file, therefore in order to create a ZipFS on a nested zip file, you would first have to extract it to a file.

  • Error - The version number in the package is not valid. The version number cannot be greater than current version number

    whats does this error mean
    i download 2008 r2 and try to open package but still getting error
    Error 1
    Error loading  The version number in the package is not valid. The version number cannot be greater than current version number.  
    Error 2
    Error loading Package migration from version 8 to version 3 failed with error 0xC001700A "The version number in the package is not valid. The version number cannot be greater than current version number.".  

    can you tell me which version it is >
    i try to fix in dtexec
    getting following error :
    Started:  2:02:13 PM
    Error: 2015-01-30 14:02:14.68
       Code: 0xC000F427
       Source: Member Eligibility
       Description: To run a SSIS package outside of SQL Server Data Tools you must
    install Member Eligibility of Integration Services or higher.
    End Error
    Warning: 2015-01-30 14:02:14.69
       Code: 0x80019002
     Description: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED.  The Execution
     method succeeded, but the number of errors raised (2) reached the maximum allow
    ed (1); resulting in failure. This occurs when the number of errors reaches the
    number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the e
    rrors.
    End Warning
    DTExec: The package execution returned DTSER_FAILURE (1).
    Started:  2:02:13 PM
    Finished: 2:02:14 PM
    i cannot upgrade original package

  • Package is not created

    hello people,
    i am try to create a package using java program.
    tha file is compiling .
    class file is created
    but it os stored in the same folder where i have stored the java file.
    package is not created.
    i am pasting my java code below
    plz help me
    thank u
    package javaprog;
    public class first
         private String swa="chaithu";
         private String swa1="schaithu";
         private String n;
         public String value()
              n=swa+swa1;
              return n;
         public void setting(String a,String b)
              swa=a;          
              swa1=b;
    is there any modifications in the program or shall i dont any configural changes in the system.
    thanks in advance.

    thats ok boss
    but if u specify
    package javaprog;
    the package(folder) has to be created and the class
    file is supposed to created in that folder
    right !
    if not
    what is the nessicity of using package statement in
    the java programing.No, that's not quite right. The class file will always be put into the same directory it's source file is in, UNLESS you specify otherwise.
    When the directory DOES matter is when you link it into an application (on the class path). Here, you specify the directory that the base package is in, and the classes must be in appropriate directories beneath that base directory in your classpath.
    So javac does not actually generate the directory structure necessary for your packages to be linked into an application or a compile - it just puts the classes where the source files are. BUT, if you put your source files in the correct package directories before compiling, then when the class files are output, they will automatically be in the right places, by virtue of the fact that the source files were in the right places.
    - Adam

  • Clients getting Applications and Packages, but NOT Software Updates

    I am trying to set up a new SCCM2012 installation and have come across a strange problem that I need help on.
    We have a single primary site at one location with distribution points at several other locations. Clients at some of the locations (but not all) are able to get deployed applications and packages from their DP, but for some reason are not able to get Software
    Updates from the same DP.
    When I look in the LocationServices log, I can see it contact the DP when an application is available. The following appear in the log:
    Current AD site of machine is XYZ
    Calling back with the following distribution points
    Distribution Point='https://<My DP>...,Locality='LOCAL',DPType='Server',Version='7958', etc.
    Calling back with locations for location request {<CID>}
    But otherwise, the LocationServices log is filled with:
    Current AD site of machine is XYZ
    Calling back with empty distribution points list
    Current AD site of machine is XYZ
    I don't understand how the machine is able to locate and work with the DP for Applications/Packages, but not for Software Updates. I'm thinking it must be something with the boundaries/boundary groups, but I have checked and everything seems to be fine,
    and they are working for Apps/Packs. 

    The WindowsUpdate.log seems to indicate that it is talking with the MP:
    **START** Agent: Finding updates [CallerId=CcmExec]
    *Include potentialy superseded updates
    *online=Yes;Ignor download priority=Yes
    *Criteria="(DeploymentAction=* AND Type='Software') OR (DeploymentAction=* AND Type='Driver')"
    *Search Scope={Machine}
    +++++ PT: Synchronizing server updates +++++
    + ServiceId= {<CID>}, Server URL = <My MP with appropriate port>
    Agent * Added update {<CID>}.202 to search result
    * Found 289 updates and 77 categories in search; evaluated appl. rules of 2711 out of 4339 deployed entities
    ** END ** Agent:Finding updates [CallerID=CcmExec]
    But there is no mention of my DP.

  • Ocs package does not match the current software components

    Hi Experts,
    In our SAP ERP 6.0 system few components like SAP APPL,EA APPL ,FinBasis were already upgraded to 603 SP04 long time back.
    Now to install language,we need to upgrade all the components to EHP3.The pre requisite to upgrade to EHP3 as per note number 1095233 is SP08.Few of our components are at SP06 level and i downloaded the supported packages of all the components to upgrade to SP08 and then upgrade to EHP3.
    When i try to display/define the component ECC-DIMp,i get the eror message message" ocs package does not match the current software componentu201D when trying to apply ECC-DIMPu201D .When i looked at the queue,the SPAM is looking for prerequisites of components EA APPL 600 and SAP APPL 600(This components are already upgraded to 603 level).
    Please suggest me the option.
    Thanks
    satish

    Hi,
    For your problem, please check SAP note 1083533, please check extract from this note:
    If you cannot integrate the required component Support Packages because the import conditions are not met (for example, because you have already installed SAP_APPL 603 although SAP_APPL 600 is the prerequisite), you must update the import conditions. When you try to install EHP3 packages using the EHP installer (EHPI), the following error occurs in SPDA_EHP_INCLUSION.LOG: "OCS package SAPKxxx does not match the current software component vector" Ths system displays the same error message when you try to install packages using transaction SAINT. Proceed as described in Note 1118803.
    Solution is documented in the SAP note 1118803.
    Thanks
    Sunny

  • Error message when installing iTunes on my PC:  This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that  this is a valid Windows installer package

    Error message when trying to install iTunes on my Pc:
    Using Windows 7, had to replace hard drive.  HELP!!
    This installation package could not be
    opened. Verify that the package exists
    and that you can access it, or contact
    the application vendor to verify that
    this is a valid Windows installer package

    Hello JAH1961,
    I recommend following the steps in the article below when getting an error message trying to install iTunes:
    Trouble installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/HT1926
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • I bought a song on iTunes...but it must not have downloaded all the way an now I can't get it to play and it won't let me delete it...I also can't purchase it again cause it says I done bought it...any suggestions?

    I bought a song on iTunes...but it must not have downloaded all the way an now I can't get it to play and it won't let me delete it...I also can't purchase it again cause it says I done bought it...any suggestions?

    Try this:
    http://support.apple.com/kb/HT2519

  • Import statement reports 'package does not exist'

    I am seeing another odd error. I'm working on learning how to read and write to text files, and I have 2 errors reported, but one is obviously caused by the other. My package is labeled as such (copy>paste of package line):
    package michaelchristopherp4db;
    and the import line is this (copy>paste again):
    import michaelchristopherp4db.ProductRecord;
    However, Netbeans looks at the import and flags it red, saying package michaelchristopherp4db does not exist. this caused my line:
    ProductRecord product = new ProductRecord();
    to also be flagged in red as it cannot find the ProductRecord class. However, it has no problems with any of the product.get* method calls. Thank you in advance for any ideas or input.
    here is the full code of the file reporting the errors.
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package michaelchristopherp4db2;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.lang.IllegalStateException;
    import java.lang.SecurityException;
    import java.util.NoSuchElementException;
    import java.util.Formatter;
    import java.util.FormatterClosedException;
    import java.util.Scanner;
    import michaelchristopherp4db.ProductRecord;
    /*  @author info
    public class readTxt
        private Scanner txtfile;
        private Formatter wishList;
        private Formatter giftIdeas;
        private Formatter priceError;
        //let user open file
        public void openFile()
        {//open method openFile
            try
            {//open try block
                priceError = new Formatter("priceerror.txt");//open object for items with invalid prices
                giftIdeas = new Formatter("giftideas.txt");//open object for gift ideas
                wishList = new Formatter("wishlist.txt");//open object for wish list
                txtfile = new Scanner(new File("products.txt"));//tell the compiler which file to use for input
            }//close try block
            catch (FileNotFoundException fileNotFoundException)
            {//open file not found catch block
                System.err.println("Error opening or creating file.");
                System.exit(1);
            }//close file not found catch block
            catch ( SecurityException securityException )
            {//start catch for SecurityException
                System.err.println("File Write access is denied.");
                System.exit(1);//END PROGRAM
            }//end catch
        }//close openFile method
        public void readProducts()
        {//open readProducts method
            ProductRecord product = new ProductRecord();//create object to hold read data
            //print headers for for output columns
            System.out.printf("%-10s%-12s%10s\n", "Product ID", "Product Name", "Price");
            try //read records from the file
            {//open try block
                while (txtfile.hasNext())
                {//open while
                    product.setproductID(txtfile.nextInt());//get productID
                    product.setproductName(txtfile.next());//get product name
                    product.setproductPrice(txtfile.nextDouble());//get product price
                    //print collected product details
                    System.out.printf("%-10d%-12s%10.2f\n", product.getproductID(),
                            product.getproductName(), product.getproductPrice());
                    if (product.getproductPrice()>50.0)
                    {//open if to store items $50 or more to wishlist.txt
                        wishList.format("%-10d%-12s%10.2f\n", product.getproductID(),
                                product.getproductName(), product.getproductPrice());
                    }//close if $50 or greater
                    else if (product.getproductPrice()<0.0)
                    {//open if less than zero
                        priceError.format("%-10d%-12s%10.2f\n", product.getproductID(),
                                product.getproductName(), product.getproductPrice());
                    }//close if less than zero
                    else
                    {//open else for gift ideas from $0 to $50
                        giftIdeas.format("%-10d%-12s%10.2f\n", product.getproductID(),
                                product.getproductName(), product.getproductPrice());
                    }//close else for gift ideas
                }//close while
            }//close try block
            catch (NoSuchElementException elementException)
            {//open no such element exception catch
                System.err.println("File improperly formed.");
                txtfile.close();//close text file
                System.exit(1);
            }//close no such element exception catch
            catch (IllegalStateException stateException)
            {//open illegal state exception catch
                System.err.println("Error reading from file.");
                System.exit(1);
            }//close illegal state exception catch
        }//close readProducts method
        //close file and end application
        public void closeFile()
        {//open closeFile method
            if (txtfile != null)
                txtfile.close();//close file
        }//close closeFile method
    }//end application readTxtAnd the code at the top of the class I am trying to import (so you can see the package I am trying to import)
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package michaelchristopherp4db;
    *  @author
    public class ProductRecord {

    I am embarrassed to admit this, but I am completely lost on the last question.. I have no clue wether it is a convenience for development or a dependancy, as I have not learned those terms or distinctions yet. For now I copied the ProductRecord file into my new project folder and renamed it's project line to match the new project name. However, while that eliminated the package does not exist error, and netbeans reports no errors now, when I run the program it does not write the new files. I have made some modifications to the code tryiing to get it to write properly but so far no luck in makingit work. Here is the current version of the file not running right.
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package michaelchristopherp4db2;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.lang.IllegalStateException;
    import java.lang.SecurityException;
    import java.util.NoSuchElementException;
    import java.util.Formatter;
    import java.util.FormatterClosedException;
    import java.util.Scanner;
    /*  @author
    *   Michael Christopher
    *   IT215-1004D-03
    *   December 30, 2010
    *   Phase 4 DB 2
    public class readTxt
        private Scanner txtfile;
        private Formatter wishList;
        private Formatter giftIdeas;
        private Formatter priceError;
        //let user open file
        public void openFile()
        {//open method openFile
            try
            {//open try block
                priceError = new Formatter("priceerror.txt");//open object for items with invalid prices
                giftIdeas = new Formatter("giftideas.txt");//open object for gift ideas
                wishList = new Formatter("wishlist.txt");//open object for wish list
                txtfile = new Scanner(new File("products.txt"));//tell the compiler which file to use for input
            }//close try block
            catch (FileNotFoundException fileNotFoundException)
            {//open file not found catch block
                System.err.println("Error opening or creating file.");
                System.exit(1);
            }//close file not found catch block
            catch ( SecurityException securityException )
            {//start catch for SecurityException
                System.err.println("File Write access is denied.");
                System.exit(1);//END PROGRAM
            }//end catch
        }//close openFile method
        public void readProducts()
        {//open readProducts method
            ProductRecord product = new ProductRecord();//create object to hold read data
            //print headers for for output columns
            wishList.format("%-10s%-12s%10s\n", "Product ID", "Product Name", "Price");
            giftIdeas.format("%-10s%-12s%10s\n", "Product ID", "Product Name", "Price");
            priceError.format("%-10s%-12s%10s\n", "Product ID", "Product Name", "Price");
            try //read records from the file
            {//open try block
                while (txtfile.hasNext())
                {//open while
                    product.setproductID(txtfile.nextInt());//get productID
                    product.setproductName(txtfile.next());//get product name
                    product.setproductPrice(txtfile.nextDouble());//get product price
                    if (product.getproductPrice()>50.0)
                    {//open if to store items $50 or more to wishlist.txt
                        wishList.format("%-10d%-12s%10.2f\n", product.getproductID(),
                                product.getproductName(), product.getproductPrice());
                    }//close if $50 or greater
                    else if (product.getproductPrice()<0.0)
                    {//open if less than zero
                        priceError.format("%-10d%-12s%10.2f\n", product.getproductID(),
                                product.getproductName(), product.getproductPrice());
                    }//close if less than zero
                    else
                    {//open else for gift ideas from $0 to $50
                        giftIdeas.format("%-10d%-12s%10.2f\n", product.getproductID(),
                                product.getproductName(), product.getproductPrice());
                    }//close else for gift ideas
                }//close while
            }//close try block
            catch (NoSuchElementException elementException)
            {//open no such element exception catch
                System.err.println("File improperly formed.");
                txtfile.close();//close text file
                System.exit(1);
            }//close no such element exception catch
            catch (IllegalStateException stateException)
            {//open illegal state exception catch
                System.err.println("Error reading from file.");
                System.exit(1);
            }//close illegal state exception catch
        }//close readProducts method
        //close file and end application
        public void closeFile()
        {//open closeFile method
            if (txtfile != null)
                txtfile.close();//close file
        }//close closeFile method
    }//end application readTxtwith the System.out.printf lines in the ReadProducts method it would properly print to screen all of the elements in the products.txt file, it is not outputting to the other .txt files at all. I will be exploring the closeFile method in case the error is due to not closing all of the files in that method, but does anyone else see what might cause it not to output the data to the appropriate .txt files?

Maybe you are looking for

  • Recover a single datafile

    Hi, i am new into this..so please help here is the situation: we have a 9i RAC env (production we dont have a dev env.). that holds alot of applications...today morning, one of the application with in 15 min lost a portion of the data (i dont really

  • Unable to call RFC

    Hi, I'm working on a web dynpro application that involves ARFC calls. After deploying this application to portal, I'm able to call the backend BAPIs with some users but not with all. I tried assigning the Super Admin role to one test user to check wh

  • String convert to list

    Hello: I need to convert a string in a list, I mean: I have this text1="list1" text2="list2" Now I need to use like parameters. Showlist text1 On Showlist vlist list1=[1,2,3] list2=[A,B,C] put vlist --I need to show the content on list1 or list2 end

  • Sending texts to numerous recipients?

    Is it possible to send a text to more than one person at a time? The "To:" section does not seem to allow more than one recipient.

  • I can access my hotmail account but can't open or preview any e-mails - nothing works, there's even no annoying adverts appearing

    Noticed 27th Sept that although i can log in to hotmail and see a list of mails, i can't select an e-mail either to open or preview. Also no ads showing on RHS. I've tried in IE and hotmail is fine so it looks like a firefox issue. Disabled all plugi