1

I am using windows 7 and java 1.6.0_22 is my default java version.

I am using a jar file which is an open source jar file (webscarab-selfcontained-20070504-1631.jar) to be act a intermediate proxy.

I am getting different behavior when executing the jar file by double clicking the jar and when executing the jar in command prompt by java -jar webscarab-selfcontained-20070504-1631.jar command.

When i hit the URL by setting the default proxy for the jar, able to get the proper response when the jar is executed by double clicking it and getting invalid response when executing the jar file with the command prompt.

Please let me know what is the difference of executing the jar file by double clicking and from command prompt...

TikTik
  • 347
  • 2
  • 8
  • 22

1 Answers1

2

I found the solution after do more research on this.

Difference , while double clicking the jar file it will pick the class path with is updated in the registry, in my case java 7 bin path is updated in the registry, which make the jar to be executed in java7.

While executing the jar file from command prompt i will pick the java version which we have updated in the environmental variables (default version), which make the jar to be executed in java6. That is why i got two behavior which executing by double clicking and from command prompt.

How to update the registry: (In windows system)

  1. Crtl + R -> open the run command
  2. type regedit
  3. Navigate to HKEY_CLASSES_ROOT\jarfile\shell\open\command
  4. Update the path as you want Ex : "C:\Program Files\Java\jre6\bin\javaw.exe" -jar "%1" %*

Now on double click the jar file will run in java6 and getting same behavior.....

TikTik
  • 347
  • 2
  • 8
  • 22