The Artima Developer Community
Sponsored Link

Java Answers Forum
Compiling problem with javac.Main.compile

2 replies on 1 page. Most recent reply: Jun 23, 2003 11:49 AM by Namita

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
guillaume

Posts: 21
Nickname: salulezami
Registered: May, 2003

Compiling problem with javac.Main.compile Posted: Jun 20, 2003 12:12 AM
Reply to this message Reply
Advertisement
Hello, I have a problem with compiling a source file with javac.Main. But there is an error: the method compile from com.sun.tools.javac.Main is not static...
???? Why ?? How make it work ????
thanks a lot.


String [] source = { new String(ClassName+".java")};
ByteArrayOutputStream baos= new ByteArrayOutputStream();
int result = com.sun.tools.javac.Main.compile(source);
System.out.println(baos.toString());
return (baos.toString().indexOf("error")==-1)


Adam Duffy

Posts: 168
Nickname: adamduffy
Registered: Feb, 2003

Re: Compiling problem with javac.Main.compile Posted: Jun 20, 2003 2:31 AM
Reply to this message Reply
Try making the method static?

This is just a SWAG and I apologise if I misunderstood your question. :)

Adam

Namita

Posts: 3
Nickname: nam
Registered: Jun, 2003

Re: Compiling problem with javac.Main.compile Posted: Jun 23, 2003 11:49 AM
Reply to this message Reply
If u are calling this method from a static method or a class then the method being called should be static or else it will give u this error
Solution can be , call this method from a non-static method

It shud solve ur problem


-Namita

Flat View: This topic has 2 replies on 1 page
Topic: The Java Programming Language - To clarify a confusing explanation Previous Topic   Next Topic Topic: Calling Crystal report from Swing

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use