Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I would have commented on your answer as you requested but comments are limited in length. It is possible to achieve what you want: compiling the source without actually extracting it to a physical file on the file system.</p> <p>quoting from the API of the interface <a href="http://exoa.postech.ac.kr:8080/java5/api/javax/tools/StandardJavaFileManager.html" rel="nofollow">StandardJavaFileManager</a></p> <blockquote> <p>This file manager creates file objects representing regular files, <strong>zip file entries</strong>, or entries in similar file system based containers</p> </blockquote> <p>searching in google I found the following article: <a href="http://www.ibm.com/developerworks/java/library/j-jcomp/" rel="nofollow">Create dynamic applications with javax.tools</a></p> <p>in the section "Java compilation: Concepts and implementation" it states the following on "source files": </p> <blockquote> <p>one or more .java source files to compile. JavaFileManager provides an abstract file system that maps source and output file names to JavaFileObject instances. (<strong>Here, file means an association between a unique name and a sequence of bytes. The client doesn't need to use an actual file system</strong>.) </p> </blockquote> <p>The following article also does the same: <a href="http://www.javablogging.com/dynamic-in-memory-compilation/" rel="nofollow">Dynamic in-memory compilation</a></p> <p>Both use CharSequence as the source to compile. You can try to build your own implementation based on the explanation in the articles above with the change of being based on ZipEntry. otherwise, you can read the contents of the zip entry (as you mentioned, you know its a java source file) into a StringBuffer and just use the implementation from one of the articles to compile it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload