Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2005

Tip: Looking for answers? Try searching our database.

Eclipse components

Thread view: 
Tim Tyler - 28 Jul 2005 13:19 GMT
Are the Eclipse compiler and formatter available as stand-alone
components yet?

If not why not?  Is it something to do with being big and blue?
Or do they not want their competitors using these components?
Signature

__________
|im |yler  http://timtyler.org/  tim@tt1lock.org  Remove lock to reply.

Chris Smith - 28 Jul 2005 15:16 GMT
> Are the Eclipse compiler and formatter available as stand-alone
> components yet?

I'm not aware of the formatter being available this way.  The compiler
appears to be used in Jasper as distributed with Tomcat 5.5, so it is at
least possible to use it this way.

> If not why not?  Is it something to do with being big and blue?
> Or do they not want their competitors using these components?

Mainly because you haven't packaged it that way yet.  Let's get back to
reality here!  There's no point acting like this is some big IBM
conspiracy to keep the functionality under wraps.  It's open source.  
Understandably, the project developers want to spend their time making
Eclipse better... and I'm quite grateful for that.  I think it's a wise
decision on their part.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Tim Tyler - 28 Jul 2005 22:38 GMT
Chris Smith <cdsmith@twu.net> wrote or quoted:

> > Are the Eclipse compiler and formatter available as stand-alone
> > components yet?
[quoted text clipped - 12 lines]
> Eclipse better... and I'm quite grateful for that.  I think it's a wise
> decision on their part.

If a component is viable as a modular element, then the larger the
audience it has, the more developers it attracts, the faster development
goes, and the better the tool gets.

As far as I can see, an Eclipse-only formatter is a project that doesn't
make much sense.

*Most* formatters can be plugged into any IDE, or used from the command
line.

The Eclipse formatter appears to suffer from not having any command-line
interface.

How do you format all the files in a project?

It's a symptom of the underlying problem.

What's the cause of the problem?  As you can see from my speculations, I
don't really know - but I am interested in the cause of it - since it
seems to be repeatedly causing monolith-related problems for Eclipse.
Signature

__________
|im |yler  http://timtyler.org/  tim@tt1lock.org  Remove lock to reply.

Roland - 28 Jul 2005 19:37 GMT
> Are the Eclipse compiler and formatter available as stand-alone
> components yet?
>
> If not why not?  Is it something to do with being big and blue?
> Or do they not want their competitors using these components?

In one of our projects I've used the Eclipse compiler to compile a batch
of Java files. This works perfectly. [Never used formatter stand-alone.]

You'll need the 'JDT Core' plugin: I've used org.eclipse.jdt.core_3.0.1,
in particular the class org.eclipse.jdt.internal.compiler.batch.Main in
jdtcore.jar. The following snippet shows how this class can be used

import org.eclipse.jdt.internal.compiler.batch.Main

/**
 * Compiles sourceFile and produces .class file in outDir.
 * @param sourceFile source file to compile
 * @param outDir directory of resulting class file
 * @return <code>true</code> if compilation was successful,
 *         <code>false</code> when compilation failed
 */
private boolean compileJavaSource(File sourceFile, File outDir)
{
  StringWriter javacOut = new StringWriter();
  PrintWriter pwJavacOut = new PrintWriter(javacOut);
  StringWriter javacErr = new StringWriter();
  PrintWriter pwJavacErr = new PrintWriter(javacErr);

  Main javac = new Main(pwJavacOut, pwJavacErr, false);

  String[] args = {"-d", outDir.toString(), sourceFile.toString()};

  boolean compiled = javac.compile(args);
  pwJavacOut.close();
  pwJavacErr.close();

  if (compiled)
  {
     // success
     return true;
  }
  else
  {
    // failed: log compiler messages
    __logger.severe("Java compiler stdout: " + javacOut.toString());
    __logger.severe("Java compiler stderr: " + javacErr.toString());
    return false;
  }
}

Signature

Regards,

Roland de Ruiter
` ___      ___
`/__/ w_/ /__/
/  \ /_/ /  \



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.