1

I'm using Windows and Git Bash. Whenever I type a javac command in Git Bash, it comes back reading: sh.exe":javac: command not found.

I then have to type out export PATH=$PATH:"/c/Program Files/Java/jdk1.8.0_45/bin/" The javac command then works on the next line after I type the export PATH command in.

My question is, how do I get Git Bash to remember that export command so I don't have to type it out each time?

Nick Volynkin
  • 14,023
  • 6
  • 43
  • 67
MJW
  • 41
  • 1
  • 1
  • 4

2 Answers2

6

You need to add export PATH command to .bashrc for Git Bash. Refer to this Git for Windows: .bashrc or equivalent config files for Git Bash shell

Edit: Adding code

copy > ~/.bashrc

Add the following line to the file:

export PATH=$PATH:"/c/Program Files/Java/jdk1.8.0_45/bin/"

Save the file. Restart Git Bash. Tada

Community
  • 1
  • 1
aadarshsg
  • 2,069
  • 16
  • 25
1

Try physically adding that path to the system environment variables from the control panel.

Search for 'system environment variables' --> go into Environment Variables --> look for [Path] from System Variables --> Click to highlight [Path] and hit Edit.

Depending on your computer, you might see a list of paths added, or a long string of paths separated by semi-colons. Copy and paste your java bin location.

Nam Kim
  • 229
  • 2
  • 10