Help with Files in Java

I need to replace some content in a file . Can some one tell me if we can append or replace only a part of the content in files using Java?
Right now I am using Stringtokenizer, break the file into tokens and put them in a buffer, append the required data and then write to a file. But this seems very crude way of doing it and the output is not as I wanted it.
Please help,
Thanks

"Random" updates to files are possible, but the problem lies when part of a file changes size, with the need to move the rest of it up or down. In general, when part of the file might change size, it's a lot easier all round to create a new version of the file and rename.

Similar Messages

  • Need Help With File Matching Records

    I need help with my file matching program.
    Here is how it suppose to work: FileMatch class should contain methods to read oldmast.txt and trans.txt. When a match occurs (i.e., records with the same account number appear in both the master file and the transaction file), add the dollar amount in the transaction record to the current balance in the master record, and write the "newmast.txt" record. (Assume that purchases are indicated by positive amounts in the transaction file and payments by negative amounts.)
    When there is a master record for a particular account, but no corresponding transaction record, merely write the master record to "newmast.txt". When there is a transaction record, but no corresponding master record, print to a log file the message "Unmatched transaction record for account number ..." (fill in the account number from the transaction record). The log file should be a text file named "log.txt".
    Here is my following program code:
    // Exercise 14.8: CreateTextFile.java
    // creates a text file
    import java.io.FileNotFoundException;
    import java.lang.SecurityException;
    import java.util.Formatter;
    import java.util.FormatterClosedException;
    import java.util.NoSuchElementException;
    import java.util.Scanner;
    import org.egan.AccountRecord;
    import org.egan.TransactionRecord;
    public class CreateTextFile
      private Formatter output1;  // object used to output text to file
      private Formatter output2;  // object used to output text to file
      // enable user to open file
      public void openTransFile()
        try
          output1 = new Formatter("trans.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openTransFile
      // enable user to open file
      public void openOldMastFile()
        try
          output2 = new Formatter("oldmast.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openOldMastFile
      // add transaction records to file
      public void addTransactionRecords()
        // object to be written to file
        TransactionRecord record1 = new TransactionRecord();
        Scanner input1 = new Scanner(System.in);
        System.out.printf("%s\n%s\n%s\n%s\n\n",
          "To terminate input, type the end-of-file indicator",   
          "when you are prompted to enter input.",
          "On UNIX/Linux/Mac OS X type <ctrl> d then press Enter",
          "On Windows type <ctrl> z then press Enter");
        System.out.printf("%s\n%s",
           "Enter account number (> 0) and amount.","? ");
        while (input1.hasNext())  // loop until end-of-file indicator
          try // output values to file
            // retrieve data to be output
            record1.setAccount(input1.nextInt());    // read account number
            record1.setAmount(input1.nextDouble());  // read amount
            if (record1.getAccount() > 0)
              // write new record
              output1.format("%d %.2f\n", record1.getAccount(), record1.getAmount());
            } // end if
            else
              System.out.println("Account number must be greater than 0.");
            } // end else
          } // end try
          catch (FormatterClosedException formatterClosedException)
            System.err.println("Error writing to file.");
            return;
          } // end catch
          catch (NoSuchElementException elementException)
            System.err.println("Invalid input. Please try again.");
            input1.nextLine(); // discard input so user can try again
          } // end catch
          System.out.printf("%s %s\n%s", "Enter account number (> 0) ",
            "and amount.","? ");
        } // end while
      } // end method addTransactionRecords
      // add account records to file
      public void addAccountRecords()
        // object to be written to file
        AccountRecord record2 = new AccountRecord();
        Scanner input2 = new Scanner(System.in);
        System.out.printf("%s\n%s\n%s\n%s\n\n",
          "To terminate input, type the end-of-file indicator",   
          "when you are prompted to enter input.",
          "On UNIX/Linux/Mac OS X type <ctrl> d then press Enter",
          "On Windows type <ctrl> z then press Enter");
        System.out.printf("%s\n%s",
           "Enter account number (> 0), first name, last name and balance.","? ");
        while (input2.hasNext())  // loop until end-of-file indicator
          try // output values to file
            // retrieve data to be output
            record2.setAccount(input2.nextInt());    // read account number
            record2.setFirstName(input2.next());      // read first name
            record2.setLastName(input2.next());       // read last name
            record2.setBalance(input2.nextDouble());  // read balance
            if (record2.getAccount() > 0)
              // write new record
              output2.format("%d %s %s %.2f\n", record2.getAccount(), record2.getFirstName(),
                record2.getLastName(), record2.getBalance());
            } // end if
            else
              System.out.println("Account number must be greater than 0.");
            } // end else
          } // end try
          catch (FormatterClosedException formatterClosedException)
            System.err.println("Error writing to file.");
            return;
          } // end catch
          catch (NoSuchElementException elementException)
            System.err.println("Invalid input. Please try again.");
            input2.nextLine(); // discard input so user can try again
          } // end catch
          System.out.printf("%s %s\n%s", "Enter account number (> 0),",
            "first name, last name and balance.","? ");
        } // end while
      } // end method addAccountRecords
      // close file
      public void closeTransFile()
        if (output1 != null)
          output1.close();
      } // end method closeTransFile
      // close file
      public void closeOldMastFile()
        if (output2 != null)
          output2.close();
      } // end method closeOldMastFile
    } // end class CreateTextFile--------------------------------------------------------------------------------------------------
    // Exercise 14.8: CreateTextFileTest.java
    // Testing class CreateTextFile
    public class CreateTextFileTest
       // main method begins program execution
       public static void main( String args[] )
         CreateTextFile application = new CreateTextFile();
         application.openTransFile();
         application.addTransactionRecords();
         application.closeTransFile();
         application.openOldMastFile();
         application.addAccountRecords();
         application.closeOldMastFile();
       } // end main
    } // end class CreateTextFileTest-------------------------------------------------------------------------------------------------
    // Exercise 14.8: TransactionRecord.java
    // A class that represents on record of information
    package org.egan; // packaged for reuse
    public class TransactionRecord
      private int account;
      private double amount;
      // no-argument constructor calls other constructor with default values
      public TransactionRecord()
        this(0,0.0); // call two-argument constructor
      } // end no-argument AccountRecord constructor
      // initialize a record
      public TransactionRecord(int acct, double amt)
        setAccount(acct);
        setAmount(amt);
      } // end two-argument TransactionRecord constructor
      // set account number
      public void setAccount(int acct)
        account = acct;
      } // end method setAccount
      // get account number
      public int getAccount()
        return account;
      } // end method getAccount
      // set amount
      public void setAmount(double amt)
        amount = amt;
      } // end method setAmount
      // get amount
      public double getAmount()
        return amount;
      } // end method getAmount
    } // end class TransactionRecord -------------------------------------------------------------------------------------------------
    // Exercise 14.8: AccountRecord.java
    // A class that represents on record of information
    package org.egan; // packaged for reuse
    import org.egan.TransactionRecord;
    public class AccountRecord
      private int account;
      private String firstName;
      private String lastName;
      private double balance;
      // no-argument constructor calls other constructor with default values
      public AccountRecord()
        this(0,"","",0.0); // call four-argument constructor
      } // end no-argument AccountRecord constructor
      // initialize a record
      public AccountRecord(int acct, String first, String last, double bal)
        setAccount(acct);
        setFirstName(first);
        setLastName(last);
        setBalance(bal);
      } // end four-argument AccountRecord constructor
      // set account number
      public void setAccount(int acct)
        account = acct;
      } // end method setAccount
      // get account number
      public int getAccount()
        return account;
      } // end method getAccount
      // set first name
      public void setFirstName(String first)
        firstName = first;
      } // end method setFirstName
      // get first name
      public String getFirstName()
        return firstName;
      } // end method getFirstName
      // set last name
      public void setLastName(String last)
        lastName = last;
      } // end method setLastName
      // get last name
      public String getLastName()
        return lastName;
      } // end method getLastName
      // set balance
      public void setBalance(double bal)
        balance = bal;
      } // end method setBalance
      // get balance
      public double getBalance()
        return balance;
      } // end method getBalance
      // combine balance and amount
      public void combine(TransactionRecord record)
        balance = (getBalance() + record.getAmount()); 
      } // end method combine
    } // end class AccountRecord -------------------------------------------------------------------------------------------------
    // Exercise 14.8: FileMatch.java
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.lang.IllegalStateException;
    import java.util.NoSuchElementException;
    import java.util.Scanner;
    import java.util.Formatter;
    import java.util.FormatterClosedException;
    import org.egan.AccountRecord;
    import org.egan.TransactionRecord;
    public class FileMatch
      private Scanner inTransaction;
      private Scanner inOldMaster;
      private Formatter outNewMaster;
      private Formatter theLog;
      // enable user to open file
      public void openTransFile()
        try
          inTransaction = new Scanner(new File("trans.txt"));
        } // end try
        catch (FileNotFoundException fileNotFoundException)
          System.err.println("Error opening file.");
          System.exit(1);
        } // end catch
      } // end method openTransFile
      // enable user to open file
      public void openOldMastFile()
        try
          inOldMaster = new Scanner(new File("oldmast.txt"));
        } // end try
        catch (FileNotFoundException fileNotFoundException)
          System.err.println("Error opening file.");
          System.exit(1);
        } // end catch
      } // end method openOldMastFile
      // enable user to open file
      public void openNewMastFile()
        try
          outNewMaster = new Formatter("newmast.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openNewMastFile
      // enable user to open file
      public void openLogFile()
        try
          theLog = new Formatter("log.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openLogFile
      // update records
      public void updateRecords()
        TransactionRecord transaction = new TransactionRecord();
        AccountRecord account = new AccountRecord();
        try // read records from file using Scanner object
          System.out.println("Start file matching.");
          while (inTransaction.hasNext() && inOldMaster.hasNext())
            transaction.setAccount(inTransaction.nextInt());     // read account number
            transaction.setAmount(inTransaction.nextDouble());   // read amount
            account.setAccount(inOldMaster.nextInt());     // read account number
            account.setFirstName(inOldMaster.next());      // read first name 
            account.setLastName(inOldMaster.next());       // read last name
            account.setBalance(inOldMaster.nextDouble());  // read balance
            if (transaction.getAccount() == account.getAccount())
              while (inTransaction.hasNext() && transaction.getAccount() == account.getAccount())
                account.combine(transaction);
                outNewMaster.format("%d %s %s %.2f\n",
                account.getAccount(), account.getFirstName(), account.getLastName(),
                account.getBalance());
                transaction.setAccount(inTransaction.nextInt());     // read account number
                transaction.setAmount(inTransaction.nextDouble());   // read amount
            else if (transaction.getAccount() != account.getAccount())
              outNewMaster.format("%d %s %s %.2f\n",
              account.getAccount(), account.getFirstName(), account.getLastName(),
              account.getBalance());         
              theLog.format("%s%d","Unmatched transaction record for account number ",transaction.getAccount());
          } // end while
          System.out.println("Finish file matching.");
        } // end try
        catch (NoSuchElementException elementException)
          System.err.println("File improperly formed.");
          inTransaction.close();
          inOldMaster.close();
          System.exit(1);
        } // end catch
        catch (IllegalStateException stateException)
          System.err.println("Error reading from file.");
          System.exit(1);
        } // end catch   
      } // end method updateRecords
      // close file and terminate application
      public void closeTransFile()
        if (inTransaction != null)
          inTransaction.close();
      } // end method closeTransFile
      // close file and terminate application
      public void closeOldMastFile()
        if (inOldMaster != null)
          inOldMaster.close();
      } // end method closeOldMastFile
      // close file
      public void closeNewMastFile()
        if (outNewMaster != null)
          outNewMaster.close();
      } // end method closeNewMastFile
      // close file
      public void closeLogFile()
        if (theLog != null)
          theLog.close();
      } // end method closeLogFile
    } // end class FileMatch-------------------------------------------------------------------------------------------------
    // Exercise 14.8: FileMatchTest.java
    // Testing class FileMatch
    public class FileMatchTest
       // main method begins program execution
       public static void main( String args[] )
         FileMatch application = new FileMatch();
         application.openTransFile();
         application.openOldMastFile();
         application.openNewMastFile();
         application.openLogFile();
         application.updateRecords();
         application.closeLogFile();
         application.closeNewMastFile();
         application.closeOldMastFile();
         application.closeTransFile();
       } // end main
    } // end class FileMatchTest-------------------------------------------------------------------------------------------------
    Sample data for master file:
    Master file                         
    Account Number            Name                     Balance
    100                            Alan Jones                   348.17
    300                            Mary Smith                    27.19
    500                            Sam Sharp                   0.00
    700                            Suzy Green                   -14.22Sample data for transaction file:
    Transaction file                    Transaction
    Account Number                  Amount
    100                                         27.14
    300                                         62.11
    300                                         83.89
    400                                         100.56
    700                                         80.78
    700                                         1.53
    900                                         82.17  -------------------------------------------------------------------------------------------------
    My FileMatch class program above has bugs in it.
    The correct results for the newmast.txt:
    100  Alan  Jones  375.31
    300  Mary  Smith  173.19
    500  Sam  Sharp  0.00
    700  Suzy Green  68.09The correct results for the log.txt:
    Unmatched transaction record for account number 400Unmatched transaction record for account number 900------------------------------------------------------------------------------------------------
    My results for the newmast.txt:
    100 Alan Jones 375.31
    300 Mary Smith 111.08
    500 Sam Sharp 0.00
    700 Suzy Green -12.69My results for the log.txt
    Unmatched transaction record for account number 700-------------------------------------------------------------------------------------------------
    I am not sure what is wrong with my code above to make my results different from the correct results.
    Much help is appreciated. Please help.

    From the output, it looks like one problem is just formatting -- apparently you're including a newline in log entries and not using tabs for the newmast output file.
    As to why the numbers are off -- just from glancing over it, it appears that the problem is when you add multiple transaction values. Since account.combine() is so simple, I suspect that you're either adding creating transaction objects incorrectly or not creating them when you should be.
    Create test input data that isolates a single case of this (e.g., just the Mary Smith case), and then running your program in a debugger or adding debugging code to the add/combine method, so you can see what's happening in detail.
    Also I'd recommend reconsidering your design. It's a red flag if a class has a name with "Create" in it. Classes represent bundles of independant state and transformations on that state, not things to do.

  • Please help with File input!

    This is my first time dealing with file I/O and need help figuring out the best way to read in data and store it for further manipulation. I have a file that contains an individual's salary, and 3 product ratings on each line, such as: 75000 01 05 09
    What is the best way to store this data? I know how to use BufferedReader and how to tokenize each integer. I must write this program to deal with any number of lines in a file. There are three income brackets, and I must also be able to perform the following calculations:
    a) For each income bracket, the average rating for each product
    b) The number of persons in Income Bracket $50000-74000 that rates all three products with a score of 5 or higher.
    c) The average rating for Product 2 by persons who rated Product 1 lower than Prodcut 3.
    Thus far, I've written the following code to open the file and perform 2 reads to get the total number of lines (individuals) and the total number of inidividuals in each income bracket. It compiles, but I get a null pointed exception at StringTokenizer, for some reason.
    Please help! Do I need to take lines in as arrays? (tried this, but don't understand how to get at individual data) Do I need to somehow create objects for each person (if so, how?). My reference text covers this area poorly. Thanks for all help.
    import java.io.*;
    import java.util.*;
    public class Product_Survey
         public static void main(String [] args)
              int lineCount = 0;
              int inc1total = 0;
              int inc2total = 0;
              int inc3total = 0;
              String name = null;
              System.out.println("Please enter income and product info file name:  ");
              Scanner keyboard = new Scanner(System.in);
              name = keyboard.next();
              File fileObject = new File(name);
              while ((! fileObject.exists()) || ( ! fileObject.canRead()))
                   if( ! fileObject.exists())
                        System.out.println("No such file");
                   else
                        System.out.println("That file is not readable.");
                        System.out.println("Enter file name again:");
                        name = keyboard.next();
                        fileObject = new File(name);                    
              try
                   BufferedReader inputStream = new BufferedReader(new FileReader(name));
                   String trash = "No trash yet";
                   while (trash != null)
                        trash = inputStream.readLine();
                        lineCount++;
                   inputStream.close();
              catch(IOException e)
                   System.out.println("Problem reading from file.");
              try
                   BufferedReader inputStream = new BufferedReader(new FileReader(name));
                   String trash = "No trash yet";
                   while (trash != null)
                        trash = inputStream.readLine();
                        StringTokenizer st = new StringTokenizer(trash);
                        int income = Integer.parseInt(st.nextToken());
                        if(income<50000)
                             inc1total++;
                        else if(income<75000)
                             inc2total++;
                        else if(income<100000)
                             inc3total++;
                   inputStream.close();
              catch(IOException e)
                   System.out.println("Problem reading from file.");
    }

    Try adding a print statement to see what is happening in your second read loop:
                while (trash != null)
                    trash = inputStream.readLine();
                    System.out.println("trash = " + trash);
                    StringTokenizer st = new StringTokenizer(trash);Another way to read in a while loop:
                while ((trash = inputStream.readLine()) != null)

  • Work with Files in Java

    Hello!
    Can anyone help me. How can I API in Java Technology for files to find ?

    don't uite understand your question.
    here's the location of java API for File class, for working with File and Directory..
    http://java.sun.com/j2se/1.3/docs/api/java/io/File.html
    for reading and writing..you may want to look at th eio package for classes such as
    Reader, FileReader, BufferedReader, Writer, FileWriter, BufferedWriter
    here's java API
    http://java.sun.com/j2se/1.4.2/docs/api/

  • Im DROWNING! need help with a simple java assignment! plz someone help me!

    i need help with my java assignment, with validating a sin number. easy for must who know java. im drowning... please help!

    You will need to store each digit of the social insurance number in a field of its own. To validate the entry you will:
    1. Multiply the 2nd, 4th, 6th and 8th digit by 2.
    2. If the product of any of the four multiplications result in a value greater than 9, add the two resulting digits together to yield a single-digit response. For example 6 * 2 = 12, so you would add the 1 and the 2 to get a result of 3.
    3. Add these four calculated values together, along with the 1st, 3rd, 5th, and 7th digits of the original number.
    4. Subtract this sum from the next highest multiple of 10.
    5. The difference should be equal to the 9th digit, which is considered the check digit.
    Example of validating S.I.N. 765932546
    1st digit 7
    2nd digit (6*2 =12 1+2=) 3
    3rd digit 5
    4th digit (9*2 = 18 1+8 =) 9
    5th digit 3
    6th digit (2*2 = 4) 4
    7th digit 5
    8th digit (4*2 = 8) 8
    Total 44 next multiple of 10 is 50
    50-44 = 6 which is the 9th digit
    Therefore the S.I.N. 765932546 is Valid
    ********* SIN Validation *********
    Welcome - Please enter the first number: 120406780
    Second digit value multiplied by 2 4
    Fourth digit value multiplied by 2 8
    Sixth digit value multiplied by 2 12
    Eighth digit value multiplied by 2 16
    Value derived from 6th digit 3
    Value derived from 8th digit 7
    The total is 30
    Calculated digit is 10
    Check digit must be zero because calculated value is 10
    The SIN 120406780 is Valid
    this is my assignemtn this is what i have! i dont know where to start! please help me!
    /*     File:     sinnumber.java
         Author:     Ashley
         Date:     October 2006
         Purpose: Lab1
    import java.util.Scanner;
    public class Lab1
              public static void main(String[] args)
                   Scanner input = new Scanner(System.in);
                   int sin = 0;
                   int number0, number1, number2, number3, number4, number5, number6, number7, number8;
                   int count = 0;
                   int second, fourth, sixth, eighth;
                   System.out.print("\t\n**********************************");
                   System.out.print("\t\n**********SIN Validation**********");
                   System.out.print("\t\n**********************************");
                   System.out.println("\t\nPlease enter the First sin number: ");
                   sin = input.nextInt();
                   count = int.length(sin);     
                   if (count > 8 || count < 8)
                   System.out.print("Valid: ");
         }

  • Looking for Help with Hyperion to JAVA

    I am looking for help with connecting Hyperion to Java. We are in Maryland but would be willing to work out something for remote consulting. If you have experience with connecting web services, hyperion, and Java and would be interested in about 80 hours of consulting please contact me at:[email protected] x4846

    Hi,
    From your description, you want to achieve the following goal:
    Configure Exchange to filter the attachments if the size is over 10 MB and store it in a public folder, and then forward the email to Salesforce.
    Based on my knowledge, I'm afraid that it can't be achieved. Exchange can filter messages with attachments, but it couldn't store these attachments on public folder automatically. Also, I don't see any transport rule can do it.
    Hope my clarification is helpful.
    Best regards,
    Amy Wang
    TechNet Community Support

  • Help with LabView and Java

    Hi any help would be greatly appreciated: I have the following JAVA code:
    //File: Hello.java
    class Hello {
     public native void Steve();
     static {
      System.loadLibrary("steve");
     public static void main(String[] args) {
      Hello h = new Hello();
      h.Steve();
    It finds the loadLibrary fine, but I get the following error message:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: Steve
    at Hello.Steve(Native Method)
    at Hello.main(Hello.java:10)

    Okay......
    Where does Labview fit into this question?

  • Help with a SIMPLE java thing

    I've only got ONE handful of hair left.
    I'm trying to build a series of dropdown boxes; a day dropdown (Mon, Tue, Wed...), a month dropdown (Jan, Feb, Mar...), a year dropdown, hour dropdown, minute dropdown, and an am/pm dropdown.
    I think I want to build my dropdowns using "for" loops something like this:
    for (i=0;i<12;i++) {
    myStringBuffer.append("<option>" + [someUnknownFunctionThatReturnsTheFirstThreeLettersOfTheMonth(i)] + "</option>")
    I've been trying to mix up various combinations of Date objects (most date functions seem to be depreciated), Calendar Objects, DateFormat Objects and SimpleDateFormat Objects but nothing seems to want to perform the function that I need.
    I've had iffy success creating a calendar object, setting the Month to "i", using the getTime function to return a Date object which I can then pass to the SimpleDateFormat object using the .format(Date) function, after setting the pattern to "EEE", but it seems like just an incredibly complicated way to do what ought to be a simple function...i.e. convert a number 0-11 (or 1-12, I'm not picky) into the name of a stinking Month! Arrgh.
    If anyone can help, I thank you.

    I've done that before, so i'll share it with you.
    import java.text.SimpleDateFormat;
    import java.text.DateFormatSymbols;
    import java.util.Calendar;
    import java.util.Date;
    public String createListOfMonth(String pName) {
    StringBuffer sbMonth = new StringBuffer();
    DateFormatSymbols fm = new DateFormatSymbols();
    String[] arrMonth = fm.getMonths();
    sbMonth.append("<select name=\"" + pName + "\">");
    sbMonth.append("     <option value=\"\">Month</option>\n");
    for (int i=0; i<arrMonth.length; i++) {
    if (!arrMonth.trim().equals("")) {
    String sValue = "0000" + (i + 1);
    sValue = sValue.substring(sValue.length() - 2);               
    sbMonth.append("     <option value=\"" + sValue + "\">" + arrMonth[i] + "</option>\n");
    sbMonth.append("</select>");
    return (sbMonth.toString());
    You can manipulate the symbol (either for months, days) using different locale. You can see the API for java.text.DateFormatSymbols in Java2 SE.
    Regards,
    Hariyanto

  • Need help with long term Java problems

    I've been having problems with Java on my computer for about a year now, and I'm hoping that someone here can help me out.
    Java used to work fine on the computer when I first got it (a Dell laptop) and I hadn't installed anything myself. But then one day it stopped loading Java applets, and hasn't worked since. By this, I mean that I get the little colorful symbol in a box when I try to play Yahoo games, use the http://www.jigzone.com site, go to chat rooms, etc. Java menus on websites like http://www.hartattack.tv used to work still, but lately they've been giving me that symbol too.
    I've tried downloading a newer version of Java, but nothing I do seems to work, and I don't know of anything I did to trigger it not working. I'm hoping there's a simple solution to this, and I'm just dumb.
    Thanks.

    This might be way off, but it's something that's tripped me up in the past:
    If you are using Sun's Java plugin, the first time you go to a site that has a particular Java applet, you may be asked to approve/reject a security request.
    If you have clicked on any other windows while the request is first being loaded (which can take some time, because this is swing based), then the security dialog box does not pop to the top of the window stack, and doesn't add an entry into the task bar.
    It appears that Java just doesn't work, but it's actually waiting for you to click "Yes". You can check this by hitting alt-tab and seeing if the Java coffee cup icon is one of the options.
    - K

  • Help with file management

    Well I am just starting my first project using FCP and can see that it is going to be a learning curve after coming over from PPro.
    One thing that I have been unable to find is just how to keep track of which clips have been used in the timeline, and how many times. In Premiere Pro I had the option to show video and audio usage for each clip in the browser.
    Have not found how to do this yet in FCP.
    Hope someone can help with this....
    Thanks
    Kirk

    Guess that I just have to get used to how it is done in FCP. I have over 1,500 clips in about 30 folders and it would sure make it easy if I could just glance at a clip in the browser and see if it has been used.
    Thanks for the tip on the duplicate frames though. That is going to help to identify duplicate clips once they are placed in the timeline.
    Sure seems like a lot of time spent identifying if a clip is already used though. As I look through the clips in the browser I guess there is no way to tell if they have been used other than put them in the timeline or use the search function.
    Still learning here.
    Thanks
    Kirk

  • I need help with File Object in Java

    Hello Experts.
    I am learning Java 2 now. I have trouble with reading a JTextField and save it to a file. I have some errors that I dont know what they are. I would like someone please help me to write a short sample program to see how it work. The code from the book I have dont execute at all. And I want to use FileOutputStream and ObjectOutputStream. Thank you very much
    Quoc

    import java.io.*;
    public class FileTest {
      public static void main(String[] arg) throws Exception{
        FileOutputStream fileOut = new FileOutputStream("test.txt");
        fileOut.write("Test file".getBytes());
        fileOut.close();

  • I need help with looping a java file

    I am wondering is it possable to loop a java file. By this i mean re-run it again from a particular point in the program. Like where i have marked out below.
    import java.util.*;
    public class Player
    public static void main(String[] args){
    Songs listing = new Songs();
    Player gui = new Player();
    listing.readarray();
    // I would like to loop it here once the option has been selected.
    Scanner myScanner = new Scanner(System.in);
    int option1;
    System.out.println("--------Options-------");
    System.out.println(" ");
    System.out.println("Type Option Number ");
    System.out.println(" ");
    System.out.println("1 :View Songs");
    System.out.println("2 :View Playlist");
    System.out.println("3 :Edit Playlist");
    System.out.println("4 :Play Playlist");
    System.out.println(" ");
    System.out.println("What option would you like?");
    option1 = myScanner.nextInt();
    if (option1 == 1)
    listing.disparray();

    import java.util.*;
    public class Player
    public static void main(String[] args){
    Songs listing = new Songs();
    Player gui = new Player();
    listing.readarray();
    *while (true)*
    // I would like to loop it here once the option has been selected.
    Scanner myScanner = new Scanner(System.in);
    int option1;
    System.out.println("--------Options-------");
    System.out.println(" ");
    System.out.println("Type Option Number ");
    System.out.println(" ");
    System.out.println("1 :View Songs");
    System.out.println("2 :View Playlist");
    System.out.println("3 :Edit Playlist");
    System.out.println("4 :Play Playlist");
    System.out.println(" ");
    System.out.println("What option would you like?");
    option1 = myScanner.nextInt();
    if (option1 == 1)
    listing.disparray();
    }}

  • Need help with running a Java program on Linux

    I am trying to get a Java program to run on a Linux machine. The program is actually meant for a Mac computer. I want to see if someone with Java experience can help me determine what is causing the program to stall. I was successful in getting it installed on my Linux machine and to partially run.
    The program is an interface to a database. I get the login screen to appear, but then once I enter my information and hit enter the rest of the program never shows, however, it does appear to connect in the background.
    Here is the error when I launch the .jar file from the command screen:
    Exception in thread "main" java.lang.IllegalArgumentException: illegal component position
    at java.awt.Container.addImpl(Unknown Source)
    at java.awt.Container.add(Unknown Source)
    I am not a programmer and I am hoping this will make some sense to someone. Any help in resolving this is greatly appreciated!

    Well, without knowing a little bit about programming, and how to run your debugger, I don't think you're going to fix it. The IllegalArgumentException is saying that some call does not like what it's getting. So you'll have to go in an refactor at least that part of the code.

  • I need some help with sound in Java

    hi, i`m new to java. i`m having a through problems with a program i`m writing. i`ve added a song to an applet but it does not play. The code for this is:
    private AudioClip music;
    music = getAudioClip(
    getDocumentBase(), "titantic.wav" );
    Can some 1 tell me is that the write code. please help.

    2 things.
    1. You must also send a command to play the music file.
    2. I'm not certain, but I think that you can only load .au files this way.

  • Help with JAI in java applet

    I'm fairly inexperienced with java, but I'm hopeful someone here won't mind helping.
    I am using netbeans and have a project to let a user upload files or scan them in with a usb scanner. I've imported icepdf to the libraries and referenced it in the jnlp file and it worked fine. I did the same with jai_windows-i586.jar and I get this error when trying to upload
    Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: com/sun/media/jai/codec/SeekableStream
    Caused by: java.lang.ClassNotFoundException: com.sun.media.jai.codec.SeekableStream
    I expanded the jar file and found it contained an exe. jai-1_1_3-lib-windows.i586.jre.exe. I found that if I run that exe [(found here)|http://download.java.net/media/jai/builds/release/1_1_3/] on any pc locally, I will not get the errors on that pc.
    Am I referencing it incorrectly?
    <resources>
    <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" max-heap-size="1024m" />
    <jar href="ScanAreaUI.jar" main="true" />
    <jar href="icepdf-core.jar"/>
    <jar href="jai_windows-i586.jar"/>
    <nativelib href="JTwain-Native.jar" />
    </resources>
    Do I need to make the applet install the exe located in the jar? I've tried to find information on how to do that without much luck so far.
    Thanks for any advice/help.

    If it's not finding your "exe" file, then you have an OS path problem. You can either change your path variable in Windows or you can move that "exe" to a location where you already have a path defined. You do realize that when you use features of JAI that are not incorporated in to the JDK, you'll have to have the JAI package loaded on every machine you ever want to run your project.

Maybe you are looking for

  • How to fetch the BCC address using java mail

    Hi, I want to extract the mail address given in the Bcc address field of an email which I fetch it from the IMAP store !! I will be very much thankful if this problem is solved !! Thanks!!

  • V1.4.0 on W95

    I tried to install Java SDK V1.4.0 (with Forte) on a 486/W95 machine by offline execution of the self extracting installation file. All appeared to work, there were no error messages and it informed me that the installation was successful. The instal

  • Variable  Vlaue restriction in a query

    Hi, I have an order type variable  (0COORD_TYPE) as a part slection criteria in the query . The Requirement is I want to have the variable for order type have a default that excludes the certain order types ,BUT the user can change to include if they

  • BPEL Correlation

    Hi All, I want to do some hands on in BPEL correlation. Can anyone suggest me where i can find about the basics of correlation concepts and tutorial on using Correlation in BPEL? Any help appreciated. Thanks & Regards, Ayyadurai

  • Enhancement during BAPI Call

    Hi All, I have created an enhancement in VL01N while creating Delivery. Now when I do manual Delivery the code is working fine . Enhancement gets triggred and the desired output is achived. But the problem comes when the I uase BAPI to create the Del