8
1
When I'm looking for applications using Spotlight, the top entries are often JAR files. This is annoying. Is it possible to change Spotlight so that JAR files are not considered applications?
8
1
When I'm looking for applications using Spotlight, the top entries are often JAR files. This is annoying. Is it possible to change Spotlight so that JAR files are not considered applications?
8
I would like to do the same, but I think the answer is "it's not possible" or at least "it'd be risky to attempt".
Here's what I've discovered so far.
I started by assuming Spotlight is inferring that JAR files are kind:application because JAR files are associated with Jar Launcher.app by default. Perhaps if we can remove that association then Spotlight will stop indexing JAR files as apps.
This can be done the standard way in Finder. View a JAR file in Finder, view info, select a different application under "Open With", click "Change All". I tried this and had no change in Spotlight results, however I didn't try rebuilding my Spotlight index.
I don't like this as I don't want Archive Utility associated with JAR files, nor do I have another application I'd rather associate. That led me to...
This article purports to tell you how to remove a file association. It's only partly correct. It works to remove an association you previously added manually. Turns out it's no good for removing an association that comes from the system. I tried the referenced application, [RCDefaultApp][], which the article says can disable any association. Turns out the app just uses a kludge/workaround. It "disables" file associations by creating a new association to a dummy application, not by removing the actual association. This is no different than creating your own do-nothing application and associating it with .jar files.
A few of these articles reference the lsregister
command-line utility (part of how to rebuild Launch Services' associations). Run this:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Versions/Current/Support/lsregister -dump
And you'll get a big dump of Launch Services' configurations. Including these relevant parts:
bundle id: 48
path: /System/Library/CoreServices/CoreTypes.bundle
name: CoreTypes
identifier: com.apple.coretypes (0x800000ff)
...
--------------------------------------------------------
type id: 2224
uti: com.sun.java-archive
description: Java archive
flags: exported active core apple-internal trusted
icon:
conforms to: public.zip-archive, public.executable
tags: .jar, application/java-archive
...
--------------------------------------------------------------------------------
bundle id: 21264
path: /System/Library/CoreServices/Jar Launcher.app
name: Jar Launcher
...
library items:
...
--------------------------------------------------------
claim id: 25284
name: Java JAR file
rank: Default
roles: Viewer
flags: apple-default apple-internal relative-icon-path
icon: Contents/Resources/JAR.icns
bindings: com.sun.java-archive, .jar
Which for me says a few things:
conforms to: public.zip-archive, public.executable
leads me to believe I was wrong about Jar Launcher's association having anything to do with how
Spotlight indexes JAR files. I interpret the output to mean "JAR files are a core type which are considered
to be archives and applications"I'm really uncomfortable mucking around with /System/Library/CoreServices/CoreTypes.bundle, but it would appear that's what is necessary to change the "Java archive" type, removing "public.executable" from "conforms to". I'd put my money that that's what Spotlight is using when indexing JAR files and treating them as kind:application.
As a Java developer, you know that not all JAR files are applications. A more sophisticated indexer could examine the manifest inside the JAR. But that would only fix Spotlight. Arguably it's an OS X bug that Finder treats all JAR files as applications, allowing you to Command-O them and attempting to run them via Jar Launcher. Without knowing more about Launch Services, that seems like a limitation of the file extension centric mechanism at work here. Bummer.
sorry about the intentionally busted links. My low rep and the spam filter conspire to prevent a rich answer. If someone with high rep can correct it, that'd be nice. Otherwise I'll correct it myself when I'm more reputable. – toolbear74 – 2010-05-25T22:05:27.450
4
Jar files often comes from reduced set of directories. In my case, most jar files was in "/Applications/Eclipse/plugins". So, in System Preferences > Spotlight > Privacy, I've just prevented Spotlight from searching into this particular location. Now, it works like a charm :)
0
I think you've to filter searching in spotlight.
System Preferences >> Spotlight , at search result, drop mark for "Application". hope this works.
I kindly want to advise to use Google Quick Search Box . it allows you to search data on your computer and across the web. I think it's more powerful than spotlight.
According to my personal experience, this advice will not work if the jars are visible as plain jar files in the Finder.
However, it is always possible to drag entire folders from the Finder onto the "Privacy" tab within Spotlight's preferences. Folders listed in this tab are excluded from indexing. – Uwe Honekamp – 2010-03-08T05:16:06.120
I want applications to show up, I just don't want jar files to show up as applications. As a Java developer, I have so many jar files in my system that they are almost always the first result. – Jay Stramel – 2010-03-09T21:00:07.327
I never found out how to do this, either. However, I started using Alfred instead of Spotlight (Alfred uses the Spotlight index). Alfred filters out the JAR files. LaunchBar is a competitor which does the same. – toolbear74 – 2011-08-17T05:07:21.177