Hi, I'm trying to call the Java code (way) below. I can't seem to form the call correctly from perl (inline::Java).
To call it from native Java its like: EClientErrors.CONNECT_FAIL.msg(); After I've imported the proper Java in my perl code (I know I've imported things correctly, because I can instantiate and interact with other Java classes). I've tried: my $error = com::ib::client::EClientErrors->new; print $error->CONNECT_FAIL,"\n"; print $error->{CONNECT_FAIL},"\n"; print $error->CONNECT_FAIL->msg,"\n"; print $error->{CONNECT_FAIL}->msg,"\n"; print com::ib::client::EClientErrors->CONNECT_FAIL,"\n"; print com::ib::client::EClientErrors->{CONNECT_FAIL},"\n"; print com::ib::client::EClientErrors->CONNECT_FAIL->msg,"\n"; print com::ib::client::EClientErrors->{CONNECT_FAIL}->msg,"\n"; but I alway get a Java error along the lines of: No public method 'CONNECT_FAIL' defined for class 'main::com::ib::client::EClientErrors' at ./in4 How do I form the call properly? Thanks Jay Below is the source Java: /* * EClientErrors.java * * Created on February 28, 2002, 1:07 PM */ package com.ib.client; /** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2003</p> * <p>Company: Interactive Brokers Group LLC</p> * @author : * @version : */ /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// // // Class EClientErrors // /////////////////////////////////////////////////////////////////////////// public class EClientErrors { /////////////////////////////////////////////////////////////////////// // Public members /////////////////////////////////////////////////////////////////////// static final int NO_VALID_ID = -1; static final CodeMsgPair ALREADY_CONNECTED = new CodeMsgPair( 501, "Already connected."); static final CodeMsgPair CONNECT_FAIL = new CodeMsgPair( 502, "Couldn't connect to TWS. Confirm that \"Enable ActiveX and Socket Clients\" is enabled on the \"Settings\" menu."); static final CodeMsgPair UPDATE_TWS = new CodeMsgPair( 503, "The TWS is out of date and must be upgraded."); static final CodeMsgPair NOT_CONNECTED = new CodeMsgPair( 504, "Not connected"); static final CodeMsgPair UNKNOWN_ID = new CodeMsgPair( 505, "Fatal Error: Unknown message id."); static final CodeMsgPair FAIL_SEND_REQMKT = new CodeMsgPair( 510, "Request Market Data Sending Error - "); static final CodeMsgPair FAIL_SEND_CANMKT = new CodeMsgPair( 511, "Cancel Market Data Sending Error - "); static final CodeMsgPair FAIL_SEND_ORDER = new CodeMsgPair( 512, "Order Sending Error - "); static final CodeMsgPair FAIL_SEND_ACCT = new CodeMsgPair( 513, "Account Update Request Sending Error -"); static final CodeMsgPair FAIL_SEND_EXEC = new CodeMsgPair( 514, "Request For Executions Sending Error -"); static final CodeMsgPair FAIL_SEND_CORDER = new CodeMsgPair( 515, "Cancel Order Sending Error -"); static final CodeMsgPair FAIL_SEND_OORDER = new CodeMsgPair( 516, "Request Open Order Sending Error -"); static final CodeMsgPair UNKNOWN_CONTRACT = new CodeMsgPair( 517, "Unknown contract. Verify the contract details supplied."); static final CodeMsgPair FAIL_SEND_REQCONTRACT = new CodeMsgPair( 518, "Request Contract Data Sending Error - "); static final CodeMsgPair FAIL_SEND_REQMKTDEPTH = new CodeMsgPair( 519, "Request Market Depth Sending Error - "); static final CodeMsgPair FAIL_SEND_CANMKTDEPTH = new CodeMsgPair( 511, "Cancel Market Depth Sending Error - "); static final CodeMsgPair FAIL_SEND_SERVER_LOG_LEVEL = new CodeMsgPair( 511, "Set Server Log Level Sending Error - "); /////////////////////////////////////////////////////////////////////// // Constructors /////////////////////////////////////////////////////////////////////// /** * */ public EClientErrors() { } /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// // // Class CodeMsgPair // /////////////////////////////////////////////////////////////////////// static public class CodeMsgPair { /////////////////////////////////////////////////////////////////// // Public members /////////////////////////////////////////////////////////////////// int m_errorCode; String m_errorMsg; /////////////////////////////////////////////////////////////////// // Get/Set methods /////////////////////////////////////////////////////////////////// public int code() { return m_errorCode; } public String msg() { return m_errorMsg; } /////////////////////////////////////////////////////////////////// // Constructors /////////////////////////////////////////////////////////////////// /** * */ public CodeMsgPair(int i, String errString) { m_errorCode = i; m_errorMsg = errString; } } }