Results 1 to 9 of 9
  1. #1
    LasseA is offline Member
    Join Date
    Oct 2012
    Posts
    29
    Rep Power
    0

    Default Something seems wrong with either my computer or Jgrasp

    Hi, I'm new on this site, and new to Java, recently started studying computer science :) This will be my first post:

    I use Jgrasp as my IDE program, because our teacher wants us to use that.
    But there seems to be a problem for me, when I use Math. classes, a problem that doesn't happen for my fellow students.
    If I type the following code and compile it;
    Java Code:
    public class Mathabs {
    	public static void main(String[] args) {
    		System.out.println(Math.abs(-26.7));
    	}
    }
    It says:
    Java Code:
     "Mathabs.java:3: error: cannot find symbol
    		System.out.println(Math.abs(-26.7));
    		                       ^
      symbol:   method abs(double)
      location: class Math
    1 error
    Not sure how it's going to look in this post, but the arrowhead is pointing at the "." between Math and abs. And it does this with all Math. classes.

    I've been trying to search for the problem before I made this post, but no answer have I found.

    What could be the problem?
    Last edited by LasseA; 10-07-2012 at 11:03 AM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Something seems wrong with either my computer or Jgrasp

    Check your folders for a class of your own named Math. Search for Math.java and Math.class and get rid of or rename them.

    Also, go through these links:
    Forum Rules -- particularly the third paragraph
    Guide For New Members
    BB Code List - Java Programming Forum

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    LasseA is offline Member
    Join Date
    Oct 2012
    Posts
    29
    Rep Power
    0

    Default Re: Something seems wrong with either my computer or Jgrasp

    Thanks for answer and the beginner tips for the forum, I fixed my post with the correct use of code wrapping.
    This might be a stupid question, but what is these "folders" you're thinking of? Should I find them using options from my Jgrasp, or is it folders located together with my Jgrasp files?

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,765
    Blog Entries
    7
    Rep Power
    21

    Default Re: Something seems wrong with either my computer or Jgrasp

    Can your compiler find the String class? Both the String and Math classes are in the java.lang package; that package should be imported by the compiler automatically. Give it a try and add a line:

    Java Code:
    String test= "foo";
    near the top of your main( ... ) method and see what happens. If your compiler protests, there's something wrong with your Java installation.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Something seems wrong with either my computer or Jgrasp

    Quote Originally Posted by LasseA View Post
    what is these "folders" you're thinking of?
    The folders, aka directories, on your hard disk where you're in the habit of saving Java source and compiled files.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Something seems wrong with either my computer or Jgrasp

    Quote Originally Posted by JosAH View Post
    Can your compiler find the String class? Both the String and Math classes are in the java.lang package; that package should be imported by the compiler automatically.
    That would place the error here:
    Java Code:
    		System.out.println(Math.abs(-26.7));
    		                   ^
    Not here:
    Quote Originally Posted by LasseA View Post
    Java Code:
    		System.out.println(Math.abs(-26.7));
    		                       ^
    The complier evidently can find a Math class; it's just not the Math class.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,765
    Blog Entries
    7
    Rep Power
    21

    Default Re: Something seems wrong with either my computer or Jgrasp

    Quote Originally Posted by DarrylBurke View Post
    That would place the error here:
    Java Code:
    		System.out.println(Math.abs(-26.7));
    		                   ^
    Not here:
    The complier evidently can find a Math class; it's just not the Math class.

    db
    Ah, yes, silly me (it's Sunday ;-) The compiler was complaining about the 'abs' symbol, so it must've found a Math class somewhere ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Something seems wrong with either my computer or Jgrasp

    Quote Originally Posted by JosAH View Post
    Ah, yes, silly me (it's Sunday ;-)
    Hey, I had a beer too! Ah, but that was after my first response :)

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  9. #9
    LasseA is offline Member
    Join Date
    Oct 2012
    Posts
    29
    Rep Power
    0

    Default Re: Something seems wrong with either my computer or Jgrasp

    Hi again, you where correct about that I had a class named Math of my own. It's working now, thanks!

Similar Threads

  1. Help with JGrasp
    By bane13 in forum New To Java
    Replies: 1
    Last Post: 01-29-2012, 12:52 AM
  2. jGrasp compiling error -Help please!
    By marywenn in forum New To Java
    Replies: 0
    Last Post: 10-12-2011, 04:28 AM
  3. jGRASP debugger
    By TsAmE in forum New To Java
    Replies: 2
    Last Post: 02-23-2010, 10:35 PM
  4. JGrasp simple exercise?
    By Boomer1 in forum Other IDEs
    Replies: 2
    Last Post: 11-02-2009, 05:23 AM
  5. GUI with jGRASP
    By Matt Sakko in forum Other IDEs
    Replies: 0
    Last Post: 03-14-2009, 11:50 AM

Posting Permissions

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