r - Runtime.getRuntime().exec gets no results when used from java netbeans -
i working on java project, , stuck @ step showing no results.
the java code is:
public class callpgs { public static void main(string[] args) { // todo auto-generated method stub try{ process p = runtime.getruntime().exec("c:/r/r-3.2.0/bin/rscript.exe c:/r/r-3.2.0/bin/arrayqualitymetrics.r"); int processcomplete = p.waitfor(); if (processcomplete == 0) { joptionpane.showmessagedialog(null,"process completed"); system.out.println("successfull"); } else { joptionpane.showmessagedialog(null,"you have selected wrong input file"); system.out.println("could not complete"); } } catch (exception e1) { e1.printstacktrace(); } }
}
as executing using command prompt using rscript.exe
c:\r\...\bin\rscript "arrayqualitymetrics.r"
i getting results correctly when doing java netbeans using above code, showing else option "could not complete" in netbean's console.
as other rscripts running , without error 1 not giving results, rscript arrayqualitymetrics as:-
library(arrayqualitymetrics)
library(limma)
library(tcltk)
options( warn = -1 ) #commands removing warnings comming when running rscript r console.
x <-tk_choose.files(caption = "choose files")
madata<-read.maimages(x, source="agilent", other.columns = "gprocessedsignal", green.only=true)
eset<-new("expressionset", exprs = madata$other$gprocessedsignal, annotation =madata$genes[,7])
arrayqualitymetrics(eset, outdir="qc_c", force = true, do.logtransform = true)
so want ask weather there error in rscript or there thing should add in java code run properly.... appreciable......
you can :
try{ process p = runtime.getruntime().exec("c:\\r\\r-3.2.0\\bin\\rscript.exe c:\\dir\my_script.r"); int processcomplete = p.waitfor(); if (processcomplete == 0) { system.out.println("successfull"); } else { system.out.println("could not complete"); } } catch (exception e) { e.printstacktrace(); } }
try add full path file need executed. have tried simple example , works fine me.
process process = runtime.getruntime().exec("notepad c:\\abc.txt");
Comments
Post a Comment