看板 R_Language 關於我們 聯絡資訊
[問題類型]: 程式諮詢 [軟體熟悉度]: 使用者 [問題敘述]: 我試著在java回傳2d string array 一直給我這樣的錯誤 method getStringMatrix with signature ()[[S not found [程式範例]: R code: library(rJava) .jinit() .jaddClassPath("pathToClass") test = .jnew("Mytest") out = .jcall(test, "[[S", "getStringMatrix", simplify=TRUE) # error out2 = .jcall(test, "[[I", "getIntMatrix", simplify=TRUE) # It works workable code: out = .jcall(test, "[[Ljava/lang/String;", "getStringMatrix", simplify=TRUE) java code myTest.java: public class myTest { public String[][] getStringMatrix(){ String[][] stringMatrix = new String[][]{{"ABC", "BCD"}, {"CDE", "DEF"}}; return stringMatrix; } public int[][] getIntMatrix() { int[][] intMatrix = new int[][]{{1,2,3},{4,5,6}}; return intMatrix; } public static void main(String[] args) { } } [關鍵字]: rjava, string array -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.224.150.158 ※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1425783081.A.44D.html
Wush978: 看起來是java method signature沒有兜起來, 可能要問java03/08 19:20
Wush978: 專家03/08 19:20
Wush978: http://ppt.cc/AkU1 03/08 19:22
太感謝了!... 我一直google不到相關資訊,方便的話,可以問關鍵字是下什麼?
Wush978: 我忘了耶 XD 03/08 21:48
沒關係@@ 我知道下次要直接在stack overflow搜尋... google搜尋猶如大海撈針....還會自動幫你改關鍵字~"~ ※ 編輯: celestialgod (36.225.213.5), 03/08/2015 23:30:25