commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Short <...@benshort.co.uk>
Subject [JCI] Complication Error
Date Thu, 15 Oct 2009 14:57:07 GMT
Hi,

I'm trying to compile a JSP file and have looked at the examples but
can't get it to work.

My code:

JspGenerator jspGenerator = new JspGenerator();

		final byte[] jspSource =
jspGenerator.generateJavaSource("simple.jsp", new
File("target/test-classes/simple.jsp"));

		JavaCompiler compiler = new JavaCompilerFactory().createCompiler("eclipse");

		ResourceReader resourceReader = new ResourceReader() {
			public byte[] getBytes(String s) {
				return jspSource;
			}

			public boolean isAvailable(String s) {
				return true;
			}
		};

		ResourceStore store = new ResourceStore() {
			public byte[] read(String s) {
				System.out.println("");
				return null;
			}

			public void remove(String s) {
				System.out.println("");
			}

			public void write(String s, byte[] bytes) {
				System.out.println("");
			}
		};

		final CompilationResult result = compiler.compile(new
String[]{"simple.jsp"}, resourceReader, store);


		System.out.println( result.getErrors().length + " errors");
		System.out.println( result.getWarnings().length + " warnings");

simple.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head><title>Simple jsp page</title></head>
  <body>Place your content here</body>
</html>

And the error

The type java.lang.Object cannot be resolved. It is indirectly
referenced from required .class files

I had to add the following to the end of the JspReader

			output.flush();

else

			return outputStream.toByteArray();


Can anyone give me any pointers on how to proceed.

Regards

Ben Short

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message