You must start the session before any output so the cookies can be set correctly.
Wordpress is stateless and uses no sessions at all.
You mention you put this code in the footer, so probably there is output already.

A hacky solution would be to enter session_start() on the top of your index.php, or in wp-config.php.

Get REQUEST_URI and don't overwrite
So I'm learning how to embed an applet into a jsp page. But the thing is, when I run the index.jsp, there's always an error. The error says that the class for the applet is missing, and I don't know how to fix that. I put the full class name of the applet in the index.jsp, and the jar file for the applet was made. Here is the code for the applet and jsp.

    package HelloApplet;

    import java.applet.Applet;
    import java.awt.Graphics;

    public class HelloApplet extends Applet {

        @Override
        public void paint(Graphics g) {
             g.drawString("Hello applet!", 50, 25);
        }//end paint

    }//end class

    &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
    &lt;!DOCTYPE html&gt;
    &lt;html&gt;
        &lt;head&gt;
            &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
            &lt;title&gt;JSP Page&lt;/title&gt;
        &lt;/head&gt;
        &lt;body&gt;
            &lt;h1&gt;Hello World!&lt;/h1&gt;
            &lt;br&gt;
            &lt;applet code="HelloApplet.HelloApplet" archive="HelloApplet.jar" width="600" height="480"/&gt;
        &lt;/body&gt;
    &lt;/html&gt;

