70

I'd like to be able to "open up" (without unzipping) .zip files or .jar files in IntelliJ much like you can do in Eclipse by clicking the twisty. How do I do this with IntelliJ?

Joel
  • 2,601
  • 4
  • 33
  • 44
  • 2
    Are they in your project? It should be browsable in the project view... for JARs at least. For dependencies on the classpath, you can find them under a Libraries sub-tree, I think... – ianpojman May 23 '12 at 03:15
  • 1
    They are in my project. I find it odd, in one folder it allows me to open one of the jars, but all the rest of the files in that folder are .jar files with no option to expand them. – Joel May 23 '12 at 03:53
  • 2
    @BhargavRao Why did you close this as off-topic? IntelliJ is definitely a tool primarily used for programming, making this question definitely on-topic. – Mark Rotteveel Feb 24 '19 at 09:34
  • @MarkRotteveel, I saw a lot of the link only answers recommending plugins and more general computing IDE related stuff, so I closed it. Reopened it anyway. – Bhargav Rao Feb 24 '19 at 09:42

4 Answers4

38

Jar files visible in your project structure that cannot be expanded have not yet been "added" as libraries. Right click the jar file and select Add as Library...

Also see Configuring Module Dependencies and Libraries.

And: Correct way to add lib/*.jar to an IntelliJ IDEA project

Community
  • 1
  • 1
Christopher Peisert
  • 21,862
  • 3
  • 86
  • 117
  • 2
    That certainly helped, some .jar files I wanted to open are now available. However, the .war file that I have which is a collection of .jar files from my Ivy build, I'd like to be able to see is built correctly, but none of the "Add as Library.." options seem to make it "openable". – Joel May 23 '12 at 14:30
  • 6
    this does not answer the question - not add a dependency but browse (example -> open and examine content) :) – ceph3us Mar 17 '17 at 19:45
  • 1
    from where I stand, pme's answer pointing to the plugin archive browser should be the accepted answer – rexford May 18 '19 at 20:05
30

There is now a Intellij Plugin that solves that:

https://plugins.jetbrains.com/plugin/9491-archive-browser

Update: it works now also for nested archives. (tested 2019.1)

pme
  • 14,156
  • 3
  • 52
  • 95
  • I have installed but can't see figure out how to use it. – Jim Collins Jul 06 '18 at 08:39
  • is it listed as installed as installed plugin in Intellij (restart is required)? Then any zip can be extended - I just tested that with the newest version of Intellij 2018.1 – pme Jul 06 '18 at 10:05
  • cool beans, that archive browser, works for me like a charm. This should be the accepted answer. – rexford May 18 '19 at 20:03
  • It doesn't seem to support jar, war, etc. Ironic because IntelliJ is Java focused. – Kramer Dec 02 '21 at 19:57
5

While Christopher Peisert's answer works for archives that aren't nested (you are out of luck if you have an EAR containing WARs) it is tedious that for most archive types (JARs being the exception), you have to add the file as a library or a dependency from the Project Structure area of Settings.

If you want to see archives be the default operation and work for nested archives, please vote for this YouTrack Issue 126376

pawel
  • 518
  • 7
  • 21
1

I created a new Intellij plugin to implement it. It support basic archives and tar.gz extension, the key feature is nested archive support. It had uploaded to Jetbrain repository. You can install it from plugin marketplace. See plugin github page for more information File Expander.

Camork
  • 23
  • 7