|
From: Antonio T. <Ant...@il...> - 2009-01-25 19:01:20
|
Hi Ted,
finally I figured out how to do it. I've changed this part of the code:
String command = "text_similarity.pl --type=Text::Similarity::Overlaps --
string \"" + string1 + "\" \"" + string2 + "\"";
Process p = Runtime.getRuntime().exec(command);
with:
Vector<String> command = new Vector<String>();
command.add("text_similarity.pl");
command.add("--type=Text::Similarity::Overlaps");
command.add("--string");
command.add(string1);
command.add(string2);
ProcessBuilder pb = new ProcessBuilder(command);
Process p = pb.start();
and now it works smoothly. Hope it can be useful for someone.
Regards,
Antonio
> Hi Antonio,
>
> I'm afraid I have very little experience with Java, so I don't really
> know how to include Perl in a Java program. I do know that there are
> Perl modules that let you do the opposite, that is include Java in
> Perl programs .... this is most commonly done with Inline::Java, which
> can be found here :
>
> http://search.cpan.org/~patl/Inline-Java/
>
> I don't know if that would give any ideas about how to include Perl in
> Java, but it's about the only thing I could think of to mention.
>
> Please do let us know if you figure this out, seems like potentially a
> very useful technique.
>
> Cordially,
> Ted
|