1

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!

1
  • 1
    @MadConan Thank you for sharing the link. Although I believe that talks about creating a jar file. But I am running my code in linux, and I just need to load and run the .class files. Thank you Commented Apr 23, 2015 at 18:24

1 Answer 1

5

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

chmod u+x run

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 your home (~). Then you can place all of your commands in it. Generally your ~/.profile file contains information about the bin directory at your home. Now the bin directory works as your private bin. If your ~/.profile file doesn't contain any information about the bin directory 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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.