Note that there are some explanatory texts on larger screens.

plurals
  1. PONoClassDefFoundError error while running JAVA console app
    text
    copied!<p>I created little HelloWorld example and I am having problem running it from command prompt (on Windows). When I attempt to run it by: </p> <p><strong>java tcpServer</strong> from command prompt I get <strong>NoClassDefFoundError</strong><br> I am able to compile it with javac, and class file gets generated.</p> <p>Somewhere I was reading that I have to put path to my class folder into CLASSPATH environment variable. I've done it and rebooted machine, but I still get the same error.</p> <p>I also was trying to run it by <strong>java -cp c:\MyFolderWhereClassFileIs HelloWorld</strong>, it doesn't work.</p> <p>I've looked into ENV variables and I have following: JAVA_HOME: C:\Program Files (x86)\Java\jdk1.6.0_26; JRE_HOME:C:\Program Files (x86)\Java\jre6; CLASSPATH: C:\HelloWorld;</p> <p><strong>So, how do I run this? Any ideas how to resolve this? Thanks.</strong></p> <p>PS. The most annoying thing to me is, if I create java project in eclipse, and create HelloWorld example, then it runs fine...</p> <p>UPDATE:</p> <p>Here is the code. It does have package specified.</p> <pre><code>package test.com; public class HelloWorld { public static void main(String[] args) { System.out.print("Hello World"); } } </code></pre> <p>My HelloWorld.java and HelloWorld.class files are here: C:\workspace\TestApp\src\test\com</p> <p>One thing I learned so far is that I can't run it from within com folder or test folder. I have to be in src folder class file can be found... but I am still not able to run it... always the same error.</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