Help: Catching the ClassNotFoundException

My question is related to the question at http://forum.java.sun.com/thread.jsp?forum=31&thread=396176
I start a new thread as it has a different emphasis. I have the following code to catch the ClassNotFoundException:
catch (ClassNotFoundException cnfe)
System.out.println("Not found");
Later on I will use a dialog window to send the error message but in the meantime I just want to display it on the console. But it appears to me that the two machine (all runs windows XP) I used, one at home and the other one at the computer lab at my campus, react differently to the exception thrown. I found that my home machine only display "Not Found" message on the console while the machine at the lab display the message followed by an extensive error message:
java.lang.NullPointerException
at MainWindow.<init><MainWindow.java:97>
at .....
at .....
etc.
What does make these two machine react differently?
Any input will be appreciated. Thanks.

The class cnfe might be present in the campus machine due to which your code is not throwing the class not found exception and is throwing null pointer due to some other case.

Similar Messages

  • Help to catch the output of a Transaction

    Hi,
    I have this issue and need help, I have a program lets say "ZPROGRAM", this programs calls a RFC "ZFUNC" this function must be able to send the parameters to execute a SAP standard transaction for example MB51, the function must send the plant number, storage location, and material number, then this RFC must catch the output of the report into an internal table so that i can work with the output in "ZPROGRAM", in other words what I see on screen as result of MB51 I need it in an internal table so that I can manupulate the data.
    I hope someone could tell me how to accomplish this.
    Thanks in advice.

    Hi,
       Pls try
        DATA list_tab TYPE TABLE OF abaplist.
        DATA vlist  LIKE  table of LISTZEILE WITH HEADER LINE.
        submit RM07DOCS
          with XXX
          EXPORTING LIST TO MEMORY
          and return .
          CALL FUNCTION 'LIST_FROM_MEMORY'
            TABLES
              listobject = list_tab
            EXCEPTIONS
              not_found  = 1
              OTHERS     = 2.
       CALL FUNCTION 'LIST_TO_ASCI'
          EXPORTING
            list_index         = -1
          TABLES
            listasci           = vlist
            listobject         =list_tab
          EXCEPTIONS
            empty_list         = 1
            list_index_invalid = 2
            OTHERS             = 3.
    Regards,
    Pole
    Edited by: Pole li on Jul 17, 2008 3:57 AM

  • The exception error,didn't catch the connection of null user name,help!

    help me !
    I use the occi and vc to execute a program,
    when i use a NULL database name or use a NULL user name to connect the oracle,the statement "try...catch(SQLException ex)"
    didn't catch the error,how i can do?
    who can tell me how to change the code,and give me the code of resolved.
    the code is:
    try
    env=Environment::createEnvironment(Environment::DEFAULT);
    conn=env->createConnection(m_user,m_pwd,m_dbbase);
    }catch(SQLException ex)
    when the m_dbbase is NULL or m_user is NULL,the Exception didn't being catched.

    #include"iostream.h"
    #include <string>
    #ifndef occi_ORACLE
    #define WIN32COMMON
    #include "occi.h"
    #pragma comment(lib,"D:\\oracle\\product\\10.1.0\\Db_1\\oci\\lib\\msvc\\vc6\\oraocci10.lib")
    using namespace oracle::occi;
    using namespace std;
    #endif
    void main()
         Environment *env;
         Connection * con;
    try
    env = Environment::createEnvironment(Environment::DEFAULT);
    con = env->createConnection("","","");
    catch(SQLException excep)
    cout<<"Error while connect: "<<excep.getMessage().c_str();
    the code is as over,my system is windows2003,the Oracle is 10g,the VC is 6.0,
    when I build the program,No error,when go(F5) to the statement "con = env->createConnection("","","");",popup a MessageBox----"Unhandled exception in testt.exe (ORACLINT10.DLL):0xC0000005:Access Ciolation.",the con value is 0xCCCCCCCC,
    and another question being found,the statement "cout<<"Error while connect: "<<excep.getMessage().c_str();" be decreased the .c_str();
    error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable conversion)
    how to use the string type?which top file i must add?

  • Unable to catch the error pls help

    Hi all am trying from last two hours but strangely unable to catch the error inthe below procedure..
    Ignore what the functionality is but look at these steps in the procedure ;Look at these two steps below in the procedure....
    It goes wrong at this point......
    v_acct_nb := in_acct_gp_array(i).gp_dtl_array(j).account_id;
    SELECT DISTINCT account_id INTO v_acct_dim_nb FROM ats_ACCOUNT WHERE account_id = v_acct_nb ; ----> this throws exception that no rows found
    I can see that values are passed into v_acct_nb variable.... but the second statements returns exception saying no data found .
    But
    when i hard code the value returned in the variable in the second statement like below it works ....
    v_acct_nb := in_acct_gp_array(i).gp_dtl_array(j).account_id; /* say i received the value v_acct_nb =20 */
    SELECT DISTINCT account_id INTO v_acct_dim_nb FROM ats_ACCOUNT WHERE account_id = '20'; -----> this works
    whats the issue here ?
    CREATE OR REPLACE PROCEDURE add_appl_dummy2( in_usr_id VARCHAR2,in_acct_gp_array appl_acct_gp_array,v_status_message OUT VARCHAR2)
    IS
    v_usr_dim_nb INTEGER;
    v_acct_dim_nb  VARCHAR2(35);
    v_user_exception     EXCEPTION;
    v_account_exception     EXCEPTION;
    v_acct_in_othr_group_exception  EXCEPTION;
    v_grp_already_exist_exception  EXCEPTION;
    v_acct_nb  VARCHAR2(35);
    v_error_code         VARCHAR2(50);
    v_error_msg          VARCHAR2(50);
    v_dflt_appl_acct_gp_nm VARCHAR2(50);
    v_dflt_appl_acct_gp_id INTEGER;
    v_count NUMBER;
    BEGIN
            /* verify if the user is valid */
            BEGIN
                SELECT usr_id INTO v_usr_dim_nb FROM TSS_USR WHERE access_id =in_usr_id ;
                EXCEPTION WHEN NO_DATA_FOUND THEN
                  v_error_code := SQLCODE;
                  v_error_msg  := SQLERRM;
                RAISE v_user_exception; 
            END;
    DBMS_OUTPUT.PUT_LINE('1');
            FOR i IN in_acct_gp_array.FIRST.. in_acct_gp_array.LAST
            LOOP
                /* Verify if the user has already created an account group with the same name */
                BEGIN
                  SELECT COUNT(1) INTO v_count FROM RPT_ACCT_GP WHERE usr_id=v_usr_dim_nb AND appl_acct_gp_nm=in_acct_gp_array(i).appl_acct_gp_nm;
                  IF v_count >0 THEN
    DBMS_OUTPUT.PUT_LINE('2');
                      RAISE v_grp_already_exist_exception;
                  ELSE
    DBMS_OUTPUT.PUT_LINE('3');
                      NULL;
                  END IF;
                END;
    DBMS_OUTPUT.PUT_LINE('4');
                FOR j IN in_acct_gp_array(i).gp_dtl_array.FIRST..in_acct_gp_array(i).gp_dtl_array.LAST
                LOOP
                      *v_acct_nb := in_acct_gp_array(i).gp_dtl_array(j).account_id;*    
       *SELECT DISTINCT account_id INTO v_acct_dim_nb FROM ats_ACCOUNT WHERE account_id = v_acct_nb ;*
       IF v_acct_dim_nb IS NULL THEN
        DBMS_OUTPUT.PUT_LINE('is null');
       ELSE
                     DBMS_OUTPUT.PUT_LINE(v_acct_dim_nb); /* verify if the account number is valid */
                         DBMS_OUTPUT.PUT_LINE(v_acct_nb);
                         END IF;
             END LOOP;
        END LOOP;
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('9');
    v_status_message:='SUCCESS';
    EXCEPTION
        WHEN v_user_exception THEN
             v_status_message:= 'Invalid user id :'||in_usr_id ||' '||v_error_code||' '||v_error_msg;
        WHEN v_grp_already_exist_exception THEN
             v_status_message:= 'Group with the same name already exists ';
        WHEN OTHERS THEN
             v_status_message:= SQLCODE||' '||SQLERRM;
    END;
    SELECT DISTINCT account_id  FROM ats_ACCOUNT WHERE account_id='000000400127032'

    Please remove this bug anyway:
        WHEN OTHERS THEN
             v_status_message:= SQLCODE||' '||SQLERRM;

  • Catch the Excep while clicking on a button and display the msg in JSF UI

    Hi,
    I am facing a issue like i have a add button in my JSF page which will add Partner code, Partner name,etc..,
    If i give the same partner code and partner name second time it is throwing the duplicate key exception
    org.apache.myfaces.component.html.ext.HtmlSelectOneMenu@319e5b
    Calling Save Method.............
    Record Saved..............
    (util.JDBCExceptionReporter 71 ) SQL Error: 1062, SQLState: 23000
    (util.JDBCExceptionReporter 72 ) Duplicate entry 'T1-test1' for key 1
    (def.AbstractFlushingEventListener 299 ) Could not synchronize database state with session
    org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
         at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
         at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
         at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:230)
         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
         at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
         at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
         at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1007)
         at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:354)
         at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
         at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:584)
         at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:496)
         at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:469)
         at org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:266)
         at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
         at $Proxy31.save(Unknown Source)
         at com.finnair.pba.handler.PartnerMastCtrl.addAction(PartnerMastCtrl.java:110)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
         at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
         at com.sun.rave.web.ui.appbase.faces.ActionListenerImpl.processAction(ActionListenerImpl.java:57)
         at javax.faces.component.UICommand.broadcast(UICommand.java:106)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
         at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.sql.BatchUpdateException: Duplicate entry 'T1-test1' for key 1
         at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647)
         at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
         at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
         ... 51 more
    I am using JSF,Spring and Hibernate.
    I would like to catch this exception and throw it in the JSF UI near partner code field as a message.
    Is this possible to do.
    My JSF:
    <tr>
    <td width="30%" align="right" ><b><h:outputText id="pPartnerCode" value="Partner Code" /></b><span style="color:red">*</span></td>
    <td width="60%">:
    <h:inputText id="partnerCode" value="#{partnerMast.partnerCode}" required="true">     
    <t:validateRegExpr pattern="^[a-z||A-Z||0-9||_||\s||/]+$" />
    <f:validateLength minimum="1" maximum="3" />     
    </h:inputText>          
    <h:message for="partnerCode" showDetail="true" style="color:red" /></td>
    </tr>
    <tr>
    <td width="40%" align="right"><b><h:outputText id="pPartnerName" value="Partner Name" /><span style="color:red">*</span></b></td>
    <td width="60%" align="left">:               
    <h:inputText id="partnerName" value="#{partnerMast.partnerName}" required="true" >     
    <t:validateRegExpr pattern="^[a-z||A-Z||0-9||_||\s||/]+$" />
    <f:validateLength minimum="1" maximum="50"/>     
    </h:inputText>
    <h:message for="partnerName" showDetail="true" style="color:red" />
    </td>
    </tr>
    <h:commandButton id="addUser" value="Save" action="#{partnerMastCtrl.addAction}" styleClass="style10"/>
    My controller:
    public String addAction()
    try
    partnerMast = (PartnerMast)context.getExternalContext().getSessionMap().get("partnerMast");
    partnerHostingMast = (PartnerHostingMast) context.getExternalContext().getSessionMap().get("partnerHostingMast");
    this.getService();
    if(partnerHostingMast != null && partnerHostingMast.getHostingPartner() != null && partnerMast.getPartnerType().equalsIgnoreCase("Airline"))
    partnerHostingMast.setPartnerCode(partnerMast.getPartnerCode());
    partnerMastService.save(partnerMast);     /* To be noted */
    partnerHostingMastService.saveOrUpdate(partnerHostingMast);
    ret_stat = "Success";
    context.getExternalContext().getSessionMap().put("partnerMast", null);
    } else {
    partnerMastService.save(partnerMast);
    ret_stat = "Success";
    }catch(Exception e){
    ret_stat = "Error";
    FacesMessage message = new FacesMessage("Application facing some problem - Please contact administrator");
    context.addMessage("error", message);
    return ret_stat;
    My Dao :
    public PartnerMast save(PartnerMast entity){
    try{
         System.out.println("Calling Save Method.............");
         entity.setIsActive("Y");
         getHibernateTemplate().save(entity);
         System.out.println("Record Saved..............");
    catch(ConstraintViolationException e){
         System.out.println("Exception ..................."+e);
    return entity;
    I hope u got my question. Is there is any solution for this.
    Pls Anyone help me out.
    Thanks,
    Ambika&#9786;

    Hi,
    I am able to catch the exception, how would i able to display the message in the JSF UI.
    My Controller:
    public String addAction() throws Exception
    try{               
    partnerMast = (PartnerMast)context.getExternalContext().getSessionMap().get("partnerMast");
    partnerHostingMast = (PartnerHostingMast) context.getExternalContext().getSessionMap().get("partnerHostingMast");
    this.getService();
    if(partnerHostingMast != null && partnerHostingMast.getHostingPartner() != null && partnerMast.getPartnerType().equalsIgnoreCase("Airline"))
    partnerHostingMast.setPartnerCode(partnerMast.getPartnerCode());
    partnerMastService.save(partnerMast);     
    partnerHostingMastService.saveOrUpdate(partnerHostingMast);
    ret_stat = "Success";
    context.getExternalContext().getSessionMap().put("partnerMast", null);
    else {
    partnerMastService.save(partnerMast);
    ret_stat = "Success";
    catch(Exception e) {
         ret_stat = "Error";
         FacesMessage message = new FacesMessage("Application facing some problem - Please contact administrator");
         context.addMessage("error", message);
           if(causedByBatchUpdateException(e)) {
                  System.out.println("Yes Exception.........");
                  FacesMessage message1 = new FacesMessage("Duplicate Entry...........");
              context.addMessage("error", message1);
                            //ret_sta="NO";
                     } else {
                             throw e;
              System.out.println("Before returning.............");
              return ret_stat;
              //return ret_sta;
    }It is displaying the message saying "Yes Exception" in the console but not displaying the "Duplicate Entry" in the JSF UI.
    Pls Anyone help me out.
    Thanks,
    Ambika&#9786;

  • Catch the error in to a log file

    Hi Team,
    Created the script for testing the server online or offline, Could you please tell me how to catch the error in to a file
    Try
    $Result = Test-Connection -count 1 -computer (Get-Content ServerName.txt)  -ErrorAction "Continue"
    Catch
       $Result = New-Object PSCustomObject -Property @{
                TimeStamp = Get-Date
                __Server = $env:COMPUTERNAME
                Address = $Computer
                Protocol = ""
                ResponseTime = "Failed"
    $Result | Select TimeStamp,__Server,Address,ProtocolAddress,ResponseTime | ft -AutoSize

    As mjolinor pointed, you should change the -ErrorAction to Stop to make the control flow into catch block when error occurs. Just change alone is not sufficient because, the control will go to catch block if any of the computer in servername.txt gives error,
    and it will not go back to next computer in your text file perform the ping.
    So try chaning the code as shown below.
    $Outarr = @()
    foreach($Comp in (Get-Content C:\temp\servers.txt)) {
    Try {
    $Result = Test-Connection -count 1 -computer $Comp -ErrorAction stop
    Catch {
    $Result = New-Object PSCustomObject -Property @{
    TimeStamp = Get-Date
    __Server = $env:COMPUTERNAME
    Address = $Comp
    Protocol = ""
    ResponseTime = "Failed"
    $Outarr +=$Result
    $Outarr| Select TimeStamp,__Server,Address,ProtocolAddress,ResponseTime | ft -AutoSize
    Hope this helps.
    Thanks,
    Sitaram Pamarthi
    Blog : http://techibee.com
    Follow on Twitter
    This posting is provided AS IS with no warranties or gurentees,and confers no rights
    You can simplify that to:
    $Outarr =
    foreach($Comp in (Get-Content C:\temp\servers.txt)) {
    Try {
    Test-Connection -count 1 -computer $Comp -ErrorAction stop
    Catch {
    [PSCustomObject]@{
    TimeStamp = Get-Date
    __Server = $env:COMPUTERNAME
    Address = $Comp
    Protocol = ""
    ResponseTime = "Failed"
    $Outarr | ft -AutoSize
    The [PSCustomObject] type accelerator will take the hash table as a constructor, and coerce it to an [ordered] hash table, so the properties will stay in the same order they were declared.  That eliminates the need to use Select-Object afterward to
    get them back into the right order.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • How to catch the sender SOAP adapter http response?

    Hi eXperts,
    I've a sender soap adapter opened to customer as webservice. When customers call this webservice, data is coming into XI and works fine. But the customer is complaining that the expected HTTP 200 response is not sent back to the calling SOAP client.
    So my question is: Is there a way to catch the http 200 response from sender adapter, or at least get to know if the sender adapter has sent the response?
    Thanks in advance.
    Regards
    Luis

    Hi,
    If I understood it correcly... Sender is a Async SOAP call and the sender system is expcting a status back of HTTP 200. Are you sure you had set the quality of effort to Exactly Once? If not please try setting it.
    You can also go to Adapter monitoring or Communication channel monitoring in the Runtime workbench and see if the Sender SOAP adapter is fine.
    http://help.sap.com/saphelp_nw04/helpdata/en/5e/164442c1a1c353e10000000a1550b0/content.htm
    Thanks,
    Prakash

  • How to catch the return object

    this one is my code
    private static select(){
    String URL = "jdbc:mysql://localhost/Chat";
    String username = "root";
    String password = "";          
    Vector result = new Vector();
    try {
         Class.forName("com.mysql.jdbc.Driver").newInstance();
            } catch (Exception e) {
                System.out.println("Failed to load MySQL driver.");
    Statement stmt = null;
    Connection con=null;
    try {
    con = DriverManager.getConnection(URL,username,password);
    stmt = con.createStatement();
    ResultSet RS = stmt.executeQuery("SELECT * FROM message;");        
             while(RS.next()){
                String command = RS.getString("command");
                String source = RS.getString("source");
                String target = RS.getString("target");
                String message = RS.getString("message");
                String typeuser = RS.getString("typeuser");
                String photouser = RS.getString("photouser");              
                String temp = command+"?"+source+"?"+target+"?"+message+"?"+typeuser+"?"+photouser;
            result.addElement(temp);
               RS.close();
            stmt.close();
               con.close();                
    } catch(SQLException e) {
                System.err.println("******SQLException : *******");
                while (e != null)
                  System.out.println("Message : "+e.getMessage());
                  System.out.println("Etat : "+e.getSQLState());
                  System.out.println("Code Erreur : "+e.getErrorCode()+"\n");
                  e = e.getNextException();
    return *******?; // what should i write here since i want to catch the value of vector, and use it in somewhere else       
        }

    Okay, this method makes no sense. But, if you want it to return a Vector, then it needs to have a return type of Vector.private static Vector select()Then use the return statement as such:return result; // as result is the name of you VectorYou then call the method as such:Vector v = select();I still don't understand the purpose of the method. Why is it static?
    Methinks someone needs to go back to basics of Java programming.
    Hope that helps, though.
    James

  • How to catch the mouse event from the JTable cell of  the DefaultCellEditor

    Hi, my problem is:
    I have a JTable with the cells of DefaultCellEditor(JComboBox) and added the mouse listener to JTable. I can catch the mouse event from any editor cell when this cell didn't be focused. However, when I click the editor to select one JComboBox element, all the mouse events were intercepted by the editor.
    So, how can I catch the mouse event in this case? In other word, even if I do the operation over the editor, I also need to catch the cursor position.
    Any idea will be highly appreciated!
    Thanks in advance!

    Hi, bbritta,
    Thanks very much for your help. Really, your code could run well, but my case is to catch the JComboBox event. So, when I change the JTextField as JComboBox, it still fail to catch the event. The following is my code. Could you give me any other suggestion?
    Also, any one has a good idea for my problem? I look forward to the right solution to this problem.
    Thanks.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test3
    extends JFrame {
    // JTextField jtf = new JTextField();
    Object[] as = {"aa","bb","cc","dd"};
    JComboBox box = new JComboBox(as);
    public Test3() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container content = getContentPane();
    String[] head = {
    "One", "Two", "Three"};
    String[][] data = {
    "R1-C1", "R1-C2", "R1-C3"}
    "R2-C1", "R2-C2", "R2-C3"}
    JTable jt = new JTable(data, head);
    box.addMouseListener(new MouseAdapter() {
    // jtf.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e)
    System.out.println("-------------------JComboBox mouseclick....");
    jt.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e)
    System.out.println("-------------------JTable mouseclick....");
    // jt.setDefaultEditor(Object.class, new DefaultCellEditor(jtf));
    jt.setDefaultEditor(Object.class, new DefaultCellEditor(box));
    content.add(new JScrollPane(jt), BorderLayout.CENTER);
    setSize(300, 300);
    public static void main(String[] args) {
    new Test3().setVisible(true);
    }

  • Why i am unable to catch the 'TAB' key press?

    hi
    i have an application where i have 2 text fields and one button in order say t1, t2 and b1.
    on tabbing t1 cursor moves to t2 and on tabbing t2 cursor moves to b1 and on tabbing b1 cursor moves to t1.
    now when i press tab button on any of the component i have written a keyListener for that to catch 'TAB' key using the comparision
    if( e.getKeyCode() == KeyEvent.VK_TAB )
    but its not catching the tab key pressed on any of these 3 components....
    why like this...
    i want to catch the press of 'TAB' key and write some action for it... but unable to catch the 'TAB' key press.
    anyone could help me in this....
    thanx in advance,
    -Soni

    I seem to remember this question being asked before. I think the answer was that the FocusManager intercepts the TAB key. I don't remember the solution but you can try searching the forum.

  • My solaris can't catch the internet

    I have finished my installation of solaris 10, but I can't browse any web site. The msg said that "The XXX.com can't found, pls try again and check the name". But I am sure that the name of web site and the web site is exited since I can open it with another computer.
    So that, I wonder that if the computer hadn't detected the NIC. Therefore, I had tried many method to find the package for the NIC. But I can't find any of it. So, I really don't know what can I do?
    Can I do that in another way?
    Or the problem that I wondered is not right?
    Pls help!!!!

    since we can't execute the package file from the floppy disk.......
    and any procedure of setting
    #ifconfig hme0 plumb(start up the NIC)
    #ifconfig hme0 inet 192.168.49.51 netmask 255.255.255.0 (add IP and Subnetmask)
    #vi /etc/defaultrouter (add router)
    #echo ��myhost�� > /etc/nodename (add host name)
    #echo ��domain domain.com�� > /etc/resolv.conf (set the domain name, this step can omit)
    #echo ��nameserver 161.64.3.1�� >> /etc/resolv.conf (set the IP of DNS)
    #vi /etc/nsswitch.conf (change the DNS enquire method, since the original one is hosts: file �� hosts:file dns)
    all of above are what we have done, but we still can't catch the internet....
    so what can we do to solve this problem?

  • Catch the process id number in unix

    With my java program I run command in Unix. This application I start in background (nohup start.sh &). How can I catch the process ID number of my application? I use next string for code:
    String command[] = {"/bin/sh", "-c", "/bin/" + command, "/bin/searcId"};
    In run this line whit Runtime.exec()
    command is "nohup start.sh &" and the searchId is a Unix script for catching process ID number (this script works fine, when I run it in Unix).
    What can be wrong???
    MArko

    I arrived at this thread doing a Google search on how to obtain the process id of an executable launched from Java. The following code is not recommeded for released code, but it was helpful for my debugging purposes.
    try
        Process proc = Runtime.getRuntime().exec("executable");
        Field pidField = proc.getClass().getDeclaredField("pid");
        //pid field in UNIXProcess class is private - make it accessible
        pidField.setAccessible(true);
        System.out.println("Exec'ed process ID is: " + pidField.get(proc));
    catch (Exception e)
        e.printStackTrace();
    }The process id field for the UNIXProcess is "pid." On Windows, I believe it is "handle."

  • Where can we catch the event which leads to downloading a report to a local

    Hi frnds,
    can u help me out . actaully ,i  have a classical interactive report. it has many headings.Because of the initial headings ,if i try to download that report to a local file ,the column allignments are disturbed.
    So,one way i feel to get the download correctly ,is that ,some how i can catch the event whcih leads to the download of the report ,and based on the occurence of that event ,i can restrict the page headings to appear in the downloaded spreadsheet ,so that the there are no, unwanted columns getting inserted in between .
    Regards
    Rajesh.

    hi,
    you can have selection screen field : "parameters : p_disvar like disvariant-variant."  and at event selection scree you can call the below function and select the variant create for the report.
    "at selection-screen on value-request for p_disvar.
      call function 'REUSE_ALV_VARIANT_F4'
           exporting
                is_variant          = g_variant
              I_TABNAME_HEADER    =
              I_TABNAME_ITEM      =
              IT_DEFAULT_FIELDCAT =
                i_save              = g_variant_save
           importing
                e_exit              = h_exit
                es_variant          = gx_variant
            exceptions
                not_found           = 1
                program_error       = 2
                others              = 3.
      if sy-subrc is initial and h_exit is initial.
        g_variant-variant = gx_variant-variant.
        p_disvar          = gx_variant-variant.
      else.
        message id sy-msgid type 'S'
                     number sy-msgno
                     with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    Atul

  • Add button on seeded Advanced Table, to catch the person_id to generate xml report

    Hi All,
    We are having a requirement to generate pdf report from seeded page.
    And we kind a hit dead end. So was really looking for any inputs or insights.
    We personalized page to add a column with a button in it. We used javascript
    in destination URI to catch the event in PFR.
    javascript:submitForm('DefaultFormName',1,{'xxdbPrintPDF':'YES'});
    All is good until this point. But the EVEN_SOURCE_ROW_REFERENCE is showing as null, when we hit that
    personalized button on page. Where as it is giving right values if clicked on other seeded items in table.
    And each row has a distinct person_id. We need handle to person_id to generate that person specific report.
    Any thoughts would be greatly appreciated.
    Thanks
    Hari

    Forgot to mention earlier. Vacancy page has advanced table listing all the applicants applied.
    We need button across each applicant(i.e in each row). And when we hit that button, if we can get person_id.
    We can use that in whereclauseparams() to get specific rows for xml report.
    Tried to create button programmatically, and still not able to retrieve row number/person id
    PR code
        public void processRequest(OAPageContext oapagecontext,
                                   OAWebBean oawebbean) {
            super.processRequest(oapagecontext, oawebbean);
            OAAdvancedTableBean unUsedCCTxnsTable =
                (OAAdvancedTableBean)oawebbean.findIndexedChildRecursive("ApplicantQueryRegion");
            if (unUsedCCTxnsTable !=
                null) //If not able to find the table, skip the process
                //Create new column Category to the table
                OAColumnBean categoryCol =
                    (OAColumnBean)createWebBean(oapagecontext, COLUMN_BEAN, null,
                                                "XxcfiCategoryColumn1");
                OASortableHeaderBean column1Header =
                    (OASortableHeaderBean)createWebBean(oapagecontext,
                                                        SORTABLE_HEADER_BEAN, null,
                                                        "XxcfiCategoryColumn1Header1");
                column1Header.setText("Category");
                categoryCol.setColumnHeader(column1Header);
                // Create the actual leaf item under the first column
                OAMessageStyledTextBean leaf1 =
                    (OAMessageStyledTextBean)createWebBean(oapagecontext,
                                                           MESSAGE_STYLED_TEXT_BEAN,
                                                           null,
                                                           "XxcfiCategoryColumnLeaf1");
                leaf1.setViewAttributeName("AplPersonId");
                categoryCol.addIndexedChild(leaf1);
                unUsedCCTxnsTable.addIndexedChild(categoryCol);
                //add submitbutton
                 //Create new column Category to the table
                 OAColumnBean categoryCol1 =
                     (OAColumnBean)createWebBean(oapagecontext, COLUMN_BEAN, null,
                                                 "XxcfiCategoryColumn2");
                 OASortableHeaderBean column1Header1 =
                     (OASortableHeaderBean)createWebBean(oapagecontext,
                                                         SORTABLE_HEADER_BEAN, null,
                                                         "XxcfiCategoryColumn1Header2");
                 column1Header.setText("PDF");
                 categoryCol.setColumnHeader(column1Header);
                OASubmitButtonBean submitButton =(OASubmitButtonBean)createWebBean(oapagecontext,
                OAWebBeanConstants.BUTTON_SUBMIT_BEAN, null, "submitButton");
                submitButton.setViewAttributeName("AplPersonId");
                unUsedCCTxnsTable.addIndexedChild(submitButton );
    PFR code
        public void processFormRequest(OAPageContext pageContext,
                                       OAWebBean webBean) {
            OAApplicationModule appModule =
                pageContext.getApplicationModule(webBean);
            OAViewObject vo =
                (OAViewObject)appModule.findViewObject("ApplicantListVO");
            oracle.jbo.domain.Number num = null;
            if (vo != null) {
                OARow row = (OARow)vo.getCurrentRow();
                if (row != null) {
                    num =
    (oracle.jbo.domain.Number)row.getAttribute("AplPersonId");
            throw new OAException("Button Clicked by HM " + num.toString() +
                                  "-----" +
                                  pageContext.getParameter("XxcfiCategoryColumnLeaf1") +
                                  "-----" +
                                  pageContext.getParameter("submitButton") +
                                  "-----" +
                                  (String)pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE),
                                  OAException.ERROR);
    Any ideas will be of great help
    Thanks

  • How can i catch the gotfocus and lostfocus events

    Hi Dear;
    i tried to catch the gotfocus and lostfocus events, but i can't.
    in the same code i can catch the onclick events.
    is there any special code for the gotfocus and lostfocus events?
    regards;

    Danny;
    Whenever I have an issue such as this I fire up the event logger and it will show you exactly which events you can put your hooks into.   If you are not using it you should really check it out.  Will save you tons of time.
    https://www.sdn.sap.com/irj/sdn/businessone-tools
    I know it's not the exact answer you were looking for but I hope it helps.
    Wayne

Maybe you are looking for

  • Airport Extreme migration to Time Capsule

    I just got my new TC and want to change my current wireless network and Internet access from AP Xtreme to TC. Any important tips or advice I should have before beginning? Do I set up a new Network or just migrate? I currently use Time Machine to back

  • HD TV resolution on apple tv

    I just got my apple tv and set it up. Everything seems to be working fine...and as expected. the only question I have is in setting the tv resolution. The only option the set up menu gave me was 480p. My tv is a Samsung HD 1080i receiver. I am connec

  • Business Explorer Roles and Authorizations

    Hi, I am using Business Explorer Query Designer and Analyzer ( Excel Work book add on) with BI 7.0. I need to create roles and authorizations for the end users to create queries and view queries in excel by using Business Explorer Query Analyzer. Kin

  • Code help on local db connection

    I have a simple db and want to pull that onto the stage into a TextArea with html format so I can use some of the db fields as urls. For testing I have this code creating two text fields, one with text.html call and one with the appent.text. The firs

  • SRM Error Log

    Is there a function I can use to write to the SRM Error Log? The Error Log I understand is accessible via transaction SLG1.