Selecting a Java Program to Query (CLI)

To query a Java program, one has to load this program as a Java project in an Eclipse workspace first. Next, SOUL has to launch Eclipse to query the Java project. This can be done either from the Smalltalk GUI or from the command line using a configuration file. 

The following steps describe the latter approach. Afterwards, proceed either to Querying from Smalltalk (if you want to interact with SOUL from within the Smallltalk IDE) or Querying from Eclipse (if you want to interact with SOUL from within the Eclipse IDE) for information on how to launch a SOUL query and inspect its results. 

1. Save the following XML configuration file (soulconfig.xml) and its accompanying DTD (SOULForEclipseConfiguration.dtd) to the same directory (preferably the one in which the Smalltalk image containing SOUL resides). 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE SOULFORECLIPSECONFIGURATION SYSTEM "SOULForEclipseConfiguration.dtd">
<SOULFORECLIPSECONFIGURATION>
	<!-- Parameters needed by JavaConnect to launch a JVM. -->
	<JVM>
		<!-- Location to and name(s) of JVM shared library ("libjvm.so", "libclient.dylib", "msvcr71.dll jvm.dll" on Linux, OSX, Windows). -->
		<LIBJVM name="libjvm.so" path="/home/cderoove/jdk1.6.0_23/jre/lib/i386/client/"/> 
		<!-- Class path suffix. Its value will be added to the class path computed for your Eclipse configuration.--> 
		<CLASSPATH value=""/>
		<!-- Additional JVM options. -->
		<OPTIONS>
			<OPTION value="Xmx1400m"/>
			<!-- 
			<OPTION value="Dcom.sun.management.jmxremote"/>
			<OPTION value="Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044"/>
			-->
		</OPTIONS>
	</JVM>
	<!-- Path to your Eclipse installation. Headless determines whether the Eclipse GUI is shown. -->
	<ECLIPSE headless="false" path="/home/cderoove/eclipse/">
		<!-- Path to the workspace Eclipse should be opened on. Required for headless launches. -->
		<WORKSPACE path="/home/cderoove/workspaceExamples"/>
	</ECLIPSE>
</SOULFORECLIPSECONFIGURATION>

 

<!ELEMENT SOULFORECLIPSECONFIGURATION (JVM, ECLIPSE)>
<!ELEMENT JVM (LIBJVM, CLASSPATH, OPTIONS)>
<!ELEMENT LIBJVM  EMPTY>
<!ATTLIST LIBJVM name CDATA #REQUIRED>
<!ATTLIST LIBJVM path CDATA #REQUIRED>
<!ELEMENT CLASSPATH EMPTY>
<!ATTLIST CLASSPATH value CDATA "">
<!ELEMENT OPTIONS (OPTION*)>
<!ELEMENT OPTION EMPTY>
<!ATTLIST OPTION value CDATA #REQUIRED>
<!ELEMENT ECLIPSE (WORKSPACE?)>
<!ATTLIST ECLIPSE headless (false|true) "false">
<!ATTLIST ECLIPSE path CDATA #REQUIRED>
<!ELEMENT WORKSPACE EMPTY>
<!ATTLIST WORKSPACE path CDATA #REQUIRED>

2. Edit the XML configuration file for you particular Eclipse and JVM installation. 

3. Launch the Smalltalk image that contains SOUL with the command-line option "-launchSoulForJavaFromFile". This option takes the XML configuration file as an argument. With this option, the Smalltalk image will automatically launch the JVM and Eclipse as specified in the XML file. This is illustrated by the following shell script:

#!/bin/sh
VISUALWORKS=/home/cderoove/vw7.7.1nc/
export VISUALWORKS
cd /home/cderoove/images/fromscratch
$VISUALWORKS/bin/linux86/visual visualnc.im -launchSoulForJavaFromFile soulconfig.xml

The above script assumes VisualWorks Smalltalk is installed in /home/cderoove/vw7.7.1nc/ and Soul is loaded in a Smalltalk image visualnc.im that resides together with soulconfig.xml and SOULForEclipseConfiguration.dtd in a directory /home/cderoove/images/fromscratch/ .