tags:

views:

131

answers:

3

I need to find out, in which path this following path is resolved:

<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>

It's no classpath variabl to be found unter Window->Preferences, Java->Build Path->Classpath Variables.

Where can I found the value von JUNIT_CONTAINER/4?

Thanks

+1  A: 

Try Help -> About Eclipse Platform -> Configuration Details.

Mark
+2  A: 

A classpathentry of kind "con" means classpath container.

From Java Class Paths help page:

entry denoting a classpath container:
an indirect reference to a structured set of project or libraries.
Classpath containers are used to refer to a set of classpath entries that describe a complex library structure.
Like classpath variables, classpath containers (IClasspathContainer) are dynamically resolved.
Classpath containers may be used by different projects, causing their path entries to resolve to distinct values per project.
They also provide meta information about the library that they represent (name, kind, description of library.)

Classpath containers can be manipulated through JavaCore methods getClasspathContainer and setClasspathContainer.


So in your case, to be really sure about the resolved path, you could query your own project through those calls, like this ClassPathUtils

case IClasspathEntry.CPE_CONTAINER:
{
   final IClasspathContainer container;

   try
   {
      container = JavaCore.getClasspathContainer( entry.getPath(), jproj );
   }
   catch( JavaModelException e )
   {
      Logger.getLogger().logError( e );
      continue;
   }

   if( container != null ) 
   {
      final IClasspathEntry[] containerEntries
        = container.getClasspathEntries();

      for( int j = 0; j < containerEntries.length; j++ )
      {
        resolved.add( containerEntries[ j ].getPath() );
      }
   }
}
VonC
A: 

A simple solution is this little JUnit test.
It must be a test, because Eclipse only sets the needed libraries to the classpath System Property:

import static org.junit.Assert.assertTrue;
import org.junit.Test;

public class TestApp {
    @Test
    public void bla() {
     System.out.println(System.getProperty("java.class.path"));
     assertTrue(true);
    }
}
furtelwart