Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-28-2004, 12:50 AM   #1
Registered: Oct 2003
Distribution: Mandrake 9
Posts: 46

Rep: Reputation: 15
Problem executing java programs

I have been searching all over the net for the past few hours trying to find a solution to this horrible problem.
I have a simple program:

class Test {
  int number=0;
  public static void main(String args[]) {
    Test t = new Test();
Here was my first method of compilation/execution:
I simply used the Java SDK.

[mike@localhost Java]$ javac
[mike@localhost Java]$ java test
Exception in thread "main" java.lang.NoClassDefFoundError: test

There is the problem: "Exception in thread "main" java.lang.NoClassDefFoundError: test"

I am able to successfully compile the java file, but when it comes to executing it, it gives me trouble. I have tried other simple programs(such as the basic HelloWorld) and they all give me the same trouble.

My second method of compilation/execution:
I downloaded NetBeans IDE 3.6.

I created a project file and used the same code from above. The compilation went smooth, but once again, I got that error.

I have read in other places that I'm missing the classpath, but I'm unsure which .jar file I should be looking for.

Any help is always appreciated.

Old 08-28-2004, 01:06 AM   #2
Mega Man X
LQ Guru
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 64
You are using "" as file name and "Test" as the class name (note that Java is case sensitive). So you have to use the same main class as the name of the source file....
Old 08-28-2004, 01:09 AM   #3
Mega Man X
LQ Guru
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 64
Here is my:


class test {
    int number=1;

    public static void main(String[] args) {
        test t = new test();


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
java code executing SQL statements problem randomx Programming 1 11-09-2004 10:59 AM
Problem executing this piped command: JAVA randomx Programming 1 07-16-2004 07:39 PM
executing programs?!? cmargiol Linux - General 8 10-29-2003 02:38 PM
Executing X-Programs remotely frankieboy Linux - General 3 10-08-2003 02:31 AM
executing programs with arguments ? shaneblyth Mandriva 10 09-27-2003 08:01 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:23 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration