0

I have a program that compiles a Java class.

JavaCompiler.CompilationTask compilationTask = compiler.getTask(null, fileManager, diagListener, compilerOptions, null, Arrays.asList(compilationUnit));
compilationTask.call;

In compilerOptions, classpath is being set with -classpath

I need to modify this by adding wildchar in the classpath so that it will add all jar files from the directory.

I tried the following values for being used for the -classpath flag, but all fails.

"one.jar:two.jar:/data/third_party/*:" 
"one.jar:two.jar:/data/third_party/*" 
"\"one.jar:two.jar:/data/third_party/*\""

Is there a way to make this work?

Edit: This is not about the options we set from the command line. I am aware of existing questions on that.

rajesh
  • 3,247
  • 5
  • 31
  • 56
  • I think the duplicate question definitely answers your question, namely that it is not supported. Did you not see this part of the accepted answer to the duplicate question? _You are trying to call the Java compiler from source directly with its Java API. This source code does not contain the wildcard expansion._ – Abra Jun 13 '23 at 07:19
  • @Abra Thanks for pointing this out. I had indeed missed that part where it gets called out. I have asked to close this question again. – rajesh Jun 15 '23 at 08:16

0 Answers0