protected static Object evalClass(Class<?> clazz, ScriptContext ctx) throws ScriptException
	{
		// JSR-223 requirement
		ctx.setAttribute("context", ctx, 100);
		if (clazz == null)
		{
			return null;
		}
		try
		{
			boolean isPublicClazz = Modifier.isPublic(clazz.getModifiers());
			
			// find the setScriptContext method
			Method setCtxMethod = findSetScriptContextMethod(clazz);
			// call setScriptContext and pass current ctx variable
			if (setCtxMethod != null)
			{
				if (!isPublicClazz)
				{
					// try to relax access
					setCtxMethod.setAccessible(true);
				}
				setCtxMethod.invoke(null, new Object[]
				{
					ctx
				});
			}
			
			// find the main method
			Method mainMethod = findMainMethod(clazz);
			if (mainMethod != null)
			{
				if (!isPublicClazz)
				{
					// try to relax access
					mainMethod.setAccessible(true);
				}
				
				// get "command line" args for the main method
				String args[] = getArguments(ctx);
				
				// call main method
				mainMethod.invoke(null, new Object[]
				{
					args
				});
			}
			
			// return main class as eval's result
			return clazz;
		}
		catch (Exception exp)
		{
			exp.printStackTrace();
			throw new ScriptException(exp);
		}
	}