How can i make gitbash find the javac command?

旧时模样 提交于 2019-11-30 14:12:42
VonC

You need to add javac parent folder to your PATH.

export PATH=$PATH:"/C/Program Files/Java/jdk1.7.0_21/bin/"

You can check what PATH your git bash shell does see (probably the default one).

As suggested by @VonC in a comment in the correct answer in order to have this this command permanently added to the path you have to:

  1. Go to C:\Users\YourUsername
  2. Open with an editor the file .bashrc (if is not there just create it)
  3. Write the command to add the command to your path in this file:

    export PATH=$PATH:"/C/Program Files/Java/jdk1.7.0_21/bin/"

  4. Restart GitBash and it works

The other answers did not work for me. What DID work (Windows 10) was:

  1. Go to System Properties -> Advanced -> Environment Variables
  2. New System Variable
  3. 'Variable name': PATH
  4. 'Variable value': C\Program Files\Java\jdk-9\bin (or whatever your path is)
  5. Restart Git Bash
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!