Compile from memory/filesystem to memory/filesystem, easily


  • Convenience functionality on top of
  • Compile to/from the file-system, or entirely in-memory (e.g. from source as String to class as byte array)
  • Fluid builder with specific support for annotation processors
  • Create native headers in arbitrary locations (in-mem/on-disk)
  • Find sourcecode for classes within maven module or it’s dependencies (on proviso that source jar has been downloaded)

Provides a complete in-memory experience:

Note: currently the Eclipse compiler only supports input from the filesystem.

Dependency Graph

Module Dependency


Take the source as a String, then compile it to a map of byte arrays:

		final String fqn = "com.acme.Thing";

		final String text = "" +
				"package com.acme;   \n" +
				"                    \n" +
				"class Thing {       \n" +

				" int fortyTwo()     \n" +
				" {                  \n" +
				"   return 42;       \n" +
				" }                  \n" +
				"}                   \n";

		void map()
			Map<String, byte[]> map;

			map = compiling()

			byte[] bytes = map.get(Names.typeToResourceName(fqn));

			assertValidClass(bytes, fqn);

Find the source for the specified class, then compile it the filesystem:


			Path compiled = path.resolve(Names.typeToResourceName(Pojo.class));
			byte[] bytes = Files.readAllBytes(compiled);

			assertValidClass(bytes, Pojo.class.getCanonicalName());


Back to top

Version: 0.1.0. Last Published: 2018-10-08.

Earcam Maven Skin.