简体   繁体   English

无法识别'javac'并且未找到rmiregistry

[英]'javac' is not recognized and rmiregistry is not found

Im trying to run a simple RMI application via batch file. 我试图通过批处理文件运行一个简单的RMI应用程序。 I have been given these lines by my instructor to write in notepad and save it as .bat : 我的老师给了我这些行,可以写在记事本中并保存为.bat:

  1. @cd %cd%\\src @cd%cd%\\ src
  2. @for /r %%a in (*.java) do @javac %%a (* .java)中的@for / r %% a执行@javac %% a
  3. @start rmiregistry 3000 @开始rmiregistry 3000
  4. @java Server @java服务器
  5. @pause @暂停

When I run the batch files it shows that 'javac is not recognized as an internal or external command operable program or batch file', and for the RMI it shows 'The system cannot find the file rmiregistry'. 当我运行批处理文件时,它表明“ javac不被识别为内部或外部命令可操作程序或批处理文件”,而对于RMI,它显示了“系统找不到文件rmiregistry”。

I searched for solutions for 'javac' problem and it appears I have to set a path for it in the 'Environment Variables' which I did via adding a new USER variable in the name of JAVA_HOME and the path : 'C:\\Program Files\\Java\\jdk1.8.0_40\\bin' 我搜索了“ javac”问题的解决方案,看来我必须在“环境变量”中为其设置路径,这是通过在JAVA_HOME名称和路径中添加新的USER变量来完成的:“ C:\\ Program Files \\的Java \\ jdk1.8.0_40 \\ BIN'

The problem is consistent and I don't know where to start to solve it 问题是一致的,我不知道从哪里开始解决

You should append this $JAVA_HOME environment variable in the PATH environment variable. 您应该将此$JAVA_HOME环境变量附加到PATH环境变量中。 This will solve your problem. 这样可以解决您的问题。

OR Alternatively, 或者,

you should directly add this directory location to the end of the PATH environment variable. 您应该直接将此目录位置添加到PATH环境变量的末尾。

PATH=........;C:\Program Files\Java\jdk1.8.0_40\bin
 // here ....... denotes previous entry done already in PATH

Or, SET Path by typing the following in the CMD(console/command prompt) as :- 或者,通过在CMD(控制台/命令提示符)中键入以下命令来设置路径:-

set PATH=%PATH%;C:\Program Files\Java\jdk1.8.0_40\bin

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

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