Note that there are some explanatory texts on larger screens.

plurals
  1. PORunning Java program from Python
    primarykey
    data
    text
    <p>I've looked <a href="https://stackoverflow.com/questions/945962/java-problem-running-a-jar-file-in-command-line">here</a>, <a href="https://stackoverflow.com/questions/1940281/cant-run-my-programme-from-command-line">here</a>, <a href="https://stackoverflow.com/questions/250166/noclassdeffounderror-while-trying-to-run-my-jar-with-java-exe-jar-whats-wrong">here</a>, and <a href="https://stackoverflow.com/questions/1279542/how-to-execute-a-java-class-from-the-command-line">here</a>.</p> <p>While informative they just didn't quite have enough for me to discover the root of my problem. My code isn't contained within a JAR file and the customer has requested we do not ship it as such.</p> <p>I built the application in Eclipse and from there it runs fine. I've set up a script that will modify the <code>main</code> method of one of the java files for testing purposes. I want to run the application using a call from Python after I modify it. However, from the command line when I attempt to call the program using <code>java</code> or <code>java -cp .</code> I get the following error:</p> <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: DemoAPIFunctionality Caused by: java.lang.ClassNotFoundException: DemoAPIFunctionality at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) Could not find the main class: DemoAPIFunctionality. Program will exit. </code></pre> <p>My project depends on several JARs, which are not within the root directory, and a DLL file, again not in the root directory. I'm hoping it's related to the location of one of those but I'm not sure and am making little headway. Here is <code>DemoAPIFunctionality.java</code>:</p> <pre><code>public class DemoAPIFunctionality { public final static void main(String[] args) { DemoAPIFunctionality demo = new DemoAPIFunctionality(); </code></pre> <p>I'd happily list any more information if it will help you help me. (No, I'm not a sports agent.) What do I need to do to get it to work at least from the command line?</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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