[英]Eclipse only sees JDK with sudo
I have to start by saying that I have just switched to Ubuntu from Windows and I am new to Linux in general. 首先我要说的是,我刚刚从Windows切换到Ubuntu,而我通常是Linux新手。 Coming from Windows, I really am not familiar with how exactly the permissions work, the Linux file system, where I am able to create folders that I can use without the
sudo
command etc. 来自Windows,我真的不熟悉权限的工作原理,Linux文件系统,在那里我能够创建无需
sudo
命令等就可以使用的文件夹。
I use eclipse on a daily basis for android development and other simple java swing projects. 我每天使用eclipse进行android开发和其他简单的java swing项目。 I was able to download and extract the latest available version of eclipse (kepler) to this path:
/opt/eclipse
. 我能够下载eclipse(开普勒)的最新可用版本并将其解压缩到以下路径:
/opt/eclipse
。 Inside this directory is the eclipse executable and other eclipse related files. 在这个目录中是eclipse可执行文件和其他与eclipse相关的文件。
I also installed the JDK and verified with the java -version
command. 我还安装了JDK,并使用
java -version
命令进行了验证。 It says: 它说:
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
I am running on a 64 bit CPU architecture so both programs are the 64 bit version. 我在64位CPU架构上运行,因此两个程序均为64位版本。
Now, my problem is that if I open eclipse from the Unity dash or from the file explorer, it give me this error: 现在,我的问题是,如果我从Unity破折号或文件资源管理器中打开eclipse,它将出现以下错误:
However if I run sudo eclipse
in the terminal, everything runs just fine as long as I do it as the super user. 但是,如果我在终端中运行
sudo eclipse
,只要以超级用户身份运行,一切都将正常运行。 I have a hunch that the JDK is installed in a folder that is restricted to normal users and only works if I run the sudo
command but this is just a hunch. 我有一种预感,JDK安装在仅限普通用户使用的文件夹中,并且只有在我运行
sudo
命令时才能起作用,但这只是一种预感。 As I said, I am new to Linux and I am not really sure what I am doing wrong here, I am learning as I go. 就像我说的那样,我是Linux的新手,我不确定自己在做什么错,我正在学习。 I need a good explanation as to how to make it start from the Unity dock without the
sudo
command. 我需要一个很好的解释,说明如何使它在没有
sudo
命令的情况下从Unity扩展坞启动。 Thanks in advance! 提前致谢!
You'll want to use the chmod
command from the terminal to change the permissions on the Java folder. 您将需要在终端上使用
chmod
命令来更改Java文件夹上的权限。 See this link for more information: http://www.linux.org/threads/file-permissions-chmod.4094/ 有关更多信息,请参见此链接: http : //www.linux.org/threads/file-permissions-chmod.4094/
Well after running the which java
cmd, I noticed that the path to the JDK from the eclipse.ini
file was not pointing to the correct location. 运行了
which java
cmd之后,我注意到从eclipse.ini
文件到JDK的路径没有指向正确的位置。 I fixed the path and now it works. 我固定了路径,现在可以了。 I don't know how the
sudo
cmd overrides the eclipse.ini path to JDK but well, it works 我不知道
sudo
cmd如何覆盖eclipse.ini到JDK的路径,但是很好,它可以工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.