Majd Kharman
Majd Kharman

Reputation: 21

'javac' is not recognized and rmiregistry is not found

Im trying to run a simple RMI application via batch file. I have been given these lines by my instructor to write in notepad and save it as .bat :

  1. @cd %cd%\src
  2. @for /r %%a in (*.java) do @javac %%a
  3. @start rmiregistry 3000
  4. @java Server
  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'.

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'

The problem is consistent and I don't know where to start to solve it

Upvotes: 0

Views: 3091

Answers (1)

Am_I_Helpful
Am_I_Helpful

Reputation: 19168

You should append this $JAVA_HOME environment variable in the PATH environment variable. This will solve your problem.

OR Alternatively,

you should directly add this directory location to the end of the PATH environment variable.

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 :-

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

Upvotes: 1

Related Questions