Defects4j数据集是14年由Michael D. Ernst老师及其合作者一起发布的Java运行时缺陷数据集,近年来已经被广泛应用在相关研究中,如近期就有这些论文用到了这个数据集:
Chen, Yizhen, et al. "Effective online software anomaly detection." Proceedings of the 26th ACM SIGSOFT International Symposium on Software Testing and Analysis. ACM, 2017.
Sohn, Jeongju, and Shin Yoo. "FLUCCS: using code and change metrics to improve fault localization." Proceedings of the 26th ACM SIGSOFT International Symposium on Software Testing and Analysis. ACM, 2017.
所以应该说这个数据集还是很有用的,其目前的项目主页:
https://github.com/rjust/defects4j
看到上面这个链接中写到,要正确使用这个数据集,运行环境需要满足以下要求:
Java 1.7
Perl >= 5.0.10
Git >= 1.9
SVN >= 1.8
由于我之前Linux系统的JDK是1.8的,为了确保能正确使用该数据集,我在一个Ubuntu虚拟机上重新设置了一下环境。上面这些要求,就是Java的JDK安装起来稍微有点麻烦,可以参考网上很多现成的流程,例如:
http://www.cnblogs.com/a2211009/p/4265225.html
设置好运行环境后,仿照其git hub上主页的说明,运行:
结果报错:
Can't locate DBI.pm in @INC (you may need to install the DBI module)
简单搜了以下,还是在Stack Overflow上的看到了靠谱的解决方案:
https://stackoverflow.com/questions/20568836/cant-locate-dbi-pm
之后就可以正确按照其说明使用该数据集了,最后简单列以下我配置jdk时候的一些命令。
sudo tar -zxvf jdk-7u80-linux-x64.tar.gz -C /usr/lib/jvm
sudo gedit ~/.bashrc
#set oracle jdk environment
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_80
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_80/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_80/bin/javac 300
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.7.0_80/bin/jar 300
sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jdk1.7.0_80/bin/javah 300
sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.7.0_80/bin/javap 300