Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3760662
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:30:20+00:00 2026-05-19T10:30:20+00:00

How to get the Eclipse installation directory through programming in swt/java. I actually want

  • 0

How to get the Eclipse installation directory through programming in swt/java.
I actually want to get the plugins directory of the eclipse.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T10:30:21+00:00Added an answer on May 19, 2026 at 10:30 am

    Update (January 2012)
    James Moore mentions in the comments that the FAQ and API are quite old.

    FileLocator.resolve(URL) is now preferred to the deprecated Platform.resolve().

    As this example shows, you need to pass the actual resource (here a bundle), not the name of the resource, in order to resolve it:

    private static URI locateFile(String bundle, String fullPath) {
      try {
        URL url = FileLocator.find(Platform.getBundle(bundle), new Path(fullPath), null);
        if(url != null)
          return FileLocator.resolve(url).toURI();
      } catch (Exception e) {}
        return null;
      }
    }
    

    See also “How to refer a file from jar file in eclipse plugin” for more.


    Original answer (January 2011)

    Maybe the FAQ “How do I find out the install location of a plug-in?” can help here:

    You should generally avoid making assumptions about the location of a plug-in at runtime.
    To find resources, such as images, that are stored in your plug-in’s install directory, you can use URLs provided by the Platform class. These URLs use a special Eclipse Platform protocol, but if you are using them only to read files, it does not matter.

    In Eclipse 3.1 and earlier, the following snippet opens an input stream on a file called sample.gif located in a subdirectory, called icons, of a plug-in’s install directory:

      Bundle bundle = Platform.getBundle(yourPluginId);
      Path path = new Path("icons/sample.gif");
      URL fileURL = Platform.find(bundle, path);
      InputStream in = fileURL.openStream();
    

    If you need to know the file system location of a plug-in, you need to use Platform.resolve(URL). This method converts a platform URL to a standard URL protocol, such as HyperText Transfer Protocol (HTTP), or file.
    Note that the Eclipse Platform does not specify that plug-ins must exist in the local file system, so you cannot rely on this method’s returning a file system URL under all circumstances in the future.

    In Eclipse 3.2, the preferred method seems to be:

      Bundle bundle = Platform.getBundle(yourPluginId);
      Path path = new Path("icons/sample.gif");
      URL fileURL = FileLocator.find(bundle, path, null);
      InputStream in = fileURL.openStream();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When using Eclipse or NetBeans IDE on a Java project I get to see
Is there a way to get the directory of a project in Eclipse? We
I opened eclipse 3.3.2. Now i need to get the current eclispe installation path.
What's the easiest way for me to get Eclipse running with a Java servlet
Having dealt with yet another stupid eclipse problem, I want to try to get
It's 5 button clicks to get eclipse to create a deployable war file for
Does anyone know of an Eclipse plug-in or method to get Eclipse to generate
Does anyone know if there's a way to get Eclipse to do a Save
I'm new to Apex and have just downloaded Eclipse to get to work Eclipse
When I click Ctrl + Shift + R in eclipse I get a dialog

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.