Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Folder in classpath for java project
Folder in classpath for java project [message #159640] Thu, 20 May 2004 09:01 Go to next message
Eclipse UserFriend
Hello,
How can I add folder from file systems in classpath for java project,
programmable (folder can be in eclipse workspace or not) ?

regards
Haris Peco
Re: Folder in classpath for java project [message #159686 is a reply to message #159640] Thu, 20 May 2004 13:39 Go to previous messageGo to next message
Eclipse UserFriend
hi

first you have to take the actual classpaths:

IClasspathEntry[] oldEntries = javaProject.getRawClasspaths();

then create a new array of IClasspathEntry, but now with capacity for the
new classpath we want to add

IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length+2];
System.arrayCopy (oldEntries,0,newEntries,0,oldEntries.length);
newEntries[oldEntries.length]=JavaRuntime.getDefaultJREConta inerEntry();

and then you have to add the path of the folder you want. To create a
IClasspathEntry out of a path you can use:

JavaCore.newSourceEntry
JavaCore.newLibraryEntry

depending on the the kind of classpath you want to create

then have to set the new claspaths:

javaProject.setRawClasspath (newEntries,null);



> Hello,
> How can I add folder from file systems in classpath for java project,
> programmable (folder can be in eclipse workspace or not) ?

> regards
> Haris Peco
Re: Folder in classpath for java project [message #159711 is a reply to message #159686] Thu, 20 May 2004 18:34 Go to previous messageGo to next message
Eclipse UserFriend
> JavaCore.newSourceEntry
> JavaCore.newLibraryEntry

I know this and I add easy base source, runtime library and jar libraries
and I want add folder btw:

/home/snpe/classes

When I create IClasspathEntry for this ?

I try
IClasspathEntry entry = JavaCore.newLibraryEntry(new
Path("/home/snpe/classes"),null,null);

but after javaProject.setRawClassPath my src lib,runtime lib and jar libs
are in classpath, but folder path not

Thanks
Re: Folder in classpath for java project [message #159836 is a reply to message #159711] Fri, 21 May 2004 13:56 Go to previous messageGo to next message
Eclipse UserFriend
snpe wrote:

>
>> JavaCore.newSourceEntry
>> JavaCore.newLibraryEntry
>
> I know this and I add easy base source, runtime library and jar libraries
> and I want add folder btw:
>
> /home/snpe/classes
>
> When I create IClasspathEntry for this ?
>
> I try
> IClasspathEntry entry = JavaCore.newLibraryEntry(new
> Path("/home/snpe/classes"),null,null);
>
> but after javaProject.setRawClassPath my src lib,runtime lib and jar libs
> are in classpath, but folder path not
>

I play with classpath yet - Classpath engine in eclipse try find class in
workspace when path is folder - don't try /home/snpe/classes then
WORKSPACE_HOME/home/snpe/classes (probably need project home too)
It is a problem with test environment - test start in empty workspace and I
have export to jar libraries all dependencies plugins for test project

Is there solution ?

regards
Haris Peco
Re: Folder in classpath for java project [message #160015 is a reply to message #159836] Sat, 22 May 2004 12:36 Go to previous messageGo to next message
Eclipse UserFriend
You can create a folder in your project linked to the folder you want to
add to the classpath. Then, instead of adding the original folder, add the
linked one.

> I play with classpath yet - Classpath engine in eclipse try find class in
> workspace when path is folder - don't try /home/snpe/classes then
> WORKSPACE_HOME/home/snpe/classes (probably need project home too)
> It is a problem with test environment - test start in empty workspace and I
> have export to jar libraries all dependencies plugins for test project

> Is there solution ?

> regards
> Haris Peco
Re: Folder in classpath for java project [message #160051 is a reply to message #160015] Sat, 22 May 2004 16:26 Go to previous messageGo to next message
Eclipse UserFriend
Hello Marcos,
I understand - it isn't possible add folder without workspace , but why ?

Thanks

Marcos Lopez wrote:

>
> You can create a folder in your project linked to the folder you want to
> add to the classpath. Then, instead of adding the original folder, add the
> linked one.
>
>> I play with classpath yet - Classpath engine in eclipse try find class in
>> workspace when path is folder - don't try /home/snpe/classes then
>> WORKSPACE_HOME/home/snpe/classes (probably need project home too)
>> It is a problem with test environment - test start in empty workspace and
>> I have export to jar libraries all dependencies plugins for test project
>
>> Is there solution ?
>
>> regards
>> Haris Peco
Re: Folder in classpath for java project [message #160082 is a reply to message #160051] Sat, 22 May 2004 18:48 Go to previous message
Eclipse UserFriend
I think that a bug related to this problem has been posted.

don't know if there's a better solution for this. At least i don't know
it. If you ever find another way, please send me an email telling me how.

> Hello Marcos,
> I understand - it isn't possible add folder without workspace , but why ?

> Thanks

> Marcos Lopez wrote:

> >
> > You can create a folder in your project linked to the folder you want to
> > add to the classpath. Then, instead of adding the original folder, add the
> > linked one.
> >
> >> I play with classpath yet - Classpath engine in eclipse try find class in
> >> workspace when path is folder - don't try /home/snpe/classes then
> >> WORKSPACE_HOME/home/snpe/classes (probably need project home too)
> >> It is a problem with test environment - test start in empty workspace and
> >> I have export to jar libraries all dependencies plugins for test project
> >
> >> Is there solution ?
> >
> >> regards
> >> Haris Peco
Previous Topic:Ant 1.6.1
Next Topic:Remote Debugging j2eesdk1.3.1 with Eclipse
Goto Forum:
  


Current Time: Sun Jun 08 14:01:32 EDT 2025

Powered by FUDForum. Page generated in 0.04145 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top