I am tired of
isn't there a way to make my own command?
filename.java is both compiled and run??
You can create really small bash script:
Put this to
Then you can just type
to compile and run it.
Alternatively, you can put
First method adds it to all users in your system, second one only to you.
So, assuming bash (You are running ubuntu right? ;) ), you can create a function for this...
and then if you have a file called
and that should compile and run the java file.
Edit: And, you might want to put that function definition at the end of your
Edit2: For some more awesomeness, you can use this function
This will work even when you do
THIS IS AN OVERKILL FOR WHAT YOU NEED BUT SOMEONE ELSE MIGHT STUMBLE UPON THE QUESTION SEARCHING FOR "HOW TO MAKE OWN COMMANDS ON UBUNTU".
You can use quickly ubuntu-cli-application template to create commands and easily package them as debs or share using ppas.
You'll need some knowledge of python though.
First install Quickly from the Software Center.
Then in the terminal type,
This will create a project directory for you complete with command line handling structure. All you have to do is to edit the files to add your own commands.
Once done, you can share your new commands with friends using
This will create a DEB package ready to be installed on any Ubuntu machine.