READING AND WRITING TXT FILE, GUI COMPONENTS.

HI GUYS I AM JUST NEW TO JAVA AND I AM TRYING TO LEARN SOME MORE IN JAVA. SO I NEED HELP FROM YOU GREAT GUYS WHO KNOWS MORE & MORE THING THAN ME. I CODE A GUI FOR THIS PROGRAM. THE CODE IS BELOW.
This program has to read a txt file to create Food objects which will consist of a food name, a serving size, and a number of calories. A text file is read which contains the calories contained in specific food items. From this data, an array of Food objects will be created and used to populate a combo box for user selection. The Food objects will also be used in calculating the balance calories for a given user on a given day.
User input will be used to create User objects which will be user name, age, gender, height, weight, and Food Diary objects (composition). The Food Diary objects will consist of Date (composition), Food object (composition), number of servings, and a balance. Food Diary objects will consist of the activity on any given day (see text area in sample output screen below). All User objects are saved to a file as objects and can be retrieved on subsequent runs of the program.
The program will calculate the number of calories the user is allowed per day to maintain the user�s current weight (see below for formula to use for this).
BMRMen = 66 + (13.7 * weightPounds/2.2) + (5 * heightInches*2.54) - (6.8 * age)
BMRWomen = 655 + (9.6 * weightPounds/2.2) + (1.8 * heightInches*2.54) - (4.7 * age)
GUI CODE
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class FoodDiaryGUI extends JFrame implements ActionListener {
     JLabel               lblName, lblAge, lblWeight,lblHeight,lblFemale,lblMale,lblFood;
     JTextField          txtName, txtAge, txtWeight,txtHeight;
     JButton               btnSave, btnNewUser;
     JTextArea           outputArea;
     JComboBox          cbFood;
     int currentIndex=0, lastIndex=4;
     public FoodDiaryGUI()
          super ("Food Diary Calculator");
          lblName=               new JLabel("Name: ");
          lblAge=                    new JLabel("Age: ");
          lblWeight=               new JLabel("Weight(lbs): ");
          lblHeight=               new JLabel("Height(inches): ");
          lblFemale=               new JLabel("Female: ");
          lblMale=               new JLabel("Male: ");
          lblFood=               new JLabel("Choose a Food: ");
          txtName=               new JTextField(15);
          txtAge=                    new JTextField(3);
          txtWeight=               new JTextField(6);
          txtHeight=               new JTextField(6);
          outputArea=               new JTextArea(9,20);     
          cbFood=                    new JComboBox();
          cbFood.setPreferredSize(new Dimension(100, 20));
          Container c = getContentPane();
          JPanel northPanel = new JPanel();
          northPanel.setLayout(new FlowLayout());
          btnSave=               new JButton("SAVE");
          northPanel.add(btnSave);
          btnNewUser=               new JButton("NEW USER");
          northPanel.add(btnNewUser);
          btnSave.addActionListener(this);
          btnNewUser.addActionListener(this);
          JPanel centerPanel = new JPanel();
          centerPanel.setLayout(new FlowLayout());
          centerPanel.add(lblName);
          centerPanel.add(txtName);
          centerPanel.add(lblAge);
          centerPanel.add(txtAge);
          centerPanel.add(lblWeight);
          centerPanel.add(txtWeight);
          centerPanel.add(lblHeight);
          centerPanel.add(txtHeight);
          centerPanel.setLayout(new FlowLayout());
          JRadioButton rbMale = new JRadioButton(maleString);
     birdButton.setMnemonic(KeyEvent.VK_M);
     birdButton.setActionCommand(maleString);
     birdButton.setSelected(true);
     JRadioButton rbFemale = new JRadioButton(femaleString);
     catButton.setMnemonic(KeyEvent.VK_F);
     catButton.setActionCommand(femaleString);
     //Group the radio buttons.
     ButtonGroup group = new ButtonGroup();
     group.add(rbMale);
     group.add(rbFemale);
     //Register a listener for the radio buttons.
     rbMale.addActionListener(this);
     rbFemale.addActionListener(this);
     public void actionPerformed(ActionEvent rb) {
     picture.setIcon(new ImageIcon("images/"
     + rb.getActionCommand()
     + ".gif"));
          radioGroup.add(rbMale);
          radioGroup.add(rbFemale);
          centerPanel.add(rbMale);
          centerPanel.add(rbFemale);
          centerPanel.add(lblFood);
          centerPanel.add(cbFood);
          JPanel southPanel = new JPanel();
          southPanel.setLayout(new FlowLayout());
          southPanel.add (outputArea);
          c.add(northPanel,BorderLayout.NORTH);
          c.add(centerPanel,BorderLayout.CENTER);
          c.add(southPanel,BorderLayout.SOUTH);
          setSize(650,300);
          setVisible(true);
          //add listener to button components.
          public void actionPreformed(ActionEvent e)
               if (e.getSource()==btnSave)
                    currentIndex++;
                    currentIndex--;
          public static void main (String[] args)
               FoodDiaryGUI application = new FoodDiaryGUI();
               application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          public void actionPerformed(ActionEvent arg0) {
               // TODO Auto-generated method stub
THE .txt file is as:
1000 ISLAND, SALAD DRSNG,LOCAL*1 TBSP*25
1000 ISLAND, SALAD DRSNG,REGLR*1 TBSP*60
100% NATURAL CEREAL *1 OZ*135
40% BRAN FLAKES, KELLOGG'S*1 OZ*90
40% BRAN FLAKES, POST*1 OZ*90
ALFALFA SEEDS, SPROUTED, RAW*1 CUP*10
ALL-BRAN CEREAL*1 OZ*70
ALMONDS, WHOLE*1 OZ*165
ANGELFOOD CAKE, FROM MIX*1 PIECE*125
APPLE JUICE, CANNED*1 CUP*115
i hope this forum site has to many java professionals and this problem is nothing for them. for me it is great.

Stick to using a single userid and a single posting of a question:
http://forum.java.sun.com/thread.jspa?threadID=731264&tstart=0

Similar Messages

  • File importer detected an inconsistency in the file stucture of (file name). Reading and writing this file's metadata (XMP) has been disabled.

    I have duplicated a project to work on another computer. The project opens fine but when I import new footage/audio files I get this message. "File importer detected an inconsistency in the file stucture of (file name). Reading and writing this file's metadata (XMP) has been disabled." Then I can't play my timeline and Premier Pro crashes.  I have to force quit and restart my computer to continue working. What does this error really mean? How do you rectify?
    Our workflow requires that we duplicate projects to make updates because we are frequently revising but need to keep original project unchanged and intact.

    I have a similar issue and message , but occurs when I import AVI clips from OnLocation CS4 to Premier Pro CS4.

  • Writing and reading txt file, GUI components

    <b>HI GUYS I AM JUST NEW TO JAVA AND I AM TRYING TO LEARN SOME MORE IN JAVA. SO I NEED HELP FROM YOU GREAT GUYS WHO KNOWS MORE & MORE THING THAN ME. I CODE A GUI FOR THIS PROGRAM. THE CODE IS BELOW. <b/>
    This program has to read a txt file to create Food objects which will consist of a food name, a serving size, and a number of calories. A text file is read which contains the calories contained in specific food items. From this data, an array of Food objects will be created and used to populate a combo box for user selection. The Food objects will also be used in calculating the balance calories for a given user on a given day.
    User input will be used to create User objects which will be user name, age, gender, height, weight, and Food Diary objects (composition). The Food Diary objects will consist of Date (composition), Food object (composition), number of servings, and a balance. Food Diary objects will consist of the activity on any given day (see text area in sample output screen below). All User objects are saved to a file as objects and can be retrieved on subsequent runs of the program.
    The program will calculate the number of calories the user is allowed per day to maintain the user�s current weight (see below for formula to use for this).
    BMRMen = 66 + (13.7 * weightPounds/2.2) + (5 * heightInches*2.54) - (6.8 * age)
    BMRWomen = 655 + (9.6 * weightPounds/2.2) + (1.8 * heightInches*2.54) - (4.7 * age)
    GUI CODE
    <code>
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class FoodDiaryGUI extends JFrame implements ActionListener {
    JLabel lblName, lblAge, lblWeight,lblHeight,lblFemale,lblMale,lblFood;
    JTextField txtName, txtAge, txtWeight,txtHeight;
    JButton btnSave, btnNewUser;
    JTextArea outputArea;
    JComboBox cbFood;
    int currentIndex=0, lastIndex=4;
    public FoodDiaryGUI()
    super ("Food Diary Calculator");
    lblName= new JLabel("Name: ");
    lblAge= new JLabel("Age: ");
    lblWeight= new JLabel("Weight(lbs): ");
    lblHeight= new JLabel("Height(inches): ");
    lblFemale= new JLabel("Female: ");
    lblMale= new JLabel("Male: ");
    lblFood= new JLabel("Choose a Food: ");
    txtName= new JTextField(15);
    txtAge= new JTextField(3);
    txtWeight= new JTextField(6);
    txtHeight= new JTextField(6);
    outputArea= new JTextArea(9,20);
    cbFood= new JComboBox();
    cbFood.setPreferredSize(new Dimension(100, 20));
    Container c = getContentPane();
    JPanel northPanel = new JPanel();
    northPanel.setLayout(new FlowLayout());
    btnSave= new JButton("SAVE");
    northPanel.add(btnSave);
    btnNewUser= new JButton("NEW USER");
    northPanel.add(btnNewUser);
    btnSave.addActionListener(this);
    btnNewUser.addActionListener(this);
    JPanel centerPanel = new JPanel();
    centerPanel.setLayout(new FlowLayout());
    centerPanel.add(lblName);
    centerPanel.add(txtName);
    centerPanel.add(lblAge);
    centerPanel.add(txtAge);
    centerPanel.add(lblWeight);
    centerPanel.add(txtWeight);
    centerPanel.add(lblHeight);
    centerPanel.add(txtHeight);
    centerPanel.setLayout(new FlowLayout());
    JRadioButton rbMale = new JRadioButton(maleString);
    birdButton.setMnemonic(KeyEvent.VK_M);
    birdButton.setActionCommand(maleString);
    birdButton.setSelected(true);
    JRadioButton rbFemale = new JRadioButton(femaleString);
    catButton.setMnemonic(KeyEvent.VK_F);
    catButton.setActionCommand(femaleString);
    //Group the radio buttons.
    ButtonGroup group = new ButtonGroup();
    group.add(rbMale);
    group.add(rbFemale);
    //Register a listener for the radio buttons.
    rbMale.addActionListener(this);
    rbFemale.addActionListener(this);
    public void actionPerformed(ActionEvent rb) {
    picture.setIcon(new ImageIcon("images/"
    + rb.getActionCommand()
    + ".gif"));
    radioGroup.add(rbMale);
    radioGroup.add(rbFemale);
    centerPanel.add(rbMale);
    centerPanel.add(rbFemale);
    centerPanel.add(lblFood);
    centerPanel.add(cbFood);
    JPanel southPanel = new JPanel();
    southPanel.setLayout(new FlowLayout());
    southPanel.add (outputArea);
    c.add(northPanel,BorderLayout.NORTH);
    c.add(centerPanel,BorderLayout.CENTER);
    c.add(southPanel,BorderLayout.SOUTH);
    setSize(650,300);
    setVisible(true);
    //add listener to button components.
    public void actionPreformed(ActionEvent e)
    if (e.getSource()==btnSave)
    currentIndex++;
    currentIndex--;
    public static void main (String[] args)
    FoodDiaryGUI application = new FoodDiaryGUI();
    application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    public void actionPerformed(ActionEvent arg0) {
    // TODO Auto-generated method stub
    </code>
    THE .txt file is as:
    1000 ISLAND, SALAD DRSNG,LOCAL*1 TBSP*25
    1000 ISLAND, SALAD DRSNG,REGLR*1 TBSP*60
    100% NATURAL CEREAL *1 OZ*135
    40% BRAN FLAKES, KELLOGG'S*1 OZ*90
    40% BRAN FLAKES, POST*1 OZ*90
    ALFALFA SEEDS, SPROUTED, RAW*1 CUP*10
    ALL-BRAN CEREAL*1 OZ*70
    ALMONDS, WHOLE*1 OZ*165
    ANGELFOOD CAKE, FROM MIX*1 PIECE*125
    APPLE JUICE, CANNED*1 CUP*115
    i hope this forum site has to many java professionals and this problem is nothing for them. for me it is great.

    Stick to using a single userid and a single posting of a question:
    http://forum.java.sun.com/thread.jspa?threadID=731264&tstart=0

  • Reading and Writing to files in JARs

    I'm making a card game (TriPeaks). I need to store the scores for the users in files. Everything worked fine until I packaged it into a JAR. I tried using getClass().getResource(fileName); and then converting the URL to a URI to create the File object. That gave me an error saying the URI wasn't hierarchical.
    So I Googled around and found that I can use:
    InputStream is = getClass().getResourceAsStream(fileName);
    try {
        BufferedReader in = new BufferedReader(new InputStreamReader(is));
        //read the file, etc.
        is.close();
    catch (IOException eIO) { }That works both in and out of the JAR. However, I still can't write the scores to the files. I know that you can write to a file inside a JAR because I created another program that writes its settings to a file. However, that program has its settings file in the same folder (the root of the JAR) as the .class file in the JAR. The scores, however, are in a subfolder in the JAR file.
    How would I write to the files in the subfolder in the JAR file?

    Vetruvet wrote:
    Why wouldn't there be such a useful feature in the API?Because it's extremely difficult to implement. Let me give you a quick description of how a jar file is structured. It uses the ZIP format that's been around for about 30 years now. The contents of a ZIP archive are arranged like this:
    - Header information
    - Compressed file #1
    - Compressed file #2
    - ... and so on ...
    - Directory with pointers to offsets of the compressed files.
    So when you want to get a file from the archive, you go to the end and find the directory. You search it for the file you want to get and find its offset, then you go there and decompress the file that's there.
    Now consider trying to update one of these files. The compressed version of the new file may well differ in size from the existing file in the archive. So you'd have to do something intrusive and expensive like moving all the files after it, including the directory, or just adding it after the last compressed file and moving the directory.
    And doing this would mess up things in the case where another thread or process or object (e.g. a URLClassLoader) was already using the archive.
    It just isn't practical. So consider JAR and ZIP archives as read-only. That's what they were designed for in the first place anyway.

  • Reading and writing to file , getting null when i try to  read file content

    i start by apologizing incase i have posted this question in the wrong forum
    i am trying to iterate through a directory tree and pick all the subdirectories and put them in an arraylist . on the other hand , i am picking all the files and putting them in a different arraylist . After that i iterate through the arraylist , pick a folder , create a file in it search for all the files of the same type in its subfolders and write them to the newly created file
    The problem i am running into is i i can't read the files and hence i can't write to the file .
    My directory tree is in the format
    c:\KPCData\\01\01\01\01\01\ file1_type1
    c:\KPCData\\01\01\01\01\02\ file2_type1
    where one one of the types is "covers" . i know this could be asking too much but i am at my tethers end , could someone please have a look at the code and tell me where i might be going wrong . you could zero in on the part where i have ************ before the a line of code thank you package directories;
    import java.io.*;
    import java.util.*;
    public class Directories {
    private static  ArrayList direcs= new ArrayList();
    private static  ArrayList census= new ArrayList();
    private static ArrayList vagrant= new ArrayList();
    private static ArrayList hotel= new ArrayList();
    private static ArrayList emigrant= new ArrayList();
    private static ArrayList traveller= new ArrayList();
    private static ArrayList longform= new ArrayList();
    private static ArrayList cover= new ArrayList();
    private static String parentPath = null;
    private static File mycover = null;
    private static File mytravel = null;
    private static File myemigrant = null;
    private static File mylong= null;
    private static File myinstitution = null;
    private static File myvagrant = null;
    private static BufferedReader in;
    private static BufferedWriter out;
    private static String read,toread;
    //function for listing the folder contents
    class compareDirs implements Comparator
    public int compare(Object one, Object two)
         int val=0;
         File file1 = (File)one;
         File file2= (File)two;
         String name1 = file1.toString();
         String name2= file2.toString();
         if (name1.length()==name2.length())
         val= name1.compareTo(name2);
         else
              if( name1.length()>name2.length())
                   val=-1;
              if (name1.length()<name2.length())
                   val=1;
         return val;
    private  ArrayList recurs(File dir,File file) throws IOException
         File []files=dir.listFiles();
         for(int index=0;index<files.length ;index++)
              if(files[index].isDirectory())
                   recurs(files[index],file);          
              }//if
              else
                  census.add(files[index]);     
         }//for index
         return census;
    } //recurs
    //function for determining the number and paths of the folders
    private ArrayList numDirs(File dirs)
         File []files=dirs.listFiles();
         for(int index=0;index<files.length ;index++)
              if(files[index].isDirectory())
                   if (direcs.contains(files[index])==false)
                   direcs.add(files[index]);
                   numDirs(files[index]);     
              }//if
         }//for index
         return direcs;
    public static void main(String[]args) throws IOException
              File myfile = new File("C:\\KPCData");
         File myfile2= new  File("C:\\KPCData\test.txt");
         Directories dir = new Directories();
         if (myfile.isDirectory())
         ArrayList myList=dir.recurs(myfile,myfile2);
         ArrayList mydir1 = dir.numDirs(myfile);
        ArrayList mydirs = new ArrayList();
        mydirs.add(mydir1.get(0));
         for (int x=0;x<mydir1.size();x++)
         {  int count=0;
              for (int y=0;y<mydirs.size();y++)
                   if (x==y)
                        count++;
              if (count<1)
                   mydirs.add(mydir1.get(x));
         Collections.sort( mydirs,dir.new compareDirs() );     
            for(int index1 =0 ;index1<mydirs.size();index1++)//print out directories
              File mydir=(File)mydirs.get(index1);
              File directory= (File)mydirs.get(index1);
              if(!mydir.getPath().contains("00"))//// if not leave node  create files for each file type
                   String name1 =mydir.getPath();
                   ArrayList ray=new ArrayList();
                   String name="K";
                 for (int index=0;index<name1.length();index++ )
                          if (name1.charAt(index)!='\\'&&name1.charAt(index)!='C'&&name1.charAt(index)!=':'&&name1.charAt(index)!='K'&&name1.charAt(index)!='P'&&name1.charAt(index)!='D'&&name1.charAt(index)!='a'&&name1.charAt(index)!='t')
                       name =name+(String.valueOf(name1.charAt(index)));
              // create a string
                  name= name.substring(1);
                   String trial = name+"_cover.dat";
                   mycover = new File ( mydir,trial);
                     if (mycover.exists()) {
                          mycover.delete();
                          mycover.createNewFile();
                      } else {
                           mycover.createNewFile();
                     String addit = mydir.getParent().toString();
                    mylong = new File (addit+"\\_long.dat");
                    if (mylong .exists()) {
                          mylong.delete();
                          //mylong.createNewFile();
                      } else {
                            //mylong.createNewFile();
                              myemigrant = new File (mydir.getParent()+"\\_emigrant.dat");
                              if (myemigrant.exists()) {
                                   myemigrant.delete();
                                  // myemigrant.canWrite();
                                } else {
                                     //  myemigrant.canWrite();
                   mytravel= new File (mydir.getParent().toString()+"\\_traveller.dat");
                    if (mytravel.exists()) {
                        mytravel.delete();
                       // mytravel.createNewFile();
                      } else {
                           //mytravel.createNewFile();
                    myinstitution = new File (mydir.getParent().toString()+"\\_institution.dat");
                    if (myinstitution.exists()) {
                          myinstitution.delete() ;
                         // myinstitution.createNewFile();
                      } else {
                           //myinstitution.createNewFile();
                    myvagrant = new File (mydir.getParent().toString()+"\\_vagrant.dat");
                    if (myvagrant .exists()) {
                         myvagrant.delete();
                        // myvagrant.createNewFile();
                      } else {
                           //myvagrant.createNewFile();
         //}//initial
              for( int index2 =0;index2<myList.size();index2++)//loop the second one for individual files
                   File file= (File)myList.get(index2);
                   if (file.getParent().contains("00"))//leave node
                        parentPath =file.getParent().substring(0, file.getParent().length()-4);
                   else
                        parentPath =file.getParent().substring(0, file.getParent().length()-3);
                   if (parentPath.toString().compareTo(directory.getParent())==0&file.getName().contains("cover"))
                        try {
                             in = new BufferedReader(new FileReader(file));
                             out = new BufferedWriter( new  FileWriter(mycover));
                        ************     while ((read =in.readLine())!=null)
                             System.out.println("testing");//test whether i ever get in this section !!!
                             out.write(read);               
                             out.close();
                             in.close();
                        catch(NullPointerException e)
                             System.out.println(e);
                        catch(IOException e)
                             System.out.println("There was a problem:" + e);
    }//class Directories

    kingspalace wrote:
    Dr Clap
    The problem i am having is that whereas i am very sure that there are contents in the files i am trying to read , this part of the code Print the Values of parentPath,directory.getParent() and file.getName() here .In the start of this if condition to get a idea what stuff is coming here.
    if (parentPath.toString().compareTo(directory.getParent())==0&file.getName().contains("cover"))
                   {Are you trying to compare parentPath and directory.getParent() as Strings ? How about using equals() ?
    Also are you aware that a single & and && are not one and the same ?
    & will check nevertheless even if the string comparison on the parentPath returns true or false.
    && will not check file.getName() part if the String comparison part fails.
                        try {
                             in = new BufferedReader(new FileReader(file));
                             out = new BufferedWriter( new FileWriter(mycover));
                        ************     while ((read =in.readLine())!=null)
                             System.out.println("testing");//test whether i ever get in this section !!!
                             out.write(read);               
                             out.close();
                             in.close();
                        catch(NullPointerException e)
                             System.out.println(e);
                        catch(IOException e)
                             System.out.println("There was a problem:" + e);
                             }How about adding a simple Exception catch block here ,in case you miss anything ?
    never gets executed executed (meaning ,according to the code, the files am reading have no content ). i am a bit new to files and directories in java . i am hence seeking advice on what i could be doing wrong .IN short,debugging your code will help you a lot.

  • File adapter  reading and writing large files

    Hi we are getting error when trying to process large files using file adapters. files of size 80 to 100 MB. we need to read the inbound files and write them to another folder in another server. the error we are getting is out of memory. gracias

    Hi,
    Use the asynchronous process or a checkpoint(); to see your instance before it time-out.
    --Khaleel                                                                                                                                                                                                                           

  • Very slow painting while reading and writing doubles into file

    for 15MB length file i = 7662080
    for 50MB length file i = 12414368
    Part of Code for writing into file follows like this:
    try{
    fos = new FileOutputStream("Angel.txt");
    File f = new File("Angel.txt");
         if(f.length() >=4)
         f.delete();
    fos = new FileOutputStream("Angel.txt");     
    dos = new DataOutputStream(new BufferedOutputStream(fos,1000000));
    int x=0;
    double y_last, y_new;
    for(int j=0 ;j<i ;j++)
    if(some condition)
    y_new = ....;
    try{
    //previously in vectors
    y_last = y_new;
    vect.add(new Line2D.Double(x, y_last, x, y_new)_;
    dos.writeDouble(y_new);
         }catch(Exception e){System.out.println(e);}
    dos.close();
    fos.close();
    x++;
    }catch(Exception excp){System.out.println(excp);}
    part of code for reading from file follows like this:
    public void paint(Graphics g)
    try{
         double y1, y2 =0;               
         Line2D.Double doub;
         raf = new RandomAccessFile("Angel.txt","r");
         dis = new DataInputStream(new BufferedInputStream(new FileInputStream(raf.getFD(),1000000)));
         raf.seek((rect.x*8));
         for (int i = 0/any value; (i < value as per choice); i++)
              g2.setStroke(new BasicStroke(0)); //2
              y1 = y2;
         y2 =dis.readDouble();
              doub=new Line2D.Double(i,y1,i,y2);
              g2.draw(doub);
    dis.close();
         raf.close();
    }catch(Exception excp){System.out.println(excp);}
    I tried using Object Streams but NotSerializable Exception is thrown as Line2D.Double objects
    are not serialized.
    Any idea to make reading and writing into file specially from MB files faster is appreciated.

    Why are you reading in the file in the paint method ?
    Create your data once before painting.
    I think you should explain what is your goal and what behavior you want.
    Denis

  • Reading and Writing large Excel file using JExcel API

    hi,
    I am using JExcelAPI for reading and writing excel file. My problem is when I read file with 10000 records and 95 columns (file size about 14MB), I got out of memory error and application is crashed. Can anyone tell me is there any way that I can read large file using JExcelAPI throug streams or in any other way. Jakarta POI is also showing this behaviour.
    Thanks and advance

    Sorry when out of memory error is occurred no stack trace is printed as application is crashed. But I will quote some lines taken from JProfiler where this problem is occurred:
              reader = new FileInputStream(new File(filePath));
              workbook = Workbook.getWorkbook(reader);
              *sheeet = workbook.getSheet(0);* // here out of memory error is occured
               JProfiler tree:
    jxl.Workbook.getWorkBook
          jxl.read.biff.File 
                 jxl.read.biff.CompoundFile.getStream
                       jxl.read.biff.CompoundFile.getBigBlockStream Thanks

  • Rreading and writing this file's metadata (xmp) has been disabled. Renders unplayable/corrupted files

    Hi everyone,
    I've been using Premiere Pro CC for a while now, as I have a YouTube channel, and I've rendered, exported and edited around a dozen different videos, and have had no issues until now. I haven't done anything to my settings, but randomly, I am now unable to export any videos. I've tried exporting multiple times, using different formats, and I still get the same error:
         File importer detected an inconsistency in the file structure of [FILE NAME]. Reading and writing this file’s metadata (XMP) has been disabled.
    I've looked around, and I've seen just about no help in fixing the issue, so I was hoping that someone could help me out.
    Some of my computer details are:
    Premiere Pro CC
    Toshiba Z10T
    Windows 8.1
    Hopefully that's enough to go by
    Thanks guys

    After moving LR3.5 and catalogs to a new computer running Windows 7 and LR from an XP system, I suddenly had 6400 files with exclamation points--failure to synch metadata or similar warnings on every file.  If I thought I had one without the error, if I clicked on it--there error showed up.    It was very frustrating and I was wondering if I was going to have to keep my old computer forever.
    After I searched for a couple of hours and found that there have been several discussions concerning failures to sync xmp sidecar files and failures to write metadata on this forum and others.  Some of the postings had angry rants against Adobe.  On my system, it was not Adobe that should be blamed, it was Microsoft:
    On one of the Adobe threads, I noticed a post that the person had multiple external drives and the problem did not show itself on one drive.  The person said that changing the permissions on the other hard drives solved the problem.   I tried this and it worked for me.  I did not have this problem with this same drive on my XP system.  I will try to find that other forum and thank the person who gave me the solution.

  • How to read and write to file on server

    can any body tell how to read or write to a file on server, like where do i keep the file and what does the path look like......on server
    stand alone i am reading and writing into file but when it comes to server i am confused how it works...i mean the path
    thank you

    The Path needs to be absolute:
    For example in Unix it would look like:
    /usr/paz/Test.txtIn Windows it would look like:
    C:/Paz/Test.txtHope this helps.
    Thanks and regards,
    Pazhanikanthan. P

  • Problem on reading and writing from from a *.txt file

    I get Problem on reading and writing from from a *.txt file. The following is the read() method...
    The software said the DataInputStream is depreciated. Can anyone help me please?
    public void read()
        File file = new File("C://Documents and Settings//Charles//My Documents//Brunel//EE2065//Assignment and Lab//Assignment 4 and Lab 4//data.txt");
        FileInputStream in = null;
        String str = "";
        try
          in = new BufferedReader(file);
          //in = new FileInputStream(file);
          for(;;)
            str = new BufferedReader(in).readLine();
            //str = new DataInputStream(in).readLine();
            if(str == null)
              break;
            System.out.print(str);
        in.close();
        catch(IOException e)
            System.err.println("execution error: " +e);
      }

    Thank you for your reply. I have made some change. However, there is an incompetable type found error.
    in = new BufferedReader(new InputStreamReader(in));The following are all of the code.
    public void read()
        File file = new File("C://Documents and Settings//Charles//My Documents//Brunel//EE2065//Assignment and Lab//Assignment 4 and Lab 4//data.txt");
        FileInputStream in = null;
        //BufferedReader in = null;
        String str = "";
        try
          in = new BufferedReader(new InputStreamReader(in));
          //in = new FileInputStream(file);
          for(;;)
            BufferedReader Bstr = new BufferedReader(new InputStreamReader(in));
            //str = new BufferedReader(in).readLine();
            //str = new DataInputStream(in).readLine();
            if(str == null)
              break;
            System.out.print(str);
        in.close();
        catch(IOException e)
            System.err.println("execution error: " +e);

  • Reading and writing files in Mac OS X

    Hello, I am "kind of" experienced with Java (read a few books, and took one course in highschool, and I fool around with it from time to time).
    All of this however was on Windows XP, and all from the command line. Because I now have a Macbook Pro, I wish to start programming java on Mac OSX naturally. I've gotten over the shock and awe of using Xcode (I had never use a "package" before with multiple components), but I have come across a problem. I referenced one of my Java books on how to read from a .txt file (my intended program needs a database), but I've been trying for a few hours now, and I just can't seem to get it to work at all.
    I want to read the entire file and save it as a String. I don't know if there is a different procedure on OSX than Windows, but here is what I am using:
    import java.io.*;etc. etc.
    public String readPlease() {
         String str = "";
         try {
              FileReader file = new FileReader("database.txt");
              BufferedReader buff = new BufferedReader(file);
              str = buff.readLine();
              buff.close();
              return str;
         } catch (IOException e) {
              return e.toString();
    }And it is returning:
    java.io.FileNotFoundException: database.txt (No such file or directory)The .java file and the .txt file are in the same folder (src) and I've tried it while its in "resources" and "bin" (where the .class files are).

    That file needs to be in the directory that you launch your program from.
    Is that where it is? It might help if you showed us the command you are using to execute and where you are relative to your file etc.
    Also this
    BufferedReader buff = new BufferedReader(file);
    str = buff.readLine();
    buff.close();is going to only read one line of the file. Do you know that?
    If you want to read multiple lines you'll need a loop, and you should be using a StringBuilder and appending to it to build your String. Then you can call toString on the StringBuilder instance once at the end to get your string.

  • IPhone4 how through the USB mobile phone file reading and writing?

    iPhone4 how through the USB mobile phone file reading and writing?

    No idea what you are asking.
    Please explain

  • Quickest method for reading and writing files

    Hi
    I need help regarding file operations.(Reading and Writing). Currently I am using BufferedReader and BufferedWriter to read and write files. But the files (XML) are very huge files(from 30 -50 mb). This is slowing the application to a great extent. Is there any other approach to perform the above mentioned operations on XML files in a fast manner.
    Thank You
    Mansoor.

    Hi
    Can u let me know how to use the java.nio pavkage for primitve data types(int,float..., boolean). I have tried it but found no success.
    Thank You
    Mansoor

  • Apostroph and euro sign not read corectly from txt file

    apostroph and euro sign not read corectly from txt file.
    my code is like this:
    FileInputStream fis= new FileInputStream(x+".html");
    BufferedReader br=new BufferedReader(new InputStreamReader(fis,"UTF-8"));
    String Line="";
    while ((Line = br.readLine()) != null) result+=Line;
    br.close();
    fis.close();
    I use UTF-8 because the file contains also French characters.
    What's the problem?
    THANK YOU!

    apostroph and euro sign not read corectly from txt
    file.
    my code is like this:
    FileInputStream fis= new FileInputStream(x+".html");
    BufferedReader br=new BufferedReader(new
    InputStreamReader(fis,"UTF-8"));
    String Line="";
    while ((Line = br.readLine()) != null) result+=Line;
    br.close();
    fis.close();
    I use UTF-8 because the file contains also French
    characters.
    What's the problem?
    THANK YOU!
    This is from the FileInputStream API documentation:
    FileInputStream is meant for reading streams of raw bytes such as image data. For reading streams of characters, consider using FileReader.

Maybe you are looking for

  • Details of Follow-up documents at Table level

    Dear All, I want to know if there is any table(s) which contains the follow-up documents numbers that gets generated in CRM. For example, 1. first IC ticket will be generated, 2. then product complaint will be generated as a follow up transaction of

  • How do I set the aspect ration for 4:3  or for 16:9?

    How do I set the aspect ration for 4:3  or for 16:9 in Adobe PE12?

  • [solved] WINEARCH=win32 no sound

    Hello all, Recently I did a new install of arch 64.  installed wine, winetricks, all the goodies.  Everything seemed to install ok. When I go to create a winecfg file for a game by using: WINEARCH=win32 WINEPREFIX=/mnt/dugrdata/games/.wine-wow winecf

  • Any Way to Speed up Mac Mini? (G4)

    Hi, I was just wondering whether you can give a speed boost to an old Mac Mini like mine. I have tried some utilities like onyx and still slow. HDD is 80 GB and I have over 40 GB free space. Maybe ram or SSD? Thanks.

  • BAPI_APOATP_CHECK - Check Instructions table

    Hi, 1. I am calling the FM BAPI_APOATP_CHECK in APO system from R/3 system. 2. Once the ATP check is done, the call is returned back to the R/3 System. 3. One of the Tables parameters in that FM is CHECK_INSTRUCTIONS. 4. I dont see the data coming ba