Error preventing me from calling bash script from Matlab

2 visualizaciones (últimos 30 días)
Michael
Michael el 14 de Mayo de 2015
Comentada: Arturo Magana el 24 de Oct. de 2016
Hi,
I'm having a problem calling a bash script from within Matlab. I have a bash script that basically calls this line of code.
java -d64 -Xmx3G -jar GeneMANIA-v3.3.4.jar QueryRunner --data gmdata-2014-08-12-core --in flat --results result_dir --verbose InputFile.txt
I want to run this iteratively many many times, but with a different InputFile.txt each time, hence why I want to call it within a loop in Matlab (in Matlab, I'm doing various other things before and after that which are essential for my purposes, so I'd prefer to be able to call this one line as well directly from within Matlab).
However, I have tried several things for calling the script from within Matlab, and everytime I get this message:
Error: A JNI error has occurred, please check your installation and try again
Error: A JNI error has occurred, please check your installation and try again
bash runGeneManiaAnalysis.sh: Signal 127
I have tried calling it using:
fname = 'runGeneManiaAnalysis.sh';
unix(sprintf('bash %s',fname));
system(sprintf('bash %s',fname));
!bash runGeneManiaAnalysis.sh
This is a problem that I get only when I try to run it from within Matlab. If I go directly to the Terminal and run it from there, it runs fine without a problem. I'm using Matlab R2014b (8.4.0 150421) 64 bit (maci64).
So can anyone please help me ascertain what's going wrong and how I can fix this issue?
Thanks,
Mike

Respuesta aceptada

Walter Roberson
Walter Roberson el 14 de Mayo de 2015
You could be having a PATH or java classpath difficulty. At the terminal prompt, give the command
printenv | egrep -i '(path|java)'
and then at the MATLAB prompt try
!printenv | egrep -i '(path|java)'
and compare the two.
  4 comentarios
Michael
Michael el 14 de Mayo de 2015
Hi Walter,
This did the trick. Thanks so much for the help!
Mike
Arturo Magana
Arturo Magana el 24 de Oct. de 2016
Walter, thank you so much for this answer. I was having the same issue as Michael, this solved everything!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by