简体   繁体   English

Java运行命令无法打开

[英]Java run command not opening

I had installed Java to work with Android Studio. 我已经安装了Java以与Android Studio一起使用。 Java works fine on Android Studio but when I try to use Java run command on my computer, it opens and closes immediately. Java在Android Studio上运行良好,但是当我尝试在计算机上使用Java运行命令时,它会立即打开和关闭。 How do I run Java on my computer? 如何在计算机上运行Java?

  1. Open command window (cmd on Windows) 打开命令窗口(在Windows上为cmd)
  2. Type java -version You should see the installed java version output. 键入java -version您应该看到已安装的Java版本输出。

u need to add this path C:\\Program Files\\Java\\jdk1.8.0_05\\bin wheres javac.exe locate copy the path 1. go to System properties then click on advanced system setting . 您需要添加此路径C:\\ Program Files \\ Java \\ jdk1.8.0_05 \\ bin其中javac.exe找到复制路径1.转到系统属性,然后单击高级系统设置。 2. click on Environment variables as picture describe 3. choose the path from system variables and edit it 4. go to end of the line and important to separate between variable values before paste javac.exe path make sure to put semi-colon and paste the path 2.单击“环境变量”,如图片所示3.从系统变量中选择路径并对其进行编辑4.移至该行的结尾,重要的是在粘贴javac.exe路径之前在变量值之间进行分隔,请确保将分号和粘贴路径

单击环境变量,如图所示 从系统变量中选择路径并进行编辑 在粘贴javac.exe路径之前,请务必移至该行的末尾并在变量值之间进行分隔很重要,请确保使用分号并粘贴路径

There is a possibility that you have the following Registry setting configured: 您可能配置了以下注册表设置:

HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System!DisableCMD

If you see the value ' DisableCMD ' in the above location then simply delete it. 如果您在上述位置看到值“ DisableCMD ”,则只需deletedelete

If you are not comfortable with editing the Registry then you will find this setting by going to: 如果您不满意编辑注册表,则可以通过以下方法找到此设置:

Start > RUN

Type gpedit.msc and press OK 键入gpedit.msc ,然后按OK

Navigate to: User Configuration > Administrative Templates > System Look for the option ' Prevent access to the command prompt ' Double click it and choose ' Not Configured ' 导航到: User Configuration > Administrative Templates > System查找选项' Prevent access to the command prompt '双击并选择' Not Configured '

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM