This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Java compiler API is unable compile main java file with separate class files

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having some trouble trying to compile main java files with separate class files using the java compiler API.

The code that I have pasted is working for java files which does not require other class files (stand alone java files). However, I needed a code which can compile main java files that uses other class files separated from each other.

I always get the "cannot find symbol error" (compilation error) as it is not able to compile the file with other class files even though all the files (Java main and class files) are in the same folder.

I have also thought of another way which is to compile my code using by executing windows command prompt window using java code which I do not have no idea on how to do it. (I would appreciate if anyone thinks this is a better way and share ideas on how to do this.)

I would appreciate and thanks for any help given.

 
Marshal
Posts: 24961
61
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems to me you would have to specify the classpath somewhere, if you're trying to compile code which depends on other classes. I'm not familiar with the JavaCompiler type but it's clear to me that nothing in your code specifies a classpath.
 
We're being followed by intergalactic spies! Quick! Take this tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!