<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Microsoft YaHei";
        panose-1:2 11 5 3 2 2 4 2 2 4;}
@font-face
        {font-family:"\@Microsoft YaHei";}
@font-face
        {font-family:"color\:\#333333\;background\:white\;";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"color\:\#E53333\;background\:white\;";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.E-MailFormatvorlage20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi Jing,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I would suggest you to look after the line “
</span><span lang="EN-US">SootClass c = Scene.v().forceResolve("HelloWorld", SootClass.BODIES);” if you really got the HelloWorld class. If it is the case, you can use “c.getMethods()” to get all methods in c. Simply iterate it and look if the method test is
 in it. I think it is not hard to debug where the problem was.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Best regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Linghui Luo <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span lang="EN-US"><o:p> </o:p></span></a></p>
<span style="mso-bookmark:_MailEndCompose"></span>
<p class="MsoNormal"><b>Von:</b> <span lang="ZH-CN" style="font-family:"Microsoft YaHei",sans-serif">
张婧</span> [mailto:m201672947@hust.edu.cn] <br>
<b>Gesendet:</b> Freitag, 22. Dezember 2017 10:59<br>
<b>An:</b> Linghui Luo <linghui.luo@uni-paderborn.de><br>
<b>Betreff:</b> Re: AW: [Soot-list] Questions about soot<span lang="ZH-CN" style="font-family:"Microsoft YaHei",sans-serif">:</span>how to use soot to analysis java project<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p>Hello Linghui<span lang="ZH-CN" style="font-family:DengXian">,</span><span lang="ZH-CN">
</span><o:p></o:p></p>
<p>Thank you for your help. <o:p></o:p></p>
<p>there is another question: <o:p></o:p></p>
<p>I want to set the main method as entry point by myself. <o:p></o:p></p>
<p>such as: <o:p></o:p></p>
<p>package temp;//current package<br>
import util.Unit; <o:p></o:p></p>
<p><br>
public class HelloWorld {<br>
<br>
public static void main(String[] args) {<br>
// TODO Auto-generated method stub<br>
}<br>
<br>
 public void test(int in) {<br>
  Unit unit = new Unit();<br>
unit.A();<br>
}<br>
}<o:p></o:p></p>
<p>Unit is a class in other package "util". <o:p></o:p></p>
<p>I want set the "test()" as the entry point. <o:p></o:p></p>
<p>so: <o:p></o:p></p>
<p> Options.v().parse("-cp D:\\eclipseProject\\HelloWorld\\bin -pp");<br>
SootClass c = Scene.v().forceResolve("HelloWorld", SootClass.BODIES);<br>
c.setApplicationClass();<br>
Scene.v().loadNecessaryClasses();<br>
SootMethod method = c.getMethodByName("test");<br>
List entryPoints = new ArrayList();<br>
entryPoints.add(method);<br>
Scene.v().setEntryPoints(entryPoints);<br>
PackManager.v().runPacks(); <o:p></o:p></p>
<p><o:p> </o:p></p>
<p>.class files are in folder "bin". <o:p></o:p></p>
<p>I get the following error: <o:p></o:p></p>
<p><o:p> </o:p></p>
<p>Exception in thread "main" java.lang.RuntimeException: couldn't find method test(*) in HelloWorld<br>
at soot.SootClass.getMethodByName(SootClass.java:494)<br>
at s1test.Test.main(Test.java:27)<o:p></o:p></p>
<p>Can you help me? <o:p></o:p></p>
<p><o:p> </o:p></p>
<p>Thank you very much. <o:p></o:p></p>
<p>Hope to receive your reply soon. <o:p></o:p></p>
<p>Best Regards, <o:p></o:p></p>
<p><o:p> </o:p></p>
<p>Jing <o:p></o:p></p>
<p><o:p> </o:p></p>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #B6B6B6 1.5pt;padding:0cm 0cm 0cm 4.0pt;margin-left:3.75pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-bottom:12.0pt">-----<span lang="ZH-CN" style="font-family:DengXian">原始邮件</span>-----<br>
<b><span lang="ZH-CN" style="font-family:DengXian">发件人</span>:</b>"Linghui Luo" <<a href="mailto:linghui.luo@uni-paderborn.de">linghui.luo@uni-paderborn.de</a>><br>
<b><span lang="ZH-CN" style="font-family:DengXian">发送时间</span>:</b>2017-12-21 22:01:47 (<span lang="ZH-CN" style="font-family:DengXian">星期四</span>)<br>
<b><span lang="ZH-CN" style="font-family:DengXian">收件人</span>:</b> "<span lang="ZH-CN" style="font-family:DengXian">张婧</span>" <<a href="mailto:m201672947@hust.edu.cn">m201672947@hust.edu.cn</a>><br>
<b><span lang="ZH-CN" style="font-family:DengXian">抄送</span>:</b> <br>
<b><span lang="ZH-CN" style="font-family:DengXian">主题</span>:</b> AW: [Soot-list] Questions about soot<span lang="ZH-CN" style="font-family:DengXian">:</span>how to use soot to analysis java project<o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">Hello Jing,</span><span lang="EN-US">
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> </span><span lang="EN-US">
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">You need to compile your java source code (.java files) to java bytecode (.class files) at first. You can use soot to analyze the bytecode, namely .class files.
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">You can set soot class path with “Options.v().set_soot_classpath(targetDir)” or use the soot command line options “-cp targetDir -pp” (in your screenshot Options.v().parse(“-cp
 targetDir -pp”)),   “targetDir” should be the path of folder which includes the packages of the .class files you want to analyze.
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> </span><span lang="EN-US">
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">Best,</span><span lang="EN-US">
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">Linghui Luo</span><span lang="EN-US">
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> </span><span lang="EN-US">
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b>Von:</b> Soot-list [mailto:<a href="mailto:soot-list-bounces@CS.McGill.CA">soot-list-bounces@CS.McGill.CA</a>]
<b>Im Auftrag von </b>??<br>
<b>Gesendet:</b> Donnerstag, 21. Dezember 2017 03:43<br>
<b>An:</b> <a href="mailto:soot-list@cs.mcgill.ca">soot-list@cs.mcgill.ca</a><br>
<b>Betreff:</b> [Soot-list] Questions about soot<span lang="ZH-CN" style="font-family:DengXian">:</span>how to use soot to analysis java project
<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> 
<o:p></o:p></p>
<p>Hi, <o:p></o:p></p>
<p>My name is Jing. I'm new to use soot, so I <span style="font-family:"color:#333333;background:white;",serif">meet some challenges.</span>
<o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">Followings are my questions:</span>
<o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">I want to use soot to analyse java projects or 3rd-party libraries, not apk.</span>
<o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">For example</span><span lang="ZH-CN" style="font-family:DengXian;color:#333333;background:white">:</span><span lang="ZH-CN">
</span><o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">project like</span>
<o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif"><img border="0" width="263" height="255" style="width:2.7416in;height:2.6583in" id="_x0000_i1025" src="cid:image001.png@01D37B16.211493D0"></span><o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">there many different packages</span><span lang="ZH-CN" style="font-family:DengXian;color:#333333;background:white">,</span><span style="font-family:"color:#333333;background:white;",serif">I
 want to analyse this project.(or a jar provides function interfaces)</span> <o:p>
</o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">What‘s more</span><span lang="ZH-CN" style="font-family:DengXian;color:#333333;background:white">,</span><span style="font-family:"color:#333333;background:white;",serif">I’'d like to set
 the entry point by myself.</span> <o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">I found some helps from tutorials in github,:</span>
<o:p></o:p></p>
<p><strong><span style="font-size:13.5pt;font-family:"color:#333333;background:white;",serif">1. using "-process-dir" </span></strong>
<o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif"><img border="0" id="_x0000_i1026" src="/coremail/s/json?func=mbox:getComposeData&sid=*&composeId=1513820430411&attachId=1"></span><o:p></o:p></p>
<p><span style="font-size:13.5pt;font-family:"color:#333333;background:white;",serif">2. analyse project without
<strong><span style="font-family:"color:#333333;background:white;",serif">main </span>
</strong>method:</span> <o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif"><img border="0" width="731" height="484" style="width:7.6166in;height:5.0416in" id="_x0000_i1027" src="cid:image002.png@01D37B16.211493D0"></span><o:p></o:p></p>
<p>  <o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">But I cann't run it successfully.</span>
<o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">When java files in different packages</span><span lang="ZH-CN" style="font-family:DengXian;color:#333333;background:white">,</span><span style="font-family:"color:#333333;background:white;",serif">there
 are errors about “</span><span style="font-family:"color:#E53333;background:white;",serif">cann't find class:***</span><span style="font-family:"color:#333333;background:white;",serif">”</span>
<o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">I also failed in setting the main method</span>
<o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">So, Does Soot can analyse the java project having  without main method</span><span lang="ZH-CN" style="font-family:DengXian;color:#333333;background:white">?</span><span lang="ZH-CN">
</span><o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">If yes, someone can provide me a example in detail?</span>
<o:p></o:p></p>
<p>  <o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">Thank you very much.</span>
<o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">Hope to receive reply soon.</span>
<o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">Best Regards.</span>
<o:p></o:p></p>
<p>  <o:p></o:p></p>
<p><span style="font-family:"color:#333333;background:white;",serif">Jing</span> <o:p>
</o:p></p>
<p>  <o:p></o:p></p>
<p>  <o:p></o:p></p>
</div>
</blockquote>
</div>
</body>
</html>