在Java中创建一个运行文件 [英] Create a Run file in java

查看:117
本文介绍了在Java中创建一个运行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在刚刚通过使用命令运行,如的Makefile 制作
我使用的linux和必须经常键入此命令 java命令../lib/*:../zookeeper-3.4.6.jar :. WORDCOUNT 。这将是方便,如果有一个更简单的方法!

Is there a way to create a "Runfile" in java which runs the program just by using a command run, like Makefile and make? I am using linux and have to type this command very often java -cp ../lib/*:../zookeeper-3.4.6.jar:. WordCount. It would be convenient if there was a easier way!

推荐答案

请在shell脚本的名称运行,把你需要的命令。结果
现在让运行可执行脚本 -

Make a shell script name run and place your required command.
Now make the run script executable -

chmod u+x run

现在你只是从终端执行shell脚本。如果您需要进一步完善,如果你是在的Ubuntu 那么你可以创建一个目录。在你回家(〜)。然后你就可以将所有的命令在里面。一般来说,你〜/ .profile文件文件在你家里包含关于目录信息。现在目录可以作为您的私人箱。如果你的〜/ .profile文件文件不包含有关 directroy任何信息,那么你可以添加以下行在你的〜/ .profile文件 -

Now you just execute the shell script from the terminal. If you need further improvement and if you are in ubuntu then you can create a bin directory. at you home (~). Then you can place all of your command in it. Generally you ~/.profile file contains information about the bin directory at you home. Now the bin directory works as your private bin. If your ~/.profile file doesn't contain any information about the bin directroy then you can add the following line in your ~/.profile -

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

这篇关于在Java中创建一个运行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆