I don't understand how to use ObjectInputStream

When I compile the below program, it gives me a "grade_c.java:87: Exception java.lang.ClassNotFoundException must be caught, or it must be declared in the throws clause of this method.
                    String today = (String)s.readObject();"
error. Can anyone tell me what I'm doing wrong?
//Mini-Project Grade C, by Gopinath Chandran, (18.04.2003)
//Fixtures Database to store 2003 FA Cup Semi finals
//Import neeeded classes
import javax.swing.*;
import java.util.*;
import java.io.*;
public class grade_c
     //used to count how many fixtures have been added
     static int num_fixtures = 0;
     public static void main (String[] args) throws IOException
     {//main
          //used to store users input
          int choice = 0; //used to store menu option entered
          int fixture_replace = 0; //used to store which fixture to change
          //declare reference to an array
          Fixture array[];
          array = new Fixture[4];
               choice = menu();          
          //While the user hasn't selected quit
          while (choice != 6)
               //Run main menu
               //If user chooses to enter a new fixture
               if (choice == 1)
                    //Check to see if all fixtures have been entered
                    if (num_fixtures == 4)
                         fixture_replace = Integer.parseInt(JOptionPane.showInputDialog("All fixtures have been entered, please enter which fixture to be replaced (1-4):\n"));
                           array[fixture_replace-1].home = JOptionPane.showInputDialog("Pleae enter the home team for this fixture, eg. Arsenal:\n");
                         array[fixture_replace-1].away = JOptionPane.showInputDialog("Pleae enter the away team for this fixture, eg. Tottenham:\n");          
                         array[fixture_replace-1].day = Integer.parseInt(JOptionPane.showInputDialog("Please enter the day from the date of this fixture, eg 9 or 17:\n"));
                         array[fixture_replace-1].month = Integer.parseInt(JOptionPane.showInputDialog("Please enter the month from the date of this fixture, eg 3 or 10:\n"));
                    //If less than 4 fixtures have been entered, ask user to input new fixture
                    else
                         array[num_fixtures] = new Fixture();
                         num_fixtures = num_fixtures + 1;                         
               if (choice == 2)
                    for (int i = 0; i<num_fixtures; ++i)
                         System.out.print("\n");
                         array.printFixture();
               if (choice == 3)
                    for (int counter = 0; counter < (num_fixtures); counter++)
                         if (array[counter].home.equals("Arsenal"))
                              System.out.print("\n\nItem was found at position" + counter + ".");; // return position where found
                              System.out.print("\n" + array[counter].home);
                         else
                              System.out.print("\n\nItem not found at " + counter + "!");
                              System.out.print("\n" + array[counter].home);
               if (choice == 4)
                    FileInputStream in = new FileInputStream("theTime");
                    ObjectInputStream s = new ObjectInputStream(in);
                    String today = (String)s.readObject();
                    Fixture test1 = (Fixture)s.readObject();
               if (choice == 5)
                    FileOutputStream out = new FileOutputStream("theTime");
                    ObjectOutputStream s = new ObjectOutputStream(out);
                    s.writeObject("Today");
                    s.writeObject(new Fixture());
                    s.flush();
               choice = menu();
          //Exit process
          System.out.print("\n\n\n\n");
          System.exit(0);
     static int menu()
          //used to store users input
          String temp;
          int a;
          //Asks the user if they want to enter a new date
          temp = JOptionPane.showInputDialog(null, "FA Cup 2003 Quarter Finals Fixtures (c) Go-Pez-Go Productions 2003\n\nMain Menu:\n\n1. Enter new fixtures [" + (num_fixtures) + " entered]\n2. Print Fixtures Entered\n3. Search for a team\n4. Load fixtures\n5. Save fixtures\n6. Quit\n");
          a = Integer.parseInt(temp);
          return a;     
class Fixture implements Serializable
     public String home;
     public String away;
     public int day;
     public int month;
     //Initialise a new Date object with the values passed
     public Fixture (String h, String a, int d, int m)
          home = h;
          away = a;
          day = d;
          month = m;
     public Fixture()
          home = JOptionPane.showInputDialog("Pleae enter the home team for this fixture, eg. Arsenal:\n");
          away = JOptionPane.showInputDialog("Pleae enter the away team for this fixture, eg. Tottenham:\n");          
          day = Integer.parseInt(JOptionPane.showInputDialog("Please enter the day from the date of this fixture, eg 9 or 17:\n"));
          month = Integer.parseInt(JOptionPane.showInputDialog("Please enter the month from the date of this fixture, eg 3 or 10:\n"));
     //method to print objects instance variables
     public void printFixture()
     System.out.print("\n" + home + " vs " + away + ", " + day + "/" + month + "/2003" + ".");

"grade_c.java:87: Exception java.lang.ClassNotFoundException must be caught"This error message is telling you to catch the exception. So...
try
  //your code
catch(java.lang.ClassNotFoundException exception)
  exception.printStackTrace();
}

Similar Messages

  • I don't understand how to use Dreamweaver CC free trial

    I know how to use to program but how do I start it? How do I get the screen where I build the website. I downloaded everything, says I have it, but when I try to use it it just brings me back to the adobe website. Please help.

    It is very hard to see what you have done and where it is going wrong.
    Basically, DWCC is no different to a boxed version, the main difference being the source of the installation files. On the one hand the source comes from a CD, the other from the Internet.
    The other difference is the way the program is authenticated. The boxed version has a serial number, the CC version is authenticated online.
    The questions to ask yourself for a properly functioning CC version
    1. Has the program installed properly
    2. Do I have the authorisation from Adobe to run the program.

  • Q: I don't understand how to use the teeth whitening tool in PSE 9.

    I've been going through the tutorials and following along pretty good but i got to the Perfect Portrait guided edit and didnt' get how to use the Teeth Whitening tool...it seems to select the teeth but then I'm lost....what am I supposed to do at that point after the marching ants are marching around the teeth?

    I’m not sure what’s going on, but obviously something is not happening.
    You could also try the dodge tool (keep pressing the letter O on your keyboard) until you see the blue dodge tool. No selection necessary.
    Enlarge your image to about 200% and use the square bracket keys to increase or decrease the cursor size to fit the area to be whitened. Set exposure in the options bar to about 50%. Gently brush over the teeth area until you get them as you like.

  • I don't understand how to use the volume control on the new iphone headphones

    I just bought the new style earphones for my iphone and it has a new volume control -- how does it work?  On the old one you just pushed up or down for volume control but now it just increases volume for the time you hold it down?  Does anyone know how to use this properly?

    I have had good success with the System Font Panel. Now all of a sudden, I only get part of it. Any suggestions on how to restore the entire panel? There are no change size options in the corners like in some dialog boxes. I was going to paste what I have here, but for some reason, paste is not available.

  • I don't understand how to use passbook on my 4s

    How do you use it???? I'm so confused!

    iOS- Using Passbook
    Please Get the iPhone User Manual for iOS 6

  • I don't understand how to use the System Font Panel with iMovie.

    I need an explanation of how the System Font Panel works. I guess there's a way to get some of those fonts to the iMovie Font Panel, but I can't see how.
    Thank you.

    I have had good success with the System Font Panel. Now all of a sudden, I only get part of it. Any suggestions on how to restore the entire panel? There are no change size options in the corners like in some dialog boxes. I was going to paste what I have here, but for some reason, paste is not available.

  • I don't understand how to use the creative cloud, does the cloud app need to be installed?

    trying to download creative cloud nothing downloads when trying photoshop getting an error and say retry

    Yes, you need to install the Creative Cloud app first. It acts as your central hub for installation, sync and licensing.
    Mylenium

  • I don't understand how to 'warp paths'. Please help.

    Hey,
    Can someone help with me 'warping paths'. I don't understand how to do step 2 of this tutorial
    [url]http://www.pegaweb.com/tutorials/moonbase/moonbase-website-layout-1.htm[/url]
    It asks you to pick a foreground color, use the pen tool and make a traingle with the points, completing your last point by clicking on the first and completing the loop.
    Then it wants you to go to Ctrl+Click on the path, add a few new points, and drag them around to warp the path but I cannot warp it like in the tutorial. I just get some random shapes and inversion of foreground color and white.
    How do I do step 2?
    Thanks.

    Those are basic path adjustments. With the pen tool selected, you Ctrl+click on the path to make sure it's selected and then click on the path a couple of times with the Pen tool to add some anchor points which you then modify
    Path segments, components, and points
    http://help.adobe.com/en_US/Photoshop/11.0/WSfd1234e1c4b69f30ea53e41001031ab64-7390a.html
    Convert between smooth points and corner points
    http://help.adobe.com/en_US/Photoshop/11.0/WS7EE0B5C9-A95D-465d-BFEC-2149F76CEFB9a.html
    Adjust path segments
    http://help.adobe.com/en_US/Photoshop/11.0/WS068CF4C8-5B1A-463a-99F5-151F2EFEB38D.html

  • Don't understand how to transfer from iWeb to personal website

    I have created a website on iWeb but I don't understand how to transfer it to my own domain name through my university. I'm not very good with technology and don't really understand what an FTP is. Is that what I would use Dreamweaver for? So confused, help!

    I have created a website on iWeb but I don't understand how to transfer it to my own domain name through my university. I'm not very good with technology and don't really understand what an FTP is. Is that what I would use Dreamweaver for?
    No, you should not use Dreamweaver. A good ftp program is Cyberduck.
    http://cyberduck.ch/
    You publish your site to a folder and then upload it with Cyberduck. I recommend you ask the IT Help desk of your university about how best to do this.

  • HT201320 I don't understand how to transfer my email contacts from my Windows laptop to my iPhone? What do I need to do?

    I don't understand how to transfer my email contacts from my Windows laptop to my iPhone? What do I need to do?

    Hey wahanz!
    In order to sync your Windows contacts to your iPhone, you will need to first create an iCloud account:
    Creating an iCloud account: Frequently Asked Questions
    http://support.apple.com/kb/ht4436
    You will create the iCloud account on your iOS device, and when you do, don’t forget to turn on contact syncing in the initial setup. Then you will want to download the iCloud control panel for Windows onto your computer and install it:
    iCloud Control Panel 3.1 for Windows
    http://support.apple.com/kb/dl1455
    Make sure that your contacts are in Outlook, as that is the supported way of syncing your contacts to iCloud, then make sure you have the contact syncing enabled in the iCloud control panel on your computer, and when the contacts have synced, they will be available on your iOS device! Thanks for using the Apple Support Communities. Have a good one!
    -Braden

  • Excuse me, but I don't understand How I can contact a ADOBE expert to ask about my problem? I don't found a mail, or chat or other else...is it possible? Only help for Customer is on the Forum?!?!?

    Excuse me, but I don't understand How I can contact a ADOBE expert to ask about my problem? I don't found a mail, or chat or other else...is it possible? Only help for Customer is on the Forum?!?!?
    Someone can help me...thanks in advance.
    f

    While it is possible you have a faulty unit I'd agree that the menu system took a step backwards with the itunes store centric take 2.0+ software. I think I'm in the minority here though. Apart from the 2.0+ top level interface being butt ugly and confusing to navigate, it simply isn't as responsive as 1.0/1.1 and I think most of this is to do with displaying a combined sync/stream menu. if you sync stuff try setting 'show only synced items' in the AppleTv device tabs in iTunes and see if it makes the issue go away - easy to revert back.
    Huge libraries (number of files not actual size of the files) can also be problematic given AppleTV's modest hardware specs but that's more exception than the rule.
    With streaming/syncing combined I also think any network deficiencies show up more than they used to.

  • When we try to buy a new app or update our existing apps, my account settings wont allow me to enter ANY of my credit cards.  It says to contact apple/itunes/support, but when I do, I don't understand how to navigate it to find an answer.  Help!

    when we try to buy a new app or update our existing apps, my account settings wont allow me to enter ANY of my credit cards.  It says to contact apple/itunes/support, but when I do, I don't understand how to navigate it to find an answer.  Help!

    Click here and ask the iTunes Store staff for assistance.
    (108048)

  • Hi fellow apple guys, i have this problem. Hope you can help me. I don't know how to use the function keys (F1 to F12) on my macbook air. Pls help

    Hi fellow apple guys, i have this problem. Hope you can help me. I don't know how to use the function keys (F1 to F12) on my macbook air. Pls help

    Out of the box, to use the function keys as function keys, hold down the fn key when you press the key. Otherwise, you get the picture function on the key. You can reverse this behavior in the Keyboard system prefs.

  • Gantt chart: Don't know how to use the tooltipkeys and toolkeylabel

    I have a problem. Don't know how to use the tooltipkeys and toolkeylabel. I used jquery to select the gantt bars and on mouse over i was getting the task id "tid" then passing it to adf bean with serverlistener and showing a popup that is adf component with javascript. For positioning of the popup I used a button that has width and height 0 and has position absolute and gets the coordinates of the mouse.
    "div[et]" is a jquery selector that selects all the elements that have attribute et. I noticed that all the bars have that attribute as a few other attributes as well "part"...
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
            xmlns:dvt="http://xmlns.oracle.com/dss/adf/faces">
        <af:document title="untitled1.jsf" id="d1">
            <af:resource type="javascript" source="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"/>
            <af:resource type="javascript" source="resources/js/home.js"/>
            <af:messages id="m1"/>
            <af:form id="f1">
               <af:commandButton text="commandButton 1" id="cb1" inlineStyle="visibility:hidden; width:0; height:0" />
                <af:popup id="noteWindow" contentDelivery="lazyUncached" binding="#{homeBean.popup}">
                    <af:noteWindow id="popupWindow">
                        <af:panelFormLayout id="pfl2">
                            <af:panelLabelAndMessage label="Task id" id="plam5">
                                <af:outputText value="#{homeBean.taskId1}" id="ot64"/>
                            </af:panelLabelAndMessage>
                            <af:panelLabelAndMessage label="Start Location Name" id="plam6">
                                <af:outputText value="#{homeBean.startLocation}" id="ot7"/>
                            </af:panelLabelAndMessage>
                            <af:panelLabelAndMessage label="Stop Location Name" id="plam7">
                                <af:outputText value="#{homeBean.stopLocation}" id="ot8"/>
                            </af:panelLabelAndMessage>
                            <af:panelLabelAndMessage label="tasktype" id="pla2m7">
                                <af:outputText value="#{homeBean.taskType}" id="ot9"/>
                            </af:panelLabelAndMessage>
                        </af:panelFormLayout>
                    </af:noteWindow>
                </af:popup>
                <af:serverListener type="jsServerListener" method="#{homeBean.serverEventHandler}"/>
                <dvt:schedulingGantt id="gantt1" value="#{bindings.PersonView1.schedulingGanttModel}" var="row"
                                     startTime="2011-07-04 00:00:00" endTime="2011-07-04 23:00:00" summary="gsg"
                                     showMenuBar="false" showToolbar="false" iconPlacement="left"
                                     showTasksAsDailyBar="false">
                    <f:facet name="major">
                        <dvt:timeAxis scale="days" id="ta1"/>
                    </f:facet>
                    <f:facet name="minor">
                        <dvt:timeAxis scale="hours" id="ta2"/>
                    </f:facet>
                    <f:facet name="nodeStamp">
                        <af:column sortProperty="#{bindings.PersonView1.hints.PersonId.name}" sortable="false"
                                   headerText="#{bindings.PersonView1.hints.PersonId.label}" id="c1">
                            <af:outputText value="#{row.PersonId}" id="ot1">
                                <af:convertNumber groupingUsed="false"
                                                  pattern="#{bindings.PersonView1.hints.PersonId.format}"/>
                            </af:outputText>
                        </af:column>
                    </f:facet>
                </dvt:schedulingGantt>            
            </af:form>
        </af:document>
    </f:view>javascript:
    $(document).ready(bindEvents());
    function bindEvents() {
        $("div[et]").live('mouseover', function (e) {
             $('#cb1').css("position", 'absolute');
             $('#cb1').css("top", e.pageY-4);
             $('#cb1').css("left", e.pageX);
            var popup = AdfPage.PAGE.findComponentByAbsoluteId("noteWindow");
            var element = AdfPage.PAGE.findComponent("f1");
            var taskIdToPass = null;
            if ($(this).attr("tid") !=undefined) {
                 taskIdToPass = $(this).attr('tid').toString();
            } else {
                taskIdToPass = $(this).parent().attr('tid').toString();
            var param = {            taskId : taskIdToPass        };
            AdfCustomEvent.queue(element, "jsServerListener", param, true);
            if (!popup.isPopupVisible()) {
                var hints = {};
                hints[AdfRichPopup.HINT_LAUNCH_ID] = "cb1";
                hints[AdfRichPopup.HINT_ALIGN_ID] =  "cb1";
                hints[AdfRichPopup.HINT_ALIGN] = AdfRichPopup.ALIGN_AFTER_START;
                popup.show(hints);
        }).live("mouseout", function () {
            var popup = AdfPage.PAGE.findComponentByAbsoluteId("noteWindow");
            popup.hide();
    };My bean that is session bean:
    package view;
    import oracle.adf.model.BindingContext;
    import oracle.adf.model.binding.DCDataControl;
    import oracle.adf.view.rich.component.rich.RichPopup;
    import oracle.adf.view.rich.render.ClientEvent;
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.Key;
    import oracle.jbo.Row;
    import oracle.jbo.RowSetIterator;
    import oracle.jbo.ViewObject;
    public class HomeBean {
        private RichPopup popup;
        private String taskId1;
        private String startLocation;
        private String stopLocation;
        private long taskId;
        private String taskType;
        public HomeBean() {
            super();
        public void serverEventHandler(ClientEvent clientEvent) {    
            String taskIdString = clientEvent.getParameters().get("taskId").toString();
            this.taskId = Long.parseLong(taskIdString);
            DCDataControl dc1 = BindingContext.getCurrent().findDataControl("AppModuleDataControl");
            ApplicationModule am = dc1.getApplicationModule();
            ViewObject vo = am.findViewObject("PdTrfDayView1");  
            RowSetIterator rowSetIterator = vo.createRowSetIterator(null);
            Row[] rows = rowSetIterator.findByKey(new Key(new Object[] {taskId}), 1);
            Row row = rows[0];
           this.taskId1 =  row.getAttribute("PdTrfDayId").toString();
           this.startLocation = row.getAttribute("StartLocation").toString();
           this.stopLocation = row.getAttribute("StopLocation").toString();
           this.taskType = row.getAttribute ("PdTrfTypeId").toString();
            RichPopup.PopupHints ph = new RichPopup.PopupHints();
            vo.closeRowSetIterator();
        public long getTaskId() {
            return taskId;
        public void setPopup(RichPopup popup) {
            this.popup = popup;
        public RichPopup getPopup() {
            return popup;
        public String getTaskId1() {
            return taskId1;
        public String getStartLocation() {
            return startLocation;
        public String getStopLocation() {
            return stopLocation;
        public String getTaskType() {
            return taskType;
    }I am wondering If i can use setCurrentRow on the iterator that i create and use it for displaying on the popup instead of binding startLocation and stopLocation to the bean and if there is any benefit of that at all...
    Edited by: 897833 on Nov 24, 2011 11:37 AM

    Hi,
    To use tooltipkeys and tooltiplabel in gantt, you can add following code in managed bean
    public String[] getTooltipKeys()
    return new String[]{"columnA", "columnB", "StartDate", "EndDate"};
    public String[] getTooltipLabels()
    return new String[]{"A", "B", "Start Date", "End Date"};
    where , the string array in the ToolTipKeys represents the columns, of the table you have in the gantt component , and the string array in TooltipLabels displays the label you want to display for the table columns.
    In the jsff, you could call the bean methods as follows:
    tooltipKeys="#{GanttBean.tooltipKeys}"
    tooltipKeyLabels="#{GanttBean.tooltipLabels}"

  • How to use base band wave,subcarrier wave and carrier wave to creat the FM wave? When I use the MT Modulate FM VI in USRP,I don't konw how to use it.

    How to use base band wave,subcarrier wave and carrier wave to  creat  the FM wave? When I use the MT Modulate FM VI in USRP,I don't konw how to
    use it.

    https://decibel.ni.com/content/docs/DOC-24206
    Let us know if that example doesn't help you
    Anthony F.
    Product Marketing Engineer
    National Instruments

Maybe you are looking for