I tried https://github.com/cs50/spl

Even got little success, but it's not working properly and keeps throwing me this error... SPL not working properly

 * bounce.c
 * David J. Malan
 * [email protected]
 * Bounces a circle back and forth in a window.

// standard libraries
#include <stdio.h>

// Stanford Portable Library
#include <spl/gevents.h>
#include <spl/gobjects.h>
#include <spl/gwindow.h>

int main(void)
    // instantiate window
    GWindow window = newGWindow(320, 240);

    // instantiate circle
    GOval circle = newGOval(0, 110, 20, 20);
    setColor(circle, "BLACK");
    setFilled(circle, true);
    add(window, circle);

    // initial velocity
    double velocity = 2.0;

    // bounce forever
    while (true)
        // move circle along x-axis
        move(circle, velocity, 0);

        // bounce off right edge of window
        if (getX(circle) + getWidth(circle) >= getWidth(window))
            velocity = -velocity;

        // bounce off left edge of window
        else if (getX(circle) <= 0)
            velocity = -velocity;

        // linger before moving again
  • Are you sure spl.jar is in the same directory as your program?
    – kzidane
    Commented Mar 11, 2015 at 20:24
  • Thank you @Kareem it worked. But I am facing small problem. Programs like bounce return - error: ack. and animation is not smoother. It offen accelerates and decelerates.
    – Ankush
    Commented Mar 21, 2015 at 9:16
  • I would like to take a look at the code if you don't mind!
    – kzidane
    Commented Mar 21, 2015 at 10:09
  • Addded in OP ^^^ @ Kareem
    – Ankush
    Commented Mar 21, 2015 at 14:08
  • Your program seems to be compiling and running perfectly on the appliance. If the same code has a problem with running on Ubuntu, it may be a bug in the SPL.
    – kzidane
    Commented Mar 21, 2015 at 16:50

3 Answers 3


I did the problem set on Ubuntu 14.04. I got the library along with the examples (bounce, button, ect.) from http://cdn.cs50.net/2013/fall/lectures/5/m/src5m.zip. The zip file contains spl.jar and a folder named spl, which make up the library. If you place them in the directory with your program and have Java 5 or newer, the program should work. I am assuming your problem is that your SPL library has not been completely built, so you could also try running the Makefile in the spl folder from GitHub.


I had the same issue. To solve that I moved the spl.jar file to the src4m folder and then executed: sudo ./bounce


For installing Stanford portable library in Ubuntu, execute the following commands in terminal.

wget https://github.com/tysonchamp/spl-for-ubuntu/archive/master.zip unzip master.zip

cd spl-for-ubuntu-master


make install

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .