How can I run a Java program in Atom editor?

好久不见. 提交于 2019-11-29 02:59:03

问题


I installed a scripts package to be able to run a Java program in Atom editor. But I'm still not able to run it. Getting the following error message:

'bash' is not recognized as an internal or external command, operable program or batch file

What could be missing here?

I am using Windows 7. The same editor and same package runs on Ubuntu without any issues.


回答1:


  1. Get GitHub Desktop from GitHub Site. Run the installer to complete.
  2. Get Atom Windows installer AtomSetup.exe from Atom Site.
  3. Once Atom installation completes, it launches.
  4. From Package Menu, Navigate to "Settings View". Click on the sub menu item "Install Packages/ Themes".
  5. Type "script" in the search text box, hit Enter.
  6. Look for a package named "script" (run code in Atom) in the search result and click on install button in the result pane.
  7. Once the package is installed, create a Java file and click Ctrl+Shift+B to run it.

P.S -

  1. GitHub Desktop is a mandatory prerequisite for Windows environment.
  2. Both of the installers are over 100 MB in size, so it can take some time.



回答2:


Main reason for this issue is scripts package is NOT built for cross-platform. "bash" won't be recognised on Windows. But we have following workarounds to make it work.

It works with following modifications:

  • Ensure Java path is appended to PATH variable in environment variables.
  • Since I am using git, I had installed git bash in my windows system.
  • Set the git bash path in environment variables.

Now, able to run Java from atom editor. :)

As suggested in other forums, Cygwin could be other better alternative to get bash.




回答3:


add jdk to PATH..environment varaiables



来源:https://stackoverflow.com/questions/34014902/how-can-i-run-a-java-program-in-atom-editor

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!