This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes BEA/Weblogic and the fly likes Unable to compile default package class used in other classes JavaCompiler API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Unable to compile default package class used in other classes JavaCompiler API" Watch "Unable to compile default package class used in other classes JavaCompiler API" New topic
Author

Unable to compile default package class used in other classes JavaCompiler API

thinkpavan pavan
Greenhorn

Joined: Apr 06, 2011
Posts: 6
I have a situvation where i need to compile classes dynamically.

Following is the structure in which my java classes have been organized.


where A is a class with default package, and B is a class with package name test. B has A as a attribute.

Files are saved in their respective folders( as per package )

I fail to compile this with JAVA Compiler API.

Any help !!
Syed Muhammad Nayyar Mustafa
Greenhorn

Joined: May 02, 2012
Posts: 11

if you mean through javax.tools.JavaCompiler, then use getTask method to set classpath option


Syed Muhammad Nayyar Mustafa
Greenhorn

Joined: May 02, 2012
Posts: 11

http://docs.oracle.com/javase/6/docs/api/javax/tools/JavaCompiler.html#getTask%28java.io.Writer,%20javax.tools.JavaFileManager,%20javax.tools.DiagnosticListener,%20java.lang.Iterable,%20java.lang.Iterable,%20java.lang.Iterable%29
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Unable to compile default package class used in other classes JavaCompiler API
 
Similar Threads
Access modifiers
what is wrong in this program involving thread
[Ant] Classpath issues building from multiple source trees
why this doesn't work on java 1.4?
Referencing classes in other files.