Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Using textpad with java help !!

Options
  • 07-01-2006 7:52pm
    #1
    Registered Users Posts: 221 ✭✭


    I'm trying to use textpad to compile java . I'e installed j2sdk1.4.2_09 and it seems to have installed fine and it seems to complie fine but when i got ot run i get the following error message : Exception in thread "main" java.lang.NoClassDefFound Error:

    Any ideas ??


Comments

  • Registered Users Posts: 4,188 ✭✭✭pH


    Post the code, you're probably missing a static main method.


  • Registered Users Posts: 221 ✭✭Elfman


    Well im getting the same thing with a couple of programms so i tried this simple one :

    class myfirstjavaprog
    {
    public static void main(String args[])
    {
    System.out.println("Hello World!");
    }
    }
    the classic hello world but same reply. i tried importing java.lang but it shoul d be automatic right ? anyway didnt work.


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    This is one of the most common errors (gets everyone).

    Make sure you add a dot to your classpath. eg.

    set CLASSPATH=%CLASSPATH%;.

    Then compile the java file and run it in the same directory. eg.


  • Registered Users Posts: 221 ✭✭Elfman


    em sorry to ask the stupid question but how do i set class path ??


  • Closed Accounts Posts: 603 ✭✭✭shamrock2004


    Here you go my friend: http://www.apl.jhu.edu/~hall/java/beginner/settingup.html
    Should be everything you need regarding installation and classpath issues!
    Good luck.
    Shamrock


  • Advertisement
  • Registered Users Posts: 4,188 ✭✭✭pH


    That should be working fine!

    How exactly are you running this?
    The class "myfirstjavaprog" should be in a file called myfirstjavaprog.java

    to Compile:
    >javac myfirstjavaprog.java
    to Run:
    >java myfirstjavaprog

    (NOTE don't use the .class extension when using the java command to run).


Advertisement