Note that there are some explanatory texts on larger screens.

plurals
  1. POJava System Parameter causing NoClassDefFoundError
    text
    copied!<p>I have a class which takes in various system parameters and prints them out:</p> <pre><code>public class Test_Class { public static void main(String[] args){ String fooA = System.getProperty("fooA"); String fooB = System.getProperty("fooB"); String fooC = System.getProperty("fooC"); System.out.println("System Properties:\n"+fooA+"\n"+foob+"\n"+fooC+"\n"); } } </code></pre> <p>Then, using IntelliJ, pass in the VM Parameters as such:</p> <pre><code>-DfooA="StringA" -DfooB="StringB" -DfooC="String C" </code></pre> <p>Upon running my program I get the following output:</p> <pre><code>System Properties: StringA StringB String C </code></pre> <p>Now, if I run the same program through a UNIX server by running the following command:</p> <pre><code>java -DfooA="StringA" -DfooB="StringB" -DfooC="String C" com.foo.fooUtil.Test_Class </code></pre> <p>I get the following error:</p> <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: C </code></pre> <p>I have tried a bunch of different ways to pass in <code>fooC</code>, such as <code>-DfooC=\"String C\"</code>, <code>-DfooC='String C'</code>, <code>-DfooC=\'String C\'</code>, basically any idea that came to mind. I have done some research and have been unable to find any solid solution. </p> <p>For reference, I found the following link online where another person seems to have the same issue but, unfortunately, none of the suggestions work.</p> <p><a href="http://www.unix.com/shell-programming-scripting/157761-issue-spaces-java-command-line-options.html" rel="nofollow">http://www.unix.com/shell-programming-scripting/157761-issue-spaces-java-command-line-options.html</a></p> <p>How can I pass in a System Parameter with spaces in UNIX? Thank you.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload