Results 1 to 11 of 11
  1. #1
    Boomer1 is offline Member
    Join Date
    Oct 2009
    Posts
    20
    Rep Power
    0

    Default simple exercise for class, help please?

    Hello,
    I am new to programming and have had only one session of my first class. My exercise is to write a class using jgrasp to display my name.

    I have this:

    public class Name
    {
    public static void main (String [] args)
    {
    System.out.println.("Dean");
    }

    }

    Is this correct? I can't get jgrasp to display it without it saying there are errors.

    Thank you tremendously for your help

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    10

    Default

    Java Code:
    System.out.println.("Dean");
    should be
    Java Code:
    System.out.println("Dean");

  3. #3
    Boomer1 is offline Member
    Join Date
    Oct 2009
    Posts
    20
    Rep Power
    0

    Default

    Thank you very much, if anyone is familiar with jGrasp...In the menu under Settings/Path/Workspace.....what should be in the path window as my directory?

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    10

    Default

    A directory where you want to be saving your java projects in.

  5. #5
    Boomer1 is offline Member
    Join Date
    Oct 2009
    Posts
    20
    Rep Power
    0

    Default

    Thank you very much, I still can't seem to get it to function properly, I'm getting this message in the bottom window....


    ----jGRASP exec: java Name

    java.lang.NoClassDefFoundError: Name
    Caused by: java.lang.ClassNotFoundException: Name
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Could not find the main class: Name. Program will exit.
    Exception in thread "main"
    ----jGRASP wedge2: exit code for process is 1.
    ----jGRASP: operation complete.

    I apologize for the lack of knowledge here, it's just a little confusing yet

  6. #6
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    10

    Default

    You'll have to compile/build the file first.

  7. #7
    Boomer1 is offline Member
    Join Date
    Oct 2009
    Posts
    20
    Rep Power
    0

    Default

    I hit the compile button then the run button and still I'm getting the same thing....hmmm...

  8. #8
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    10

    Default

    What output did you get from the compilation? The class file will not be created if the program still has compilation errors.

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,370
    Blog Entries
    1
    Rep Power
    22

  10. #10
    Boomer1 is offline Member
    Join Date
    Oct 2009
    Posts
    20
    Rep Power
    0

    Default

    THANKS GUYS! I finally got it...I didnt have the build path at the right address that I saved my files in....sorry, I'm new to this but you guys were awesome, thanks for the help!

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,370
    Blog Entries
    1
    Rep Power
    22

Similar Threads

  1. Difference between a bean and a simple class
    By new_coder in forum New To Java
    Replies: 2
    Last Post: 09-07-2009, 05:34 AM
  2. dont let me create simple class
    By itaipee in forum New To Java
    Replies: 5
    Last Post: 01-11-2009, 12:07 PM
  3. Replies: 4
    Last Post: 01-01-2009, 04:58 AM
  4. Replies: 1
    Last Post: 11-12-2008, 04:43 PM
  5. A simple generic class
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-17-2008, 07:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •