1

I have installed JDK 1.7.0_17 on my windows7 32 bit machine and created a batch file set java path but it doesn't work.

I have installed jdk under c:\program files.... and need to run java from E: and created batch file under E:\ as follows:

set path="C:\Program Files\Java\jdk1.7.0_17\bin";

I got the following exception whenever I run the .bat file.

PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\

What is the mistake in my code?

2
  • any specific requirement for doing this through set path.. why you are not setting environment variable? Can you post your bat file Commented Apr 16, 2013 at 8:06
  • I cant see an "exception" in your question... please be more specific, exactly what happens?? Commented Apr 16, 2013 at 8:12

3 Answers 3

1

Try this:

  path="C:\Program Files\Java\jdk1.7.0_17\bin";%path%
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks,I have added environment variable and recreate batch as you mentioned, now its works
0

After this set path="C:\Program Files\Java\jdk1.7.0_17\bin";add pause();

Comments

0

You mention some exception but I do not see any exception in your question.

When you execute the batch file then the PATH variable is set/changed only for that command session.

If you start new command session then you will not see the changed value.

What it is that you want to achieve by just setting the PATH?

What ever you want to run using java so all that in one batch file/session or set the PATH environment variable manually before running the java command

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.