如何在 Eclipse 的 StatET 插件中安装“rj”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3727822/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How does one install 'rj' in StatET plugin for Eclipse?
提问by user441706
I have started to try to use StatET and Texlipse with a view to producing SWEAVE reports. When starting the R console in the StatET plug-in for Eclipse (OS X 10.6.4), I get the message:
我已经开始尝试使用 StatET 和 Texlipse 来生成 SWEAVE 报告。在 Eclipse (OS X 10.6.4) 的 StatET 插件中启动 R 控制台时,我收到消息:
[INFO] The R package 'rj' is not available, R-StatET tools cannot be initialized.
Information on http://www.walware.de/goto/statetstates:
http://www.walware.de/goto/statet 上的信息指出:
"The package only works in the default R Console (RJ) in StatET. Therefore you have to install and update it using the command line":
“该软件包仅适用于 StatET 中的默认 R 控制台 (RJ)。因此您必须使用命令行安装和更新它”:
R CMD INSTALL --no-test-load rj_*.tar.gz
What does this mean exactly?
这究竟是什么意思?
In Eclipse under "Install new Software" and the site
在 Eclipse 下的“安装新软件”和站点
WalWare - http://download.walware.de/eclipse-3.6
it states that
它指出
RJ Core Library 0.5.0.b201008271600sw
is already installed.
已经安装。
Any helpful guidance gratefully received.
感谢您收到任何有用的指导。
采纳答案by Chase
It looks like you need to install the RJ library which can be downloaded from the StatET site here: http://download.walware.de/rj/rj_0.5.0-5.tar.gz(more recent versions of RJ can be found at http://www.walware.de/it/downloads/rj.mframe)
看起来您需要安装 RJ 库,可从此处的 StatET 站点下载该库:http: //download.walware.de/rj/rj_0.5.0-5.tar.gz(可以找到最新版本的 RJ在http://www.walware.de/it/downloads/rj.mframe)
If you save that file on your desktop, you can then load it into R with the command they provided R CMD INSTALL --no-test-load rj_*.tar.gz
after navigating to your desktop or wherever you saved the library file. Alternatively, you MAY be able to use the GUI interface and select Install packages from local ZIP files
under Packages
in R, though I haven't used R on a Mac so the layout may be slightly different.
如果将该文件保存在桌面上,则可以R CMD INSTALL --no-test-load rj_*.tar.gz
在导航到桌面或保存库文件的任何位置后,使用他们提供的命令将其加载到 R 中。或者,您可以使用 GUI 界面并在 RInstall packages from local ZIP files
下选择Packages
,尽管我没有在 Mac 上使用过 R,因此布局可能略有不同。
回答by Allan Stokes
[rant] I also lack the reputation to put my response where it belongs. And there's no button there indicating this. Just a big screen full of nowhere desired to click upon. Negative discoverability sucks. It sucks in Eclipse and it sucks here, too. [/rant]
[咆哮] 我也缺乏将我的回应放在应有的位置的声誉。那里没有按钮指示这一点。只是一个无处可点击的大屏幕。负面的可发现性很糟糕。它在 Eclipse 中很糟糕,在这里也很糟糕。[/咆哮]
I'm finding rj frustrating under Ubuntu. On my system, with each major Ubuntu upgrade with a new version of R, I have to go through this procedure over again.
我发现 rj 在 Ubuntu 下令人沮丧。在我的系统上,每次使用新版本的 R 升级主要的 Ubuntu 时,我都必须重新执行此过程。
One time I tried to use a tilde (~) character in a path name within some Eclipse configuration field. This failed silently.
有一次我尝试在某些 Eclipse 配置字段中的路径名中使用波浪号 (~) 字符。这无声无息地失败了。
My current configuration is as follows. In my ~/.Renviron file:
我目前的配置如下。在我的 ~/.Renviron 文件中:
R_LIBS_USER=~/etc/R/amd64/2.11
Once rJava works, there is an rJava directory here. Just so I don't drive myself insane, in ~/etc/R/README I put a note that my current R configuration is controlled by ~/.Renviron
一旦 rJava 工作,这里就有一个 rJava 目录。为了不让自己发疯,我在 ~/etc/R/README 中注明我当前的 R 配置由 ~/.Renviron 控制
Somehow at one point I ended up with permission problems where
不知何故,我最终遇到了权限问题
R CMD javareconf
was failing. Once in frustration I foolishly ran this under sudo
to work around this problem, and ended up with permission problems on the generated files. Stupid! The correct fix was to make all the files in /etc/R
world readable. Maybe javareconf is only important if you mess with your default Java. Previously, I was running the Sun's JRE. Since 10.10 I'm running icedtea6 and it seems to be working OK. One time it was just the thing to make my configuration work again.
失败了。一旦沮丧,我愚蠢地运行它sudo
来解决这个问题,并最终在生成的文件上出现权限问题。愚蠢的!正确的解决方法是使/etc/R
世界上的所有文件都可读。也许 javareconf 仅在您使用默认 Java 时才重要。以前,我运行的是 Sun 的 JRE。从 10.10 开始,我正在运行 icedtea6,它似乎工作正常。有一次只是让我的配置再次工作。
Once I have the right Java binding, from command line R:
一旦我有了正确的 Java 绑定,从命令行 R:
install.packages("rJava")
I've had file permission problems running this in the past. I think it was fixed by making all files in /etc/R
world readable.
过去我在运行它时遇到了文件权限问题。我认为它是通过使/etc/R
世界上的所有文件都可读来解决的。
The following is a useful diagnostic to see if this worked, from within any R console:
以下是一个有用的诊断,可以从任何 R 控制台中查看这是否有效:
> system.file("jri",package="rJava")
[1] "/home/allan/etc/R/amd64/2.11/rJava/jri"
If it doesn't look right under Eclipse, there is also some startup debugging available, though it took forever before I noticed this in the docs at StatET.
如果它在 Eclipse 下看起来不正确,那么还有一些启动调试可用,尽管我花了很长时间才在 StatET 的文档中注意到这一点。
I created an R Console run configuration for R 2.11 debug
In the JRE tab add -Dde.walware.rj.verbose=true
. In the Common tab, click Allocate additional Error Log Consoles
.
我为R 2.11 debug
In the JRE tab add创建了一个 R Console 运行配置-Dde.walware.rj.verbose=true
。在通用选项卡中,单击Allocate additional Error Log Consoles
。
The main configuration options are as follows. Main tab, Launch Type: RJ
. R_Config tab, you need to select a Configured R Installation, or create/edit one if you don't have one that works. Mine is Name=R, Location=/usr/lib64/R
In the Environment tab I have R_LIBS_USER=/home/USER/etc/R/amd64/2.11
according to how I set things up above. Do not use the tilde (~) character here!
主要配置选项如下。主选项卡,Launch Type: RJ
。R_Config 选项卡,您需要选择一个已配置的 R 安装,或者如果您没有可用的安装,则创建/编辑一个。我的Name=R, Location=/usr/lib64/R
在环境选项卡中,R_LIBS_USER=/home/USER/etc/R/amd64/2.11
根据我上面的设置方式。不要在此处使用波浪号 (~) 字符!
If you end up mucking about with this problem as much as I did, you end up killing a lot of dead consoles. In the Main tab I added the program option --no-save
. I don't think this does anything, since I can't end my console by pressing CTRL-D. In the R_Console tab, I added the following R snippet:
如果你最终像我一样解决这个问题,你最终会杀死很多死机。在 Main 选项卡中,我添加了程序选项--no-save
。我认为这没有任何作用,因为我无法通过按 CTRL-D 来结束我的控制台。在 R_Console 选项卡中,我添加了以下 R 代码段:
q <- function(save = "no", status = 0, runLast = TRUE){
.Internal(quit(save, status, runLast))
#<environment: namespace:base>
}
This gets rid of the annoying "save workspace" prompt when killing an R console with the red square (is that symbolic?) My current workspace also includes a C project, so my R console constantly comes up underneath a blank C-Build console. Annoying as all hell! Haven't solved that yet, but I did discover that from within a StatET code windows the keybinding CTRL-R C pulls the R console to the top.
这消除了在用红色方块杀死 R 控制台时烦人的“保存工作区”提示(这是象征性的吗?)我当前的工作区还包括一个 C 项目,所以我的 R 控制台不断出现在一个空白的 C-Build 控制台下面。烦死了!还没有解决这个问题,但我确实发现在 StatET 代码窗口中,键绑定 CTRL-R C 将 R 控制台拉到顶部。
With my R 2.11 debug
configuration I get an extra console titled /usr/lib/jvm/java-6-openjdk/bin/java
. You'll have to spelunk the console drop-down to find it. The following is a pertinent snippet of a successful initialization:
通过我的R 2.11 debug
配置,我得到了一个名为/usr/lib/jvm/java-6-openjdk/bin/java
. 您必须钻出控制台下拉菜单才能找到它。以下是成功初始化的相关片段:
CONFIG: JR library path:
/home/allan/etc/R/amd64/2.11
/usr/local/lib64/R/site-library
/usr/lib64/R/library
10-Dec-2010 7:56:47 AM org.rosuda.rj.JRClassLoader addClassPath
FINE: Added '/home/allan/etc/R/amd64/2.11/rJava/java' to classpath of URL loader
A lot more spoo, then finally:
更多的欺骗,然后最后:
10-Dec-2010 7:56:48 AM de.walware.rj.server.jriImpl.RosudaJRIServer start
INFO: R engine started successfully. New Client-State: 'Connected'.
Looks good, right? But lo and behold in the R console:
看起来不错,对吧?但是你看,在 R 控制台中:
[INFO] The R package 'rj' is not available, R-StatET tools cannot be initialized.
Ignore the lying bastard!Turns out my rj is working just fine. No idea why this failure message persists.
无视那个说谎的混蛋!结果我的 rj 工作得很好。不知道为什么这个失败消息仍然存在。
Every time around the block with this problem some new amazing piece of gravel ends up in my sneaker.
每次遇到这个问题,我的运动鞋里都会出现一些新的惊人的砾石。
I don't know whether I've covered everything, but I've written enough for now. Maybe if there are comments I'll come back and fill in the blanks.
我不知道我是否已经涵盖了所有内容,但我现在已经写得够多了。也许如果有评论,我会回来填补空白。
Note: found an Eclipse plugin for console switching by keyboard here: Eclipse: Keyboard shortcut for switching between consoles?
注意:在这里找到了一个用于通过键盘切换控制台的 Eclipse 插件:Eclipse:用于在控制台之间切换的键盘快捷键?
回答by Malu
After installing rj with in the R console using
在 R 控制台中安装 rj 后使用
install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-1.1")
(See http://www.walware.de/?page=/it/statet/troubleshooting.mframefor the correct rj version),
(有关正确的 rj 版本,请参阅http://www.walware.de/?page=/it/statet/troubleshooting.mframe),
do not forget to update the R_LIBS variable in Eclipse (Windows -> Preferences -> StatET -> Run/Debug -> R Environments -> Edit). To find out the value just type in the R console:
不要忘记更新 Eclipse 中的 R_LIBS 变量(Windows -> Preferences -> StatET -> Run/Debug -> R Environments -> Edit)。要找出值,只需在 R 控制台中键入:
packageDescription("rj").
In my windows 8 installation this returns C:/Users/Fibonacci.PYTHAGORAS/Documents/R/win-library/3.0/rj/Meta/package.rds
. The value of R_LIBS I set to
在我的 Windows 8 安装中,这将返回C:/Users/Fibonacci.PYTHAGORAS/Documents/R/win-library/3.0/rj/Meta/package.rds
. 我设置的 R_LIBS 的值
C:/Users/Fibonacci.PYTHAGORAS/Documents/R/win-library/3.0
which is the path where all libraries are installed.
这是安装所有库的路径。
As stated in http://www.walware.de/?page=/it/statet/troubleshooting.mframenewer versions (Versions > 0.5.5) do not need the R CMD INSTALL etc...
command.
如http://www.walware.de/?page=/it/statet/troubleshooting.mframe 中所述,较新版本(版本 > 0.5.5)不需要该R CMD INSTALL etc...
命令。
回答by tagoma
Here the quite similar I had and the solution I found.
在这里,我和我找到的解决方案非常相似。
I originally installed Statet using the Eclipse built-in tool "Install new software ...."
我最初使用 Eclipse 内置工具“安装新软件......”安装 Statet
I seems it downloaded Statet + rj and that the installation process went well.
我似乎下载了 Statet + rj 并且安装过程进行得很顺利。
After this first installation, I tried to install both packages again. Eclipse refused reading that they already are installed. And, both packages/programs were actually listed in the window of Eclipse.
在第一次安装之后,我尝试再次安装这两个软件包。Eclipse 拒绝读取它们已经安装。而且,这两个包/程序实际上都列在 Eclipse 的窗口中。
But, the R console still refused to launch, the dialog box reading that I had to check whether rj was available and that the file paths were correct. Another strange thing was that window explorer had been unable to locate rj on my disk.
但是,R 控制台仍然拒绝启动,对话框显示我必须检查 rj 是否可用以及文件路径是否正确。另一个奇怪的事情是窗口资源管理器无法在我的磁盘上找到 rj。
???
???
To solve my whole problem, I simply downloaded rj from http://www.walware.de/and installed this package via the r console and using the basic install.packages() command.
为了解决我的整个问题,我只是从http://www.walware.de/下载了 rj并通过 r 控制台并使用基本的 install.packages() 命令安装了这个包。
It now works perfectly .
它现在可以完美运行。
But, I still don't understand everything ..... :-)
但是,我仍然不明白一切..... :-)
回答by Mark
I'd make a comment but I lack the necessary reputation. For Windows, the procedure is the same. There's no zip file. Use the tar.gz. Worked for me. The command, working from the same folder as the downloaded file:
我会发表评论,但我缺乏必要的声誉。对于 Windows,过程是相同的。没有压缩文件。使用 tar.gz。对我来说有效。该命令在与下载文件相同的文件夹中工作:
$ G:\R-2.12.0\bin\i386\R.exe CMD INSTALL --no-test-load rj_*.tar.gz
$ G:\R-2.12.0\bin\i386\R.exe CMD INSTALL --no-test-load rj_*.tar.gz