views:

812

answers:

4

I want to a project build path (default is src...). Can I do it using some java API?

A: 

The project default path is just a common used standard, most IDE's default to it but there are no Java API methods you can use.

Peter
Hey, it's one of those peculiar people who write Java as an acronym :)
skaffman
Just Another Vague Acronym?
Robert Munteanu
in eclipse plugin
Ido
+1  A: 

There is a set of Ant tasks for this purpose. You could, in theory, use the Ant tasks as a Java API, albeit a rather clumsy one (unless you're actually writing in Ant, that is)

skaffman
We use them here - a bit rough, but you get the job done.
Thorbjørn Ravn Andersen
A: 

The project deault path is just a common used standard, most IDE's default to it but there > are no Java API methods you can use.

+1

The project path is a development convention, but the java application built is independant from this development path.

Most Java IDE allow you to change this path.

In Eclipse for example, this path can be changed with : Right clic on project folder > Properties > Java build path

If you need this path in external programs for build, Eclipse has internal variables that can be used (for Ant, Maven, etc.). When configuring an "external tool", you can for example use {$project_loc}. This will be dynamically replaced by the project path.

Benoit Courtine
I need it inside an eclipse plugin
Ido
+2  A: 

The question poster is writing an Eclipse plugin.

You can find the JDT API in the Eclipse help. You should be able to get the information you want from IJavaProject. See this tutorial for one example of how to get this.

McDowell