Hi guys,
I met a problem about calling linux comand in java program.
In linux, I type :
similarity.pl -type WordNet::Similarity::vector -file /home/csunix/fzsu/exam.txt
it returns:
Loading WordNet... done.
Loading Module... done.
good#a#1 nice#a#1
good#a#1 nice#a#1 0.885813537770033

dog#n#1 cat#n#1
dog#n#1 cat#n#1 0.712603873475428

good#a#6 nice#a#1
good#a#6 nice#a#1 0.822428178005622

From above, we can see that it works well, similarity.pl is a perl program for computing similarity between two concept, and -type and -file are the parameters.

Now I want to use java to call these command, and here is my code:
public static void main(String[] args) {
try{

String command="similarity.pl -type WordNet::Similarity::vector -file /home/csunix/fzsu/exam.txt";
Process p=Runtime.getRuntime().exec(command);
BufferedReader br=new BufferedReader(new InputStreamReader(p.getInputStream()));
String line=null;
while ((line=br.readLine())!=null){
System.out.println(line);
}
}catch (IOException ex){
ex.printStackTrace();
}

}

But noting is print out. I also add the full path for similarity.pl, like /home/csunix/fzsu/similarity.pl in the variable "command", but still the same.

I also change variable "command" to a string array in this way:

String command[]={"/home/csunix/nlplib/WordNet/2.1-F7/perl/bin/similarity.pl",
"-type","WordNet::Similarity::vector","-file","/home/csunix/fzsu/exam.txt"};

Again, I get nothing from it.
Can anyone point out how to solve this problem?

Thanks,
Joe