[Soot-list] using soot within an eclipse plugin

Jennifer Lhotak jlhotak at cs.mcgill.ca
Thu Jun 9 15:48:12 EDT 2005


Hi,

In your Approach #1:

Do you get a message from Soot saying something like: Exception in thread
"main" java.lang.RuntimeException: couldn't find class: ... (is
your soot-class-path set properly?) ? If so, then Soot is being invoked
with no problems, but it doesn't know where the class you want to load is.

It sounds as if you need to explicitly set the Soot classpath, before you
call loadClassAndSupport() so you could say something like

Options.v().set_soot_classpath(your_classpath)

where your_classpath is a
string and includes the path to your class in Eclipse. You should be able
to find the path to your class programmatically from within Eclipse using
the resources api.

Note that the string your_classpath will probably also need to include a
path to the java library, which can also be found programmatically from
within Eclipse.

Jennifer

On Thu, 9 Jun 2005, Arjun Singh wrote:

> Hi,
>
> I currently have an Java application that uses soot.  I would like to
> encapsulate the functionality of this application in an eclipse
> plugin.  Unfortunately I have been unsuccessful in doing so.  Below
> are the processes I followed.
>
> Attempt #1: Use soot files from jar
> 1.  I created a plugin by using the 'plugin with a view' template.
> 2.  In the project directory, I created a lib folder and put the jar
> file containing all soot classes in it.
> 3.  I added this jar file to the build path by right clicking on the
> project, selecting project, then selecting java build path, clicking
> on the Add Jars button, and selecting the jar file.
> 3.  I added library tags within the runtime tags within the
> plugin.xml file
> 4.  In the java file for the view, within the Action definition for
> pressing one of the buttons of the view, I called a function I wrote
> in a class which calls soot functions.  This class attempts to call
> dk.brics.StringAnalysis, part of another jar file which I use.  This
> function attempts to call Scene.v().loadClassAndSupport with a class
> name of a class that I created in the runtime workbench.
> 5.  The call to loadClassAndSupport fails because soot cannot locate
> the class I am trying to analyze.
>
> I suspect the problem is related to the classpath of the runtime
> workbench.  I was unable to have soot find the class
>
> Approach #2: Use the soot plugin
> When I could not get the jar file with the soot classes to work
> within the eclipse plugin, I installed the soot eclipse plugin (by
> following the directions given on the soot website) and then tried to
> have my plugin use the classes found within the soot plugin.
> However, when I tried to call the soot functions from within my
> plugin, an unhandled event loop exception occurred, which translates
> to eclipse being unable to find/load the soot classes, which I find
> very odd considering the plugin had been installed and I relaunched
> eclipse.
>
> Does anybody have any suggestions or advice for me?  Any help would
> be greatly appreciated.
>
> Thanks,
> Arjun
>
>
>



More information about the Soot-list mailing list