trung / InMemoryJavaCompiler

Utility class to compile java source code in memory
Apache License 2.0
267 stars 85 forks source link

Can I use this in Android? #20

Open hamada147 opened 6 years ago

hamada147 commented 6 years ago

I've a scenario where I want to create a class in runtime then use it. I tried using the code provided here but it just light up like Christmas tree. Some of the packages don't work in the Android. Here is a list of them

  1. import javax.tools.Diagnostic;
  2. import javax.tools.DiagnosticCollector;
  3. import javax.tools.JavaCompiler;
  4. import javax.tools.JavaFileObject;
  5. import javax.tools.ToolProvider;
  6. import javax.tools.SimpleJavaFileObject;
  7. import javax.tools.FileObject;
  8. import javax.tools.ForwardingJavaFileManager;
  9. import javax.tools.JavaFileManager;

Is there is anyway where I can overcome them or use something else that exist in Android to do the same thing?

P.S I understand that javax doesn't exist in Android. I'm just wandering if there exist something equivalent to it.

he-dev commented 4 years ago

Same issue here. I'm afraid this might work only with workarounds. See javax.* cannot be imported in my Android app and other answers. But I give up. Looks like too much work at the moment.