Java running lucee code

So I’m having issues trying out the Java running lucee code explained here http://docs.lucee.org/guides/working-with-source/java-using-lucee-in-java.html#when-lucee-does-not-load-your-java-code

I don’t seem to be having much luck. Can anyone help?

So I have lucee/tomcat running and can successfully view a test cfm file by visiting http://localhost:8888/index.cfm
So then I try compile some java on the same linux box

javac -classpath .:/usr/local/tomcat/lib/servlet-api.jar:/usr/local/tomcat/lucee/lucee.jar Todo.java

and i get “error cannot access PageContext” from this line Scope appScope = pc.applicationScope();

I’ve tried using localhost and localhost:8888 in the createPageContext to try this out but both seemed to fail.

Any ideas what i’m doing wrong here?

import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;

import lucee.loader.engine.CFMLEngine;
import lucee.loader.engine.CFMLEngineFactory;
import lucee.runtime.type.scope.Scope;
import lucee.runtime.PageContext;

public class Todo {

	public static void main(String[] args) {
    	System.out.println("hello world main()");
	}


	public void something() throws ServletException {
		CFMLEngine engine = CFMLEngineFactory.getInstance();
		// cookies for this simulated request, can also be null
		javax.servlet.http.Cookie[] cookies = new Cookie[]{new Cookie("myCookie","myCookieValue")};
		
		// headers for this simulated request
		Map<String, Object> headers=new HashMap();
		headers.put("accept","text/html");

		// headers for this simulated request, can also be null
		Map<String, String> parameters=new HashMap();
		
		// headers for this simulated request, can also be null
		Map<String, Object> attributes=new HashMap();
		
		PageContext pc = engine.createPageContext(
				null,
				 "localhost" // host
				,"/index.cfm" // script name
				,"test=1" // query string
				,cookies
				,headers
				,parameters
				,attributes
				,System.out // response stream where the output is written to
				,50000 // timeout for the simulated request in milli seconds
				,true // register the pc to the thread
				);
		try{
			// get a reference to the Application Scope:
			Scope appScope = pc.applicationScope();
		}
		finally{
			engine.releasePageContext(pc, true/* unregister the pc from the thread*/);
		}
	}
}