olap4j proposes a driver for generic XML for Analysis (XMLA) providers. Therefore, you can use it to connect to the XMLA interface of icCube.
Here is a short example demonstrating how to setup a XMLA connection and executing a MDX query against icCube (assuming default settings for icCube). You can leave both the username and password as null if anonymous logon is authorized.
Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver"); final Connection connection = DriverManager.getConnection( "jdbc:xmla:Server=http://localhost:8282/iccube/xmla;Catalog=Sales (Mixed - XML Definition)", "demo", "demo" ); final OlapConnection olapConnection = connection.unwrap(OlapConnection.class); String query = "SELECT [Product].members ON 0 FROM [Sales]"; final CellSet cellSet = olapConnection.createStatement().executeOlapQuery(query); final RectangularCellSetFormatter formatter = new RectangularCellSetFormatter(false); final PrintWriter writer = new PrintWriter(System.out); formatter.format(cellSet, writer); writer.flush();