我想运行以下项目:
https://gforge.inria.fr/plugins/mediawiki/wiki/melinda/index.php/RDF_keys
在项目页面中,他们将恢复以下步骤:
1-git clone https://gforge.inria.fr/git/melinda/melinda.git
2-cd melinda/trunk/rdfifd/
3-ant jar
4- java -jar pseudo-keys.jar -t -i /path/to/rdf_file -o /path/to/output/file
那么如何在eclipse项目中集成和运行这个项目呢?
我已经在linux命令行上关注这些setp了,它运行良好,并生成了伪key.jar。我把这个.jar和我的笔记本电脑上写下面的代码:
public class TestDriver {
/** Executes a command */
public static void execute(String cmd, File folder) throws Exception {
Process p = Runtime.getRuntime().exec(cmd, null, folder);
BufferedReader bri = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader bre = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String s1, s2 = null;
while (null != (s1 = bri.readLine()) || null != (s2 = bre.readLine())) {
if (s1 != null) System.out.println(s1);
if (s2 != null) System.err.println(s2);
}
p.waitFor();
}
public static void main(String[]args) throws Exception{
String cmd = "java -jar C:/Users/user/Desktop/pseudo-keys.jar -t -i C:/Users/user/Desktop/randomLocation/datasetLocation/restaurant1.rdf -o C:/Users/user/Desktop/randomLocation/key.xml";
execute(cmd, null);
}
执行会出现以下错误:
java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli.ParseException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main"
任何帮助请运行代码?我的错误在哪里?
谢谢
答案 0 :(得分:0)
https://gforge.inria.fr/git/melinda/melinda.git
复制到剪贴板rdfifd/build.xml
,方法是双击jar
,然后选择 运行方式> Ant Build java -jar pseudo-keys.jar -t -i /path/to/rdf_file -o /path/to/output/file
。或者,您可以使用必要的参数(运行&gt;运行配置... ,在选项卡<中跳过步骤4和5以及运行fr.inrialpes.exmo.rdfkeys.KeyExtraction
作为Java应用程序 em> Arguments field 程序参数)。