Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Using textpad with java help !!

  • 07-01-2006 07:52PM
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 Posts: 4,188 ✭✭✭pH


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


  • Registered Users, Registered Users 2 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, Registered Users 2 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, Registered Users 2 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, Registered Users 2 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