@Override
    public CompilationResult compile( String[] pResourcePaths,
                                      ResourceReader pReader,
                                      ResourceStore pStore,
                                      ClassLoader pClassLoader,
                                      JavaCompilerSettings pSettings) {
        DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
        JavaCompiler compiler = getJavaCompiler();

        try (StandardJavaFileManager jFileManager = compiler.getStandardFileManager(diagnostics, null, Charset.forName(pSettings.getSourceEncoding()))) {
            try {
                jFileManager.setLocation( StandardLocation.CLASS_PATH, pSettings.getClasspathLocations() );
                jFileManager.setLocation( StandardLocation.CLASS_OUTPUT, Collections.singletonList(new File("target/classes")) );
            } catch (IOException e) {
                // ignore if cannot set the classpath
            }

            try (MemoryFileManager fileManager = new MemoryFileManager( jFileManager, pClassLoader )) {
                final List<JavaFileObject> units = new ArrayList<>();
                for (final String sourcePath : pResourcePaths) {
                    units.add( new CompilationUnit( PortablePath.of(sourcePath), pReader ) );
                }

                Iterable<String> options = new NativeJavaCompilerSettings( pSettings ).toOptionsList();

                if ( compiler.getTask( null, fileManager, diagnostics, options, null, units ).call() ) {
                    for (CompilationOutput compilationOutput : fileManager.getOutputs()) {
                        pStore.write( compilationOutput.getBinaryName().replace( '.', '/' ) + ".class", compilationOutput.toByteArray() );
                    }
                    return new CompilationResult( new CompilationProblem[0] );
                }
            }

            List<Diagnostic<? extends JavaFileObject>> problems = diagnostics.getDiagnostics();
            CompilationProblem[] result = new CompilationProblem[problems.size()];
            for (int i = 0; i < problems.size(); i++) {
                result[i] = new NativeCompilationProblem( ( Diagnostic<JavaFileObject> ) problems.get( i ) );
            }

            return new CompilationResult( result );
        } catch (IOException e) {
            throw new RuntimeException( e );
        }
    }
@Test(expected = KieMemoryCompilerException.class)
	public void simulateJre() {

		NativeJavaCompiler compiler = new NativeJavaCompiler(new NullJavaCompilerFinder());

		
		compiler.compile(null, null, null, null, null);
	}