My java files are in /home/joe/Learning/Java folder, but can not run them in home directory. Works fine when I change to the specific directory. How can I add this to my $PATH. I tried so many. but no avail. Can someone help

  • Did you right click the file choose properties and make it executabe – Mark Kirby Aug 24 '14 at 9:04

If you want to run files locally without adding the path to your command, an easy way is to store them in ~/bin.

Make sure they are executable.

Another way is to create a link in ~/bin to the file (ln -sf)

I think this is the most appropriate way for a "learning" file as you mention it.

  • This is good advice you can move you files from terminal like this sudo cp -R /home/joe/Learning/Java/FILENAMEHERE ~/bin – Mark Kirby Aug 24 '14 at 9:07
  • The sudo will not be needed to copy them locally, and the file needs to be on the first level. – Jacob Vlijm Aug 24 '14 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.