when running the java program, report cannot find class
<p>The file <code>FactoryDemo.java</code> is compiled successfully and in it there  is the</p>

<pre><code>package home.city.Desktop.factorydemo;   
</code></pre>

<p>I compile it by using <code>javac -d / FactoryDemo.java</code> and nothing wrong is reported.</p>

<p>But when I try to run it by using <code>java home.city.Desktop.factorydemo.FactoryDemo</code>, it reports： </p>

<pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: home/city/Desktop/factorydemo/FactoryDemo
Caused by: java.lang.ClassNotFoundException: home.city.Desktop.factorydemo.FactoryDemo
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: home.city.Desktop.factorydemo.FactoryDemo. Program will exit.
</code></pre>

<p>I have tried many times but I could not find the solution to the problem. Thanks for your help in advance.</p>
