title: Difference when executing Java command via CMD vs Powershell - caused by periods (".")
body: <p>I've got an example Java application that requires an HTTP Proxy to be specified in some environments.</p>
  
  <p>When I try running this using the argument as suggested on the <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html" rel="nofollow noreferrer">Oracle website</a> in CMD (Command Prompt) it works fine.</p>
  
  <pre><code>E:\&gt;java -Dhttp.proxyHost=http://proxy.example.com -jar myJAR.jar
  System properties...
  [...]
  http.proxyHost=http://proxy.example.com
  </code></pre>
  
  <p>You can see that the application has been run, and when listing the system properties it's correctly received the <code>http.proxyHost</code> property.</p>
  
  <p>However, when I run this from Powershell, I get the following:</p>
  
  <pre><code>Windows PowerShell
  Copyright (C) Microsoft Corporation. All rights reserved.
  
  Try the new cross-platform PowerShell https://aka.ms/pscore6
  
  PS E:\&gt; java -Dhttp.proxyHost=http://proxy.example.com -jar myJAR.jar
  Error: Could not find or load main class .proxyHost=http:..proxy.example.com
  </code></pre>
  
  <p>Here it appears some kind of breaking has occurred around the first "." and from then on it's treated the rest as another argument.</p>
  
  <p>If the argument is quoted - e.g. <code>-D"http.proxyHost"=http://proxy.example.com</code> - then it works fine in Powershell.</p>
  
  <p>Can anyone explain this behavior, please?</p>