Q:

Computer freezing when render() is active

I'm trying to make my first game in java but have stumbled over a problem. When I first wrote my game loop and FPS counter I tried to do it on my own, but it did not work well, so I used this code that I found online:
public void run(){
    long lastTime = System.nanoTime();
    double amountOfTicks = 60.0;
    double ns = 1000000000 / amountOfTicks;
    double delta = 0;
    long timer = System.currentTimeMillis();
    int frames = 0;
    while(running){
        long now = System.nanoTime();
        delta += (now - lastTime) / ns;
        lastTime = now;
        while(delta >= 1){
            tick();
            delta--;
        }
        if(running){
            render();
        }
        frames++;

        if(System.currentTimeMillis() - timer > 1000){
            timer += 1000;
            System.out.println("FPS: " + frames);
            frames = 0;
        }
    }
    stop();
}

It works great, but when I add the render() function, the window just sort of freezing. I can still close the window, but some times the whole computer need to be restarted. Here is the render function.
private void render(){
    BufferStrategy bs = this.getBufferStrategy();
    if(bs == null){
        this.createBufferStrategy(3);
        return;
    }

    Graphics g = bs.getDrawGraphics();

    g.setColor(Color.green);
    g.fillRect(0, 0, WIDTH, HEIGHT);

    handler.render(g);

    g.dispose();
    bs.show();
}

If I comment out everything in the render function, I get a white screen show up witch I can move around and a "constant" FPS on around 16200000. But when the code in the render function is active, the FPS looks like this:
FPS: 8644
FPS: 1
FPS: 5977
FPS: 3189
FPS: 3930
FPS: 8120
FPS: 1
FPS: 8024
FPS: 1

No stability or consistency, do anybody know what I have done wrong? My operating system is Ubuntu Mate and I use openjdk version 1.8.0_91 if it is of any importance. Thank you in advance.
Complete Code:
package com.tutorial.main;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferStrategy;

public class Game extends Canvas implements Runnable{

private static final long serialVersionUID = 1550691097823471818L;

public static final int WIDTH = 640, HEIGHT = WIDTH / 12 * 9;

private Thread thread;
private boolean running = false;

private Handler handler;

public Game(){
    new Window(WIDTH, HEIGHT, "Lets Build!", this);
    handler = new Handler();

    handler.addObject(new Player(100, 100, ID.Player));
}

public synchronized void start(){
    thread = new Thread(this);
    thread.start();
    running = true;
}

public synchronized void stop(){
    try{
        thread.join();
        running = false;
    }catch(Exception e){
        e.printStackTrace();
    }
}

public void run(){
    long lastTime = System.nanoTime();
    double amountOfTicks = 60.0;
    double ns = 1000000000 / amountOfTicks;
    double delta = 0;
    long timer = System.currentTimeMillis();
    int frames = 0;
    while(running){
        long now = System.nanoTime();
        delta += (now - lastTime) / ns;
        lastTime = now;
        while(delta >= 1){
            tick();
            delta--;
        }
        if(running){
            render();
        }
        frames++;

        if(System.currentTimeMillis() - timer > 1000){
            timer += 1000;
            System.out.println("FPS: " + frames);
            frames = 0;
        }
    }
    stop();
}

private void tick(){
    handler.tick();
}

private void render(){
    BufferStrategy bs = this.getBufferStrategy();
    if(bs == null){
        this.createBufferStrategy(3);
        return;
    }

    Graphics g = bs.getDrawGraphics();

    g.setColor(Color.black);
    g.fillRect(0, 0, WIDTH, HEIGHT);

    handler.render(g);

    g.dispose();
    bs.show();
}

public static void main(String args[]){
    new Game();
}
}

A:

The problem was my operating system. When I switched over to Windows with JDK 8 installed everything worked great. Maybe becaus I have OpenJDK installed on my Linux machine there was some trobble, I honestly do not know. Will look in to it and see if I find it. Will update if so.

