GradeBook class

I am creating a void method which accepts nams and grades from 1 to 20 students. The condition is that this should stop when the user is finished or when the array is full. I need to validate the grades to be only A, B, C, D, OR F
When I made the condition it shows me an error:
exception in thread "main" java.lang NullPointerException
at GradeBook.input(GradeBook.java:29)
at Program4.main(Program4.java:8)
my methods is as follow:
public void input()
final String LIMIT = "QUIT";
int index = 0;
System.out.println("\nPlease enter grades and names (Enter QUIT to stop). ");
System.out.println("\nStudent # " index " :");
names[index] = Keyboard.readString();
index++;
while (!(names[index].equals(LIMIT)))
count++;
System.out.print("Exam Score: ");
grades[index] = Keyboard.readChar();
while((grades[index] < 'A') && (grades[index] > 'D')||(grades[index]!=('F')))
System.out.println("\nINVALIDE GRADE. PLEASE REENTER. ");
grades[index] = Keyboard.readChar();
System.out.println("\nStudent # " index " : ");
names[index] = Keyboard.readString();
names[index] = names[index].toUpperCase();
index++;
Cold you help me to see the errors...?

Hi
Why do i get this error when trying to run a code like
this:By 'run' I assume you mean you are entering a command like "java App" and you get the error. That's because the code you posted does not include a "public static void main(String[] args)" method. A class must contain this method to be launched as an application using the java command. The code you posted is an Applet, normally run using a web browser and HTML code.

Similar Messages

  • GradeBook displayMessage error

    I am using jdk.5.0_18 but still I am getting the error that GradeBook class symbol not found in this simple code.
    public class DataGradeBook{
      public static void main(String args []){
        GradeBook xGradeBook = new GradeBook();
        xGradeBook.displayMessage();
    }

    "My fridge is broken."
    "Try plugging it in."
    "Oh, don't worry... It's a Kelvinator."
    "WTF?"
    You need to start communicating much more clearly or nobody will bother to help you. It's up to you.
    * Don't even talk to me until you've:
        (a) [googled it|http://www.google.com.au/] and
        (b) looked it up in [Sun's Java Tutorials|http://java.sun.com/docs/books/tutorial/] and
        (c) read the relevant section of the [API Docs|http://java.sun.com/javase/6/docs/api/index-files/index-1.html] and maybe even
        (d) referred to the JLS (for "advanced" questions).
    * [Good questions|http://www.catb.org/~esr/faqs/smart-questions.html#intro] get better Answers. It's a fact. Trust me on this one.
        - Lots of regulars on these forums simply don't read badly written questions. It's just too frustrating.
          - FFS spare us the SMS and L33t speak! Pull your pants up, and get a hair cut!
        - Often you discover your own mistake whilst forming a "Good question".
        - Many of the regulars on these forums will bend over backwards to help with a "Good question",
          especially to a nuggetty problem, because they're interested in the answer.

  • Absolute newbie question

    Folks,
    I'm talking a java class in my "spare time" and just getting started this week.
    I'm also very new to linux so it makes things tricky for me figuring out where my problems are.
    I'm copying code out of Deitel just to try to get something to compile...
    one class is as follows:
    // Fig. 3.11: GradeBookTest.java
    // GradeBook constructor use to specify the course name at the
    // time each GradeBook object is created.
    public class GradeBookTest
         // main method begins program execution
         public static void main( String args[] )
              // create GradeBook object
              GradeBook gradeBook1 = new GradeBook(
                   "CS101 Introduction to Java Programming" );
              GradeBook gradeBook2 = new GradeBook(
                   "CS102 Data Structures in Java" );
              // display initial value of courseName for each GradeBook
              System.out.printf( "gradeBook1 course name is: %s\n",
                   gradeBook1.getCourseName() );
              System.out.printf( "gradeBook2 course name is: %s\n",
                   gradeBook2.getCourseName() );
         } // end main
    } //end class GradeBookTest
    This code, and the GradeBook class it is supposed to test, both compile fine, but when I go to run it I get an error:
    Exception in thread "main" java.lang.NoSuchMethodError: method java.io.PrintStream.printf with signature (Ljava.lang.String;[Ljava.lang.Object;)Ljava.io.PrintStream; was not found.
       at GradeBookTest.main(java.lang.String[]) (Unknown Source)
    at gnu.java.lang.MainThread.call_main() (/usr/lib/libgcj.so.6.0.0)
    at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)
    This seems like a linking type of problem to me, but I'm not really comfortable enough with java or linux to figure out what my problem is.
    Do I need to set up some type of config file so java knows where to find the printf method or something?
    Thanks a lot in advance if you have an idea
    Ben

    it looks like what is in my /bin folder is a link to an executable. i'll dig through my linux book, but do you know offhand how i would go about updating that to point to the right version?
    thanks again, or for the first time since i forgot to say it before!
    Ben

  • Errors in the program

    Hi all,
    Im doing the extension of controller by adding additional functionality of submitting a concurrent program from OAF page. but im getting following errors .pls help
    Code:
    package petrofac.oracle.apps.ota.admin.enrollment.webui;
    import com.sun.java.util.collections.Vector;
    import oracle.apps.fnd.cp.request.ConcurrentRequest;
    import oracle.apps.fnd.cp.request.RequestSubmissionException;
    import oracle.apps.fnd.framework.OAException;
    import oracle.apps.fnd.framework.server.OADBTransaction;
    import oracle.apps.fnd.framework.server.common.OAApplicationModule;
    import oracle.apps.fnd.framework.webui.OAPageContext;
    import oracle.apps.fnd.framework.webui.beans.OAWebBean;
    import oracle.apps.ota.admin.enrollment.webui.LrnrEnrollmentMassUpdateCO;
    import oracle.jbo.ApplicationModule;
    public class ExtLrnrEnrollmentMassUpdateCO extends LrnrEnrollmentMassUpdateCO {
    public ExtLrnrEnrollmentMassUpdateCO() {
    * @param pagecontext
    * @param webbean
    public void processRequest(OAPageContext pagecontext, OAWebBean webbean)
    super.processRequest(pagecontext, webbean);
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    if (pageContext.getParameter("Apply") != null)
    String status = pageContext.getParameter("Enrollment Status");
    String CRname = pageContext.getParameter("Course Name");
    String CLname = pageContext.getParameter("Class Name");
    OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
    OADBTransaction tx = am.getOADBTransaction();
    java.sql.Connection pConncection = tx.getJdbcConnection();
    ConcurrentRequest cr = new ConcurrentRequest(pConncection);
    if (status.equals("Attended"))
    public int submitCPRequest(String CRname,String CLname) {
    try {
    String applnName = "OTA"; //Application that contains the concurrent program
    String cpName = "XXCERT"; //Concurrent program name
    String cpDesc = "Certifcate Program"; // concurrent Program description
    Vector cpParams = new Vector();
    cpParams.addElement(CRname);
    cpParams.addElement(CLname);
    int requestId = cr.submitRequest(applnName, cpName, cpDesc, null, false, cpParams);
    tx.commit();
    return requestId;
    catch (RequestSubmissionException e)
    OAException oe = new OAException(e.getMessage());
    oe.setApplicationModule((ApplicationModule)this);
    throw oe;
    else if (status.equals("Enrolled"))
    public int submitCPRequest(String CRname,String CSname)
    try {
    String applnName = "OTA"; //Application that contains the concurrent program
    String cpName = "XXJOINDTL"; //Concurrent program name
    String cpDesc = "Joining Details Program"; // concurrent Program description
    Vector cpParams = new Vector();
    cpParams.addElement(CRname);
    cpParams.addElement(CSname);
    int requestId = cr.submitRequest(applnName, cpName, cpDesc, null, false, cpParams);
    tx.commit();
    return requestId;
    catch (RequestSubmissionException e)
    OAException oe = new OAException(e.getMessage());
    oe.setApplicationModule((ApplicationModule)this);
    throw oe;
    Errors:
    Error(42,12): modifier public not allowed here
    Error(42,31): ; expected
    Error(14,49): Constants not found in interface oracle.apps.ota.common.Constants in interface oracle.apps.ota.admin.common.Constants in interface oracle.apps.ota.shared.enrollment.common.Constants in class oracle.apps.ota.shared.enrollment.webui.EnrollmentCO in class oracle.apps.ota.shared.enrollment.webui.EnrollmentUpdateCO in class oracle.apps.ota.admin.enrollment.webui.LrnrEnrollmentMassUpdateCO

    Ankit wrote:
    hi all i have a program which is written in the book but when i am writing it in Netbeans IDE then the program is showing lots of errors. Here is the program
    Please tell me what is the problem why it is creating an error.
    Package declaration missing here
    import java.util.Scanner;
    // Gradebook class that contains a courseName instance variable and methods to get and set its value.
    public class GradeBook
    private String courseName; // course name for this grade book
    // method to set the course name
    public void setCourseName(String name)
    courseName = name; // store the course name
    }//End method setCourseName
    //Method to retrieve the courseName
    public String getCourseName()
    return courseName;
    }//End method getCourseName
    //display a welcome message to the gradeBook user
    public void displayMessage()
    //This statement calls getCourseName to get the
    //name of the course this gradebook represents
    System.out.printf("Welcome to the gradeBook for\n%s!\n", getCourseName());
    package declaration/required imports missing here
    public class GradeBookTest
    public static void main(String []args)
    Scanner input = new Scanner( System.in );
    GradeBook myGradeBook = new GradeBook();
    System.out.printf("Initial course name is:%s\n\n",
    myGradeBook.getCourseName());Extra curly brace
    }//prompt for and read course name
    System.out.println("Please enter the course name:");Typo in method name. Its nextLine, not nextline
    String theName = input.nextline();Typo here, it should be myGradeBook (as instantiated above) and not myGradebook
    myGradebook.setCourseName(theName);
    System.out.println();
    myGradeBook.displayMessage();
    }Next time, try reading the errors the compiler throws, it has all the information you need to fix errors in your program.
    Edited by: maheshguruswamy on Dec 9, 2011 8:52 AM

  • Understanding vectors

    I do not quite understand vectors regardless of how many pages I read on them, I have been assigned this program in my java class, I have written the following code so far, some of it was given to me, such as the v.add(cr) in the student class, however I have no clue as to what exactly is in my vector, where it is, and how to pull the variables that I need from it, which is what I ultimately need to do. If someone could please shed some light and point me in the right direction I would appreciate it. I have three classes, gradebook(supplies a gui with 3 buttons, one of which adds a student who has characteristics and up to 5 courses, one button which is supposed to print everything about the students(which is nowhere near done yet, don't worry about that), and one just to exit. Here's my code.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class Gradebook extends JFrame
    private Button add;
    private Button print;
    private Button exit;
    float[] gpa_array=new float[5];
    private int num_students=0;
    Student[] stu=new Student[5];
    public Gradebook()
    super("Student/Course GUI");
    for(int a=0;a<5;a++)
    stu[a]=new Student();
    ButtonHandler handler = new ButtonHandler();
    Container cat = getContentPane();
    cat.setLayout(new FlowLayout());
    add = new Button("Add Student");
    add.addActionListener(handler);
    cat.add(add);
    print = new Button("Print");
    print.addActionListener(handler);
    cat.add(print);
    exit = new Button("Exit");
    exit.addActionListener(handler);
    cat.add(exit);
    setSize(800,600);
    setVisible(true);
    public class ButtonHandler implements ActionListener
    public void actionPerformed(ActionEvent e)
    if(e.getSource()== add)
    num_students++;
    stu[num_students].getData();
    else
    if(e.getSource() == print)
    System.out.println("Printing all courses and students");
    else
    if(e.getSource() == exit)
    System.exit(0);
    public static void main(String[] args)
    Gradebook app = new Gradebook();
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.Vector;
    public class Student
    private String name;
    private String stringage;
    private int age;
    private float gpa;
    private int num_courses;
    private String stringnum_courses;
    private int totalqp;
    private Vector v = new Vector();
        public Student()
    public void getData()
    name = JOptionPane.showInputDialog(null,"Enter Student's Name","Enter Student's Name", JOptionPane.QUESTION_MESSAGE);
    stringage = JOptionPane.showInputDialog(null,"Enter Student's Age","Enter Student's Age", JOptionPane.QUESTION_MESSAGE);
    age = Integer.parseInt(stringage);
    stringnum_courses = JOptionPane.showInputDialog(null,"Enter Number of Courses","Enter Number of Courses", JOptionPane.QUESTION_MESSAGE);
    num_courses = Integer.parseInt(stringnum_courses);   
    for(int a=0;a<num_courses;a++)
    Course cr = new Course();
    v.add(cr);
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class Course
        // instance variables - replace the example below with your own
        private int id;
        private String dept;
        private int credits;
        private String letter_grade;
        private String stringid;
        private String stringcredits;
        private int QP;
        public Course()
         getDept();
         getId();
         getCredits();
         getLettergrade();
         getQP();
        public void getDept()
           dept = JOptionPane.showInputDialog(null,"Enter Department","Enter Department", JOptionPane.QUESTION_MESSAGE);
    public void getId()
    stringid = JOptionPane.showInputDialog(null,"Enter Course ID","Enter Course ID", JOptionPane.QUESTION_MESSAGE);
    id = Integer.parseInt(stringid);
    public void getCredits()
    stringcredits = JOptionPane.showInputDialog(null,"Enter Credits","Enter Credits", JOptionPane.QUESTION_MESSAGE);
    credits = Integer.parseInt(stringcredits);
    public void getLettergrade()
    letter_grade = JOptionPane.showInputDialog(null,"Enter Letter Grade","Enter Letter Grade", JOptionPane.QUESTION_MESSAGE);
    public void getQP()
    if(letter_grade=="A")
    QP=4*credits;
    if(letter_grade=="B")
    QP=3*credits;
    if(letter_grade=="C")
    QP=2*credits;
    if(letter_grade=="D")
    QP=credits;
    if(letter_grade=="F")
    QP=0;
    }Here is the exact assignment just for any clarification purposes:
    3 classes
    Course
    Student
    Gradebook(main)
    The Main class will have 3 Buttons to control the following Events:
    1...Add student to system (initial data--name, gender, and course load (1 to
    5 courses))
    A Vector in the student class will be initially set to 5 courses for
    each of 5 possible students
    An array in the Gradebook class will hold references to each of the 5
    student objects
    2...Print all student data (along with gpa) High to low based upon gpa.
    3...Exit

    Hi could i solve your problem, how ever i understand you have a problem that what is stored in your vector and how to get from it... let me explain may you know it.
    well
    for(int a=0;a<5;a++)
    stu[a]=new Student();
    if(e.getSource()== add)
    num_students++;
    stu[num_students].getData(); ///specified student object
    for(int a=0;a<num_courses;a++)
    Course cr = new Course();
    v.add(cr);
    you are adding courses in the vector in the specified student object
    well other method of vector could be vector.addElement();
    'add' and 'addElement ' add an object type thing one after another....
    so your ' v ' vector object will contain courses object when you will get them you need to do type cast for example you have to do same for print button what you have done for add button but only here you will getting things.
    you will do below code in the student class by making new method ...
    if( v != null && v.size > 0)
    Courses objCourse = (Courses) v.elementAt(0);
    you can get all courses object by looping them to the size of the vector
    i hope this will work for what ever i understand your problem.
    Cheers
    ABId

  • Nube trying to create class in netbeans

    My husband and I have missed class because of being sick. We are way behind on our lessons which began without us. I have done simple scripting and some visual basic but Java is way new to me.
    We are using NetBeans for editing.
    I would rather assume that I know nothing rather than confusing myself with odd bits and pieces of information from past programming days.
    What I'm working on...
    The textbook "Java how to program" 6th ed. by Deitel", gives the fig. 3.1 as:
    1 // Fig. 3.1: GradeBook.java
    2 // Class declaration rith one method.
    3
    4 public class GradeBook
    5 {
    6 // display a welcome message to the GradeBook user
    7 public void displayMessage()
    8 {
    9 System.out.println( "Welcome to the Grade Book!" );
    10 } //end method displayMessage
    11
    12 } // end class GradeBook
    The program starts out after I select the template of Java Class by asking for a name to which I type in GradeBook then I select finish.
    What is created for me is a class on the left and the code on the right is:
    1 /*
    2 * GradeBook.java
    3 *
    4 * Created on March 29, 2005, 8:47 PM
    5 */
    6
    7 package examples;
    8
    9 /**
    10 *
    11 * @author mouthyturtle
    12 */
    13 public class GradeBook {
    14
    15 /** Creates a new instance of GradeBook */
    16 public GradeBook() {
    17 }
    18
    19 }
    1. Do I just fill in the comments from here?
    2. Do I save this before proceding?
    3. Should I have placed this in it's own folder rather than within the examples folder where it is now created?
    Mouthyturtle, turtle on a half shell.

    I recomend you not use netbeans just yet and use a plain editor.
    2. Do I save this before proceding?Unless I'm missing something, It would seam advicable.
    3. Should I have placed this in it's own folder rather than within
    the examples folder where it is now created?I'd create a folder for your projects to go into. But thats just me.
    http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html
    http://thejword.com/3.html#beginner_resources

  • Help with Declaring a Class with a Method and Instantiating an Object

    hello all i am having trouble understanding and completing a lab tutorial again!
    im supposed to compile an run this code then save work to understand how to declare aclass with a method an instantiate an object of the class with the following code
    // Program 1: GradeBook.java
    // Class declaration with one method.
    public class GradeBook
    // display a welcome message to the GradeBook user
    public void displayMessage()
    System.out.println( "Welcome to the Grade Book!" );
    } // end method displayMessage
    } // end class GradeBook
    // Program 2: GradeBookTest4.java
    // Create a GradeBook object and call its displayMessage method.
    public class GradeBookTest
    // main method begins program execution
    public static void main( String args[] )
    // create a GradeBook object and assign it to myGradeBook
    GradeBook myGradeBook = new GradeBook();
    // call myGradeBook's displayMessage method
    myGradeBook.displayMessage();
    } // end main
    } // end class GradeBookTest4
    i saved above code as shown to working directory filename GradeBookTest4.java
    C:\Program Files\Java\jdk1.6.0_11\bin but recieved error message
    C:\Program Files\Java\jdk1.6.0_11\bin>javac GradeBook4a.java GradeBookTest4.java
    GradeBookTest4.java:2: class, interface, or enum expected
    ^
    GradeBookTest4.java:27: reached end of file while parsing
    ^
    2 errors
    can someone tell me where the errors are because for class or interface expected message i found a solution which says 'class? or 'interface' expected is because there is a missing { somewhere much earlier in the code. i dont know what "java:51: reached end of file while parsing " means or what to do to fix ,any ideas a re appreciated                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Doesn't solve your problem, but this works for me...
    public class GradeBook
      public void displayMessage() {
        System.out.println( "Welcome to the Grade Book!" );
      public static void main( String args[] ) {
        try {
          GradeBook gradeBook = new GradeBook();
          gradeBook.displayMessage();
        } catch (Exception e) {
          e.printStackTrace();
    }

  • How do i open a web page with VeriSign Class 3 Extended Validation SSL SGC SS CA certfificate i can't open web pages with this, how do i open a web page with VeriSign Class 3 Extended Validation SSL SGC CA certfificate i can't open web pages with this

    how do i open a web page with VeriSign Class 3 Extended Validation SSL SGC SS CA ?

    Hi
    I am not suprised no one answered your questions, there are simply to many of them. Can I suggest you read the faq on 'how to get help quickly at - http://forums.adobe.com/thread/470404.
    Especially the section Don't which says -
    DON'T
    Don't post a series of questions in  a single post. Splitting them into separate threads increases your  chances of a quick answer.
    PZ
    www.pziecina.com

  • Previewing an image before uploading it using the FileReference class

    Previewing an image before uploading it using the FileReference class in flash player 3 not in SDK4

    Previewing an image before uploading it using the FileReference class in flash player 3 not in SDK4

  • Previewing an image before uploading it using the FileReference class in flex 3

    Previewing an image before uploading it using the FileReference class in flex 3 ?

    hai,
              when this code is used in my application ,i got the name of image and new frame is added each time .But image is not displayed.....
    The code  starts like this
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx" initialize="init()"   backgroundColor="white" width="100%" height="100%">
        <fx:Script>
    <![CDATA[ 
                    import mx.controls.Alert;
                    import mx.messaging.Channel;
                    import mx.messaging.ChannelSet;
                    import mx.messaging.channels.AMFChannel;
                    import mx.rpc.events.ResultEvent;
                    import mx.controls.Image;
                    import spark.events.IndexChangeEvent;
                    import mx.managers.DragManager;
      <mx:DataGridColumn headerText="Dimension Value"  width="10" dataField="dimensionValue"/>
                                                   <mx:DataGridColumn headerText="Unit Nmae"  width="10" dataField="dimensionUnitName"/>
                                                   </mx:columns>
                                           </mx:DataGrid>
                                           <mx:Spacer width="2%"/>
                                       </mx:HDividedBox>
                                       </mx:VBox>
                   <mx:Spacer height="0"/>
                <mx:VBox width="100%">
                    <s:HGroup height="90" top="0" left="0" right="0" verticalAlign="justify" gap="10" paddingLeft="5" paddingRight="5" paddingTop="5" paddingBottom="5">
                        <s:Button id="btn_loader" top="5" bottom="24" width="100" label="load" click="loadImages()"/>
                        <s:Group width="100%">
                            <s:Group name="cl" top="0" left="0" bottom="0" width="20" mouseOver="//scroll_on(event)" mouseOut="//scroll_off(event)">
                                <s:BitmapImage source="@Embed('../assets/left.jpg')" top="0" left="0" bottom="0" right="0" fillMode="scale"/>   
                            </s:Group>
                            <s:List id="imgList" skinClass="skins.ListSkin" top="-3" left="27" right="28" bottom="10"
                                    dataProvider="{ImageCollection}" itemRenderer="Image_Render">
                                <s:layout>
                                    <s:HorizontalLayout gap="0"/>
                                </s:layout>
                            </s:List>
                            <s:Group name="cr" top="0" right="0" bottom="0" width="20" mouseOver="//scroll_on(event)" mouseOut="//scroll_off(event)">
                                <s:BitmapImage source="@Embed('../assets/right.jpg')" top="-1" left="0" bottom="0" right="0" fillMode="scale"/>
                            </s:Group>
                        </s:Group>
                    </s:HGroup>
                    <s:SkinnableContainer id="dropCanvas" top="100" left="5" right="5" bottom="5" backgroundAlpha="1.0" alpha="1.0"
                                          dragEnter="dropCanvas_dragEnterHandler(event)"
                                          dragDrop="dropCanvas_dragDropHandler(event)" contentBackgroundColor="#914E4E" backgroundColor="#F7F7F7">
                    </s:SkinnableContainer>
                </mx:VBox>
                <mx:Spacer height="5"/>
                                      </mx:VDividedBox>
        </mx:Panel>
    </mx:Canvas>

  • Get the values from the bean class?

    Hi Praveen and all can u please suggest in this,
    I have developped an application In that Create One java class that Extends PageProcesscomponenet and utilizing the Bean That have the Connetion method and retriving the query Based on the Logon customer and spoof customer.
    this functionality I have developped in Pageprocessor component.
    The same functinality I am utilizing another java Class that Extends AbstractPortalcomponent  and utilizing the same Bean.
    But the problem both java classes for I used one Jsp only Dynmic spoof customer will come from the JSP Input filed.
    In the new Java Class How can I capture the Event When I click the Buttong the InputField value capturing into the AbstractPortalcomponent Class.
    I tried like this but It comes as Null Value.
    Event event = myContext.getCurrentEvent();
                              if(event!=null)
                                  InputField ip= (InputField) myContext.getComponentForId("spoofCust");
                                  String spoofCust=ip.getValue().toString();
    Please suggest me in this.
    What is wrong with this.
    Thanks,
    Lohi.
    Message was edited by:
            Lohitha M

    Lohitha,
    Try replacing your two lines of code:
    InputField ip= (InputField) myContext.getComponentForId("spoofCust");
    String spoofCust=ip.getValue().toString();
    with:
    InputField ip = (InputField) getComponentByName("spoofCust");     
    String spoofCust = ip.getValueAsDataType().toString();
    Let me know how that works for you.
    -John

  • Get the values from Exception class

    Hi all ..
    In class i have raised one exception
    when i catch this exception in my program i m able to get the
    error message but i need to get all the parameters that i pass
    when i raise the exception ...
    i have raised like this
          RAISE EXCEPTION TYPE cx_bapi_error
            EXPORTING
              textid = cx_bapi_error=>cx_bo_error
              class_name = 'ZHS_'
              log_no = wa_bapi_return-log_no
              log_msg_no = wa_bapi_return-log_msg_no
              t100_msgid = wa_bapi_return-id
              t100_msgno = wa_bapi_return-number
              t100_msgv1 = wa_bapi_return-message_v1
              t100_msgv2 = wa_bapi_return-message_v2
              t100_msgv3 = wa_bapi_return-message_v3
              t100_msgv4 = wa_bapi_return-message_v4
              STATUS = lt_status
    and caught the exception like this in my program
        CATCH cx_bapi_error INTO go_error.
          gd_text = go_error->get_text( ).
          EXIT.
      ENDTRY.
    in this i m just getting the class name which i have passed in exception
    i need all other parameters that i have passed ..
    if u have any idea pls let me know ..
    Thanks in advance ...

    Hello Jayakumar
    Usually the attributes of standard exception classes are defines as <b>public</b> and <b>read-only</b>. Thus, you should be able to use the following coding:
    DATA:
      go_error   TYPE REF TO cx_bapi_error.  " specific exception class !!!
    TRY.
    RAISE EXCEPTION TYPE cx_bapi_error
    EXPORTING
    textid = cx_bapi_error=>cx_bo_error
    class_name = 'ZHS_'
    log_no = wa_bapi_return-log_no
    log_msg_no = wa_bapi_return-log_msg_no
    t100_msgid = wa_bapi_return-id
    t100_msgno = wa_bapi_return-number
    t100_msgv1 = wa_bapi_return-message_v1
    t100_msgv2 = wa_bapi_return-message_v2
    t100_msgv3 = wa_bapi_return-message_v3
    t100_msgv4 = wa_bapi_return-message_v4
    STATUS = lt_status.
    CATCH cx_bapi_error INTO go_error.
    gd_text = go_error->get_text( ).
    WRITE: go_error->t100_msgid,  " perhaps the attributes have different name
                go_error->t100_msgno, " check attribute names in SE24
    EXIT.
    ENDTRY.
    Regards
      Uwe

  • Problem with setContentPane() in JFrame class

    I recently discovered a problem with the setContentPane method in the JFrame class. When I use setContentPane(Container ..), the previously existing contentPane remains in the stack. I have tried nullifying getContentPane(), and all manner of things, but, each time I use setContentPane, I have another instance of a JPanel in the stack.
    I'm using code similar to setContentPane(new CustomJPanel()); and each time the user changes screens, and a similar call to that is made, the old CustomJPanel instance remains in the stack. Can anyone suggest a way around this? On their own the panels do not take up very much memory, but after several hours of usage, they will build up.

    I tried what you suggested; it only resulted in a huge performance decrease. The problem with memory allocation is still there.
    Here is the method I use to switch screens in my app:
    public static void changeScreen (JPanel panel){
              try{
                   appFrame.setTitle("Wordinary : \""+getTitle()+"\"");
                   appFrame.setContentPane(panel);
                   appFrame.setSize(appFrame.getContentPane().getPreferredSize());     
                   appFrame.getContentPane().setBackground(backColour);
                   for (int i = 0; i < appFrame.getContentPane().getComponents().length; i++)
                        appFrame.getContentPane().getComponents().setForeground(textColour);
                   //System.out.println("Background colour set to "+backColour+" text colour set to "+textColour);
                   appFrame.validate();
              catch (Exception e){
                   //System.out.println("change");
                   e.printStackTrace();
    And it is called like this:
    changeScreen(new AddWordPanel());The instantiation of the new instance is what is causing the memory problems, but I can't think of a way around it.

  • Problem with Outer and Inner Classes....or better way?

    Right now I'm trying to create an Inner class.
    My .java file compiles ok, and I create my jar file too.
    But when I try to instantiate the Inner class, it fails:
    java.lang.NoClassDefFoundError: com/myco/vlXML/vlXML$vlDocument.
    Here's the class code:
    public class vlXML{
        private ArrayList myDocList=new ArrayList(); //holds documents
        public vlXML(){
        private class vlDocument{
            public vlDocument(){
            //stuff goes here
        public vlDocument vlDOC(){
            return new vlDocument();
        public void addDocument(){
            vlXML xxx=new vlXML();
            vlDocument myDoc=xxx.vlDOC();
            myDocList.add(myDoc);
        public int getNumDocs(){
            return myDocList.size();
    }Then, from a jsp page, I call:
    vlXML junk1=new vlXML();
    junk1.addDocument();...and get the error...
    Can someone help me figure out why it's failing?
    Thanks....

    You nailed it - thanks....(duh!)
    While I have your attention, if you don't mind, I have another question.
    I'm creating a Class (outer) that allows my users to write a specific XML file (according to my own schema).
    Within the XML file, they can have multiple instances of certain tags, like "Document". "Document"s can have multiple fields.
    Since I don't know how many "Documents" they may want, I was planning on using an Inner Class of "Document", and then simply letting them "add" as many as necessary (thus the original code posted here).
    Does that seem like an efficient (logical/reasonable) methodology,
    or is there there something better?
    Thanks Again...

  • JBO:33001 bc4j.xcfg file not found in class path

    Hi,
    I am yet another victim of the age-old error JBO:33001 bc4j.xcfg file not found in class path, When i have my BC4JApp.jar in Tomcat Web-inf/lib directory. All the other jar files and class files in my webserver-application web-inf classes and lib directory works.
    But Tomcat server is not able to read this bc4j.xcfg file. I can see in my jar file that this bc4j.xcfg exists and in the specified package directory. still the problem persists. My BC4JApp.jar is perfectly working when i use JDeveloper. but not when i use tomcat4.0 and call a JSP using BC4JApp.jar from browser (My environment is Jdeveloper3.2, Tomcat4.0+IIS in middle tier and oracle 8i as DB, everything on windows2k)
    I have gone through almost all the threads possible that relates to this error in this form. None of them have a answer except to say "put the file in classpath". and last reply is "will fix in jDeveloper 9i. So what happens to us who are working in Jdeveloper 3.2?
    1. I have this file in my jar file.
    2. I also tried creating a seperate directory manually, with the same name as my package under web-inf/classes, web-inf/lib , just under web-inf directory and atlast under approot directory also. I tried having my package directory containing bc4j.xcfg in these folders one at a time and also tried having this directory in all these folders at the same time.
    Still no solution.
    Itz frustrating that neither proper documentation nor a right url page nor i am aware of available addressing this. page links given in above threads only gives me the wonderful page of ie's "Page cannot be displayed".
    Is there a answer to this error and my problem. If this doesn't work, then i have to all the way develop from scratch creating my jsp using JDBC calls and Stored packages etc.
    I don't want to give up on this Jdeveloper at this final moment because if this bc4j.xcfg file is found, my application will work perfectly. on these final moments, if this doesn't work, i am frightened to imagine to develop my application in standard way. Atlast, if thatz the option left,we have to do that bcos our production date is close by.
    Please can some one in this forum or Jdeveloper help me to solve this problem. I am desperate and very urgent.
    Waiting for a reply from Jdev team very much...
    ( I just posted in the other thread which is pretty old, dated backto May 2001, which was relevant to this error. Just to make sure it is noticed, I am posting it seperately too)
    Thanks
    Hari(2/3/02)

    Hi All,
    For those who are following this thread, I got a solution for this error with the help of Jdev Team.
    This solution may work, if you have deployed your application in Tomcat4.0.1. This is the environment in which I work and tested.
    As you may be aware, Tomcat ignores value in CLASSPATH variable.
    To see any files that are existing or newly deployed, it has it own way of detecting it.
    Addition information on Tomcat working, you can follow this link,
    http://jakarta.apache.org/tomcat/tomcat-4.0-doc/index.html
    Coming to point, Tomcat has got five classloaders and each classloader invoked, looks in their related directories for files in following order.
    1. /WEB-INF/classes of your web-application
    2. /WEB-INF/lib/*.jar of your web application
    3. BootStrap classes of your JVM (Tomcat's $JAVA_HOME/jre/lib/ext)
    4. System class loader classes($CATALINA_HOME/bin/bootstrap.jar,CATALINA_HOME/lib/tools.jar)
    5. $CATALINA_HOME/common/classes
    6. $CATALINA_HOME/common/lib/*.jar
    7. $CATALINA_HOME//classes
    8. $CATALINA_HOME/lib/*.jar
    So All your individual application related files should be deployed in your application's WEB-INF/classes or WEB-INF/lib directory accordingly.
    If your application files are unpacked, they should be deployed or copied under WEB-INF/classes directory
    if the files are within a jar, they should be under WEB-INF/lib directory.
    If your Jar-files contains bc4j components, then those jar files should be deployed under WEB-INF/lib directory. Also,do the next step to copy all relavant BC4J runtime libraries under lib directory.
    IMPORTANT: Please remember to copy and paste all the required BC4j runtime libraries in the Same WEB-INF/lib directory along with your application jar files. This is the real reason which can solve this JBO:33001 to disappear. It worked for me.
    To configure your directory for tag-lib uri's, use web.xml to set the taglib-uri attribute.
    Put your web.xml and DataTags.tld in the WEB-INF directory.
    Your simple web.xml may look like as follows.
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
         <taglib>
              <taglib-uri>
                   /webapp/DataTags.tld
              </taglib-uri>
              <taglib-location>
                   /WEB-INF/DataTags.tld
              </taglib-location>
         </taglib>
    </web-app>
    You may then modify this web.xml to suit further requirements of your application.
    Remember to stop and restart the Tomcat Server (service) by using shutdown and startup scripts after updating any jar files/class files/ JSP or source files deployed in Tomcat.
    Sometimes, only this helps even though your context's reloadable attribute is set to true in Tomcat Server's server.xml file.
    Hope this above information helps you to solve this error in Tomcat environment. My Sincere thanks once again to Juan and Jdev team for their help and efforts to solve this problem.
    Thanks
    Hari

Maybe you are looking for

  • Unable to update pricing in open sales orders

    Dear All I had created some sales orders which are partially delivered, now i need to update one of the pricing component due to change in that component (i have already created new pricing component thru VK11) but when i try to change (VA02) sales o

  • My Book and disk inserted not readable

    Whenever I boot my Mac  OS 10.9X system, I see the error message: "the disk you inserted was not readable by this computer." My BOOK is working and is use for my Time Machine. I am given a choice to "eject, or ignore."  I have used both to get rid of

  • [SOLVED] Archiso : installing AUR packages on a live image

    Hi all, I'm quite an arch newbie, I'm trying to setup a live USB stick, with the help of archiso. My goal is to finally get an "audio oriented" system (with jack, ardour, qsampler, and so more...). During the setup everything was working very well, u

  • Splitting BC tasks between 2 teams - your advices/experiences please

    Hello dear Basis friends, I am in need of your valuable advices /  experiences. Our company is in the process of remodeling the IT department. Following this process, they want to split the operational part of BC tasks from the project/architecture p

  • Case of the Bouncing Icons?

    Here's an odd, if seemingly harmless, one: The other day when I tried to launch Quicken from the dock its icon just bounced away happily but the application wouldn't open. Just for fun, I tried to launch Safari and then I had two hopping icons but ne