java 在 Ubuntu 9.10 中安装 play-framework
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2491586/
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
install play-framework in Ubuntu 9.10
提问by Shekhar
I have copied zipped file from the playframework.org website and unzipped it at a location. I have inserted it in my .bashrc profile to set up as PATH environment.
我已经从 playframework.org 网站复制了压缩文件并将其解压缩到某个位置。我已将它插入到我的 .bashrc 配置文件中以设置为 PATH 环境。
But still, the play command is not accessible from anywhere.
但是,播放命令仍然无法从任何地方访问。
And even in the installed directory of the framework, the play file is not running as it is.
即使在框架的安装目录中,播放文件也没有按原样运行。
I have to prefix python before any play command to run it.
我必须在任何播放命令之前添加 python 前缀才能运行它。
Am i making a mistake somewhere?
我在某个地方犯了错误吗?
Please help me.
请帮我。
采纳答案by Shekhar
Got the answer! Move the unzipped play folder into opt directory by typing
得到了答案!通过键入将解压缩的播放文件夹移动到 opt 目录中
sudo mv play-1.0.1 /opt/play
and then give another command
然后给出另一个命令
source /etc/profile
And now one can run play command from anywhere in the shell..
现在你可以在 shell 的任何地方运行 play 命令了..
回答by Fanooos
Suppose that the path of the play directory is /home/yourName/play
假设播放目录的路径是 /home/yourName/play
open the terminal and type the following
打开终端并输入以下内容
PATH=$PATH:/home/yourName/play
export PATH
then you will be able to access playcommand from anywhere
那么你就可以play从任何地方访问命令
回答by lees2bytes
Not to beat a dead horse but here's another way about it similar to the last post. Just ad an alias to your ~/.bashrc
不要打败一匹死马,但这里有另一种类似于上一篇文章的方法。只需为您的 ~/.bashrc 添加一个别名
alias play="/home/usrName/javaApi/play-1.1/play"
According to the .bashrc you could alternately add it to ~/.bash_aliases which seems to be best practice according to the comments in the file.
根据 .bashrc 你可以交替地将它添加到 ~/.bash_aliases 根据文件中的注释,这似乎是最佳实践。
回答by qeek
source ~/.bashrc #would have done the trick probably
回答by Robert Christian
You also need to tell the terminal that "play" is a bash script. You will need to either rename play to play.sh, or run it with "bash play." Additionally the script needs to have executable permissions.
您还需要告诉终端“play”是一个 bash 脚本。您需要将 play 重命名为 play.sh,或者使用“bash play”运行它。此外,脚本需要具有可执行权限。
I set it up with the following steps:
我按照以下步骤进行设置:
- extract to~/opt/play-2.1-RC1
- mv ~/opt/play-2.1-RC1/play ~/opt/play-2.1-RC1/play.sh
- chmod +x ~/opt/play-2.1-RC1/play.sh
- alias play="/home/rob/opt/play-2.1-RC1/play.sh"
- 解压到~/opt/play-2.1-RC1
- mv ~/opt/play-2.1-RC1/play ~/opt/play-2.1-RC1/play.sh
- chmod +x ~/opt/play-2.1-RC1/play.sh
- 别名 play="/home/rob/opt/play-2.1-RC1/play.sh"
Note that the alias can be run in a terminal, but to persist you will need to copy it to ~/.bashrc
请注意,别名可以在终端中运行,但要持久化,您需要将其复制到 ~/.bashrc
With this setup, local user can type play from any location.
使用此设置,本地用户可以从任何位置键入播放。
回答by Ashish Ratan
Try this command
试试这个命令
echo 'export PATH=/Applications/play-1.2.4:$PATH' >> ~/.profile
echo 'export PATH=/Applications/play-1.2.4:$PATH' >> ~/.profile

