Results 1 to 6 of 6
- 10-29-2010, 03:10 PM #1
Member
- Join Date
- Oct 2010
- Posts
- 13
- Rep Power
- 0
NoClassDefFoundError - Cannot find main class
Good morning,
I seem to have solved the first problem with compiling the ArrayListDemo.java file from the Command Prompt. No my simple problem is that I cannot run the ArrayListDemo.java file from the Command Prompt.
This file contains the main method.
Is there any reason as to why this is happening? How can I solve this problem?
- 10-29-2010, 03:14 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,606
- Blog Entries
- 7
- Rep Power
- 17
Javac (the compiler) compiles .java source files and produces a corresponding .class file. Java (the virtual machine) runs classes; the classes are normally stored in .class files so you should run your compiled code as:
while you had to compile the source code file as:Java Code:java MyClass
kind regards,Java Code:javac MyClass.java
Jos
- 10-29-2010, 03:18 PM #3
Member
- Join Date
- Oct 2010
- Posts
- 13
- Rep Power
- 0
Good Morning JosAH,
Yes,
I have been doing that. If you take a look at my Command Prompt screenshoots, I have compiled the files with javac and that worked fine. When I try to run the file using java it does not work. It states that it cannot find the main method.
Take a look at the screenshots and files. Could it be my configuration of my jdk or jre? Could something on my machine be interferring with it?
- 10-29-2010, 03:47 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,606
- Blog Entries
- 7
- Rep Power
- 17
- 10-29-2010, 04:05 PM #5
Member
- Join Date
- Oct 2010
- Posts
- 13
- Rep Power
- 0
Have mercy on me. I totally did not even realized that I overlooked that. That surely did the trick. I guess I had been fooling around with this so long, that I did not realize I was using the .java. I trust me, I know better than that. I got hung up trying to solve the compiling issue, that I mistakenly insert the .java after the file name.
Thanks for your help. I want to mark this as solved, how do I go about doing that?
Best regards,
littleone
- 10-29-2010, 04:24 PM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,606
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
NoClassDefFoundError: Can't find the class in Eclipse
By Mestika in forum EclipseReplies: 0Last Post: 09-23-2010, 04:25 PM -
NoClassDefFoundError: Can't find the class
By Mestika in forum New To JavaReplies: 1Last Post: 09-23-2010, 03:17 PM -
One solution to NoClassDefFoundError for main class
By dragonmage in forum EclipseReplies: 6Last Post: 04-15-2010, 03:50 AM -
Could not find main class
By Andyj in forum New To JavaReplies: 2Last Post: 10-06-2009, 12:47 AM -
Could not find main class - JDK 1.6
By Syranno in forum New To JavaReplies: 1Last Post: 07-25-2008, 04:07 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks