PSEXEC – PATH VARIABLE NOT FOUND

pstools

I use the PSEXEC to start the java process in local machine.
When I run the PSEXEC without any user account it works fine.

c:/>psexec java testclass

But when I run with an user account

c:>psexec -u user -p password java test

It gives me the below error

PsExec could not start java:
The system cannot find the file specified

I checked the environemt variable for the the above user and the PATH variable has been properly mapped to the java path.
Could any one help me to resolve this issue.

Best Answer

Why not just provide the full path?

e.g.:

psexec -u username -p pw "C:\Program Files\Java\jre6\bin\java.exe" C:\path\test