aspose file tools*
The moose likes Beginning Java and the fly likes ERROR in PlasmaCloud.java double displacement = StdRandom.gaussian(0, stddev); Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "ERROR in PlasmaCloud.java double displacement = StdRandom.gaussian(0, stddev);" Watch "ERROR in PlasmaCloud.java double displacement = StdRandom.gaussian(0, stddev);" New topic
Author

ERROR in PlasmaCloud.java double displacement = StdRandom.gaussian(0, stddev);

Morten Gulbrandsen
Greenhorn

Joined: Jun 20, 2007
Posts: 9
Hi,

I have

uname -a
Linux Westparkstr42 2.6.18-4-486 #1 Wed May 9 22:23:40 UTC 2007 i686 GNU/Linux


I can compile hello world like this


public class HelloWorld {

public static void main(String[] args) {
System.out.println("Hello, World");
}

}
morten@Westparkstr42:~$ javac -version
Eclipse Java Compiler v_677_R32x, 3.2.1 release, Copyright IBM Corp 2000, 2006. All rights reserved.
morten@Westparkstr42:~$ javac HelloWorld.java
morten@Westparkstr42:~$ java HelloWorld
Hello, World
morten@Westparkstr42:~$



Then I face a problem

here I found something interesting

http://www.cs.princeton.edu/introcs/23recursion/

http://www.cs.princeton.edu/introcs/23recursion/PlasmaCloud.java.html


woun't do

javac PlasmaCloud.java
----------
1. ERROR in PlasmaCloud.java (at line 35)
double displacement = StdRandom.gaussian(0, stddev);
^^^^^^^^^
StdRandom cannot be resolved
----------
2. ERROR in PlasmaCloud.java (at line 40)
StdDraw.setPenColor(color);
^^^^^^^
StdDraw cannot be resolved
----------
3. ERROR in PlasmaCloud.java (at line 41)
StdDraw.filledSquare(x, y, size);
^^^^^^^
StdDraw cannot be resolved
----------
4. WARNING in PlasmaCloud.java (at line 57)
int SIZE = Integer.parseInt(args[0]);
^^^^
The local variable SIZE is never read
----------
4 problems (3 errors, 1 warning)morten@Westparkstr42:~$



javac Factorial.java
morten@Westparkstr42:~$ java Factorial 10
3628800


I haven't tried all, Factorial works and the html code looks identical to the ascii code.

but something can be specific to my eclipse java compiler.


i did search for the first error

StdRandom had here no matches.

Best regards from a java newcomer.


Morten


I am an Instance of a Class
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

In the comments of PlasmaCloud.java, it says, "Dependencies: StdDraw.java." This means that PlasmaCloud uses elements in the file StdDraw.java, and your compiler is complaining that it can't find these things. Although not listed as a dependency, StdRandom.java is also needed.

Add StdDraw.java and StdRandom.java to your directory containing PlasmaCloud.java, re-compile, and you should be okay.

(Another error in the comments is "Execution: java Plasma N". But execution should be java PlasmaCloud N, where N is some int.)
[ June 29, 2007: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Morten Gulbrandsen
Greenhorn

Joined: Jun 20, 2007
Posts: 9
Hi, Thanks, it still woun't compile.

http://pastebin.ca/595919

javac StdDraw.java
----------
1. ERROR in StdDraw.java (at line 111)
private static LinkedList<Character> keysTyped = new LinkedList<Character>();


morten@Westparkstr42:~/Robert_Sedgewick$ ls -l
total 36
-rw-r--r-- 1 morten morten 2472 2007-06-29 20:32 PlasmaCloud.java
-rw-r--r-- 1 morten morten 29769 2007-06-29 20:27 StdDraw.java
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Note your compiler warnings: "...parameterized types are only available if source level is 5.0."

You need to change a preference in Eclipse so that it compiles with at least version 5.0 (which is the same as 1.5). This will allow the use of "generics," which appears to be what's preventing this from compiling.

See Eclipse documentation:
  • Java Compiler page
  • Java Compiler preferences
  • Morten Gulbrandsen
    Greenhorn

    Joined: Jun 20, 2007
    Posts: 9
    1) javac warning level 2) ant makefile


    I thank you eternally for the fast reply.
    That was even as fast as IRC.

    1) javac warning level
    I have decided to only use emacs and compile as manually as possible.

    I'd like to increase the warning level.

    with gcc I would type g++ -ansi -pedantic -wall -strict_ansi or whatever.

    I now run solaris 10 developer edition and prefer bash.


    bash-3.00$ uname -a
    SunOS solaris-devx 5.11 snv_64a i86pc i386 i86pc

    man javac
    No manual entry for javac.

    I have no java manpage.

    man cc and man CC gives me immediately the appropriate manpage for C and C++ compiler.

    man java
    No manual entry for java.

    is this correct?

    Please?

    I did change my $PATH settings, after consulting with experts.

    echo $MANPATH
    /usr/dt/man:/usr/man:/usr/openwin/share/man

    echo $PATH
    /usr/bin:/usr/openwin/bin:/usr/ucb:/opt/sfw/bin


    which java
    /usr/bin/java

    which javac
    /usr/bin/javac


    java -version
    java version "1.6.0"
    Java(TM) SE Runtime Environment (build 1.6.0-b105)
    Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

    javac -version
    javac 1.6.0


    That works all fine,
    without any manpage.

    man ant
    No manual entry for ant.

    man make gives me the usual make manpage.

    That stuff with classpath I never understood, do I need to know that?


    2) ant makefile

    When I program in C C++ I use make gmake or dmake.

    Suppose I want to use the emacs for a while,
    isn't ant the appropriate make file for java?

    How do I write a simple ant makefile for a tiny helloworld program?

    Please?


    the examples from Sedgewicks homepage works fine.
    As you suggested, with the correct compiler.

    ls *.java
    PlasmaCloud.java StdDraw.java StdOut.java StdRandom.java
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
     
    subject: ERROR in PlasmaCloud.java double displacement = StdRandom.gaussian(0, stddev);
     
    Similar Threads
    Brute Force
    Which is faster : C or Java
    Thinking in Java problem
    ant pkg won't work for installing I2P
    Something is wrong with my Java on LInux...