开发者

For R & Java Connection

开发者 https://www.devze.com 2023-03-12 18:35 出处:网络
I write this program import java.util.Vector; import org.rosuda.Rserve.*; class rNumber { public static void main(String[] args){

I write this program

import java.util.Vector;
import org.rosuda.Rserve.*;

class rNumber {
  public static void main(String[] args){
    public class RConnection  extends Rengine{
      RConnection c = new RConnection();
      double d[] = c.eval("rnorm(10)").asDoubles(); 
    }
  }
}

thi开发者_如何学运维s program give error illegal start of expression & ; is expected


You can't declare a public class inside a main function... Declare the class outside. Besides, I don't see the point of your rNumber class.

You might do something like this instead :

  import java.util.Vector;
  import org.rosuda.Rserve.*;

  public class RConnection  extends Rengine{
    public static void main(String[] args){
      RConnection c = new RConnection();
      double d[] = c.eval("rnorm(10)").asDoubles(); 
    }
  }
0

精彩评论

暂无评论...
验证码 换一张
取 消