Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "FAQ How do I distinguish between internal and external JARs on the build path?"

 
(See Also:)
 
Line 18: Line 18:
 
[[FAQ_What_is_the_difference_between_a_path_and_a_location%3F]]
 
[[FAQ_What_is_the_difference_between_a_path_and_a_location%3F]]
  
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>
+
{{Template:FAQ_Tagline}}

Latest revision as of 13:57, 30 May 2013

The Java build path differentiates between internal JARs and external JARs. To find the file-system location for an internal JAR, the workspace path needs to be converted into a file-system location, as follows:

   IClasspathEntry entry = ...
   IPath path = entry.getPath();
   IWorkspace workspace = ResourcesPlugin.getWorkspace();
   IResource jarFile= workspace.getRoot().findMember(path);
   if (jarFile != null) {
      return jarFile.getLocation();
   } else {
      // must be an external JAR (or invalid classpath entry)
   }

See Also:

FAQ_What_is_the_difference_between_a_path_and_a_location?


This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.

Back to the top