EzDevInfo.com

intellij-idea interview questions

Top intellij-idea frequently asked interview questions

IntelliJ shortcut to show a popup of methods in a class that can be searched

I'm switching over from Eclipse to IntelliJ. In Eclipse, if you do Ctrl+O in the editor, it will show a hover popup that allows you to search for a method in the class you're editing.

What is the equivalent shortcut for that in IntelliJ?


Source: (StackOverflow)

What is Eclipse's Ctrl+O shortcut equivalent in IntelliJ IDEA?

I like to use Eclipse's shortcut Ctrl + O which outlines the current source. Is there an equivalent shortcut in IntelliJ IDEA?

It opens a dialog which allows for quick search of methods and fields in a class.


Source: (StackOverflow)

Advertisements

Intellij reformat on file save

I remember seeing in either IntelliJ or Eclipse the setting to reformat (cleanup) files whenever they are saved. How do I find it (didn't find it in the settings)


Source: (StackOverflow)

IntelliJ: Never use wildcard imports

Is there a way to tell IntelliJ never to use wildcard imports? Under 'Settings > Code Style > Imports', I can see that you can specify the 'class count' prior to IntelliJ using wildcard imports. However, if I never want to use wildcard imports can I turn this functionality off?

I have tried putting -1 or leaving the field blank but that just tells IntelliJ to always use wildcard imports. Obviously a not-so-nice solution would be to put a ridiculously high number so that you never encounter wildcard imports but I was hoping there was a nicer way to just turn it off.


Source: (StackOverflow)

What is the best IDE to develop Android apps in? [closed]

I am about to start developing an android app and need to get an IDE. Eclipse and the android eclipse plugin appears to be the natural choice. However I am familiar with intelliJ and re-sharper so I would prefer use intelliJ.

Has anyone used http://code.google.com/p/idea-android? Is this any good?

Should I just bite the bullet and learn Eclipse?


Source: (StackOverflow)

How can I permanently have line numbers in IntelliJ?

How can I permanently have line numbers in IntelliJ?


Source: (StackOverflow)

How do I turn off the unlimited whitespace in IntelliJ editor?

How do I remove the ability to move the cursor after then end of line in IntelliJ?


Source: (StackOverflow)

How to create a .jar file or export jar on IntelliJ (like eclipse java archive export) [duplicate]

This question already has an answer here:

I was using IntelliJ-IDEA IDE , I want to create a jar file from java compiled class files. but I not found command or file, How to create a jar file (like eclipse java archive export)


Source: (StackOverflow)

What to gitignore from the .idea folder?

Possible Duplicate:
Intellij Idea 9/10, what folders to check into (or not check into) source control?

I started using WebStorm for web development and am not sure what to add and what to exclude from our Git repository. Clearly some files inside the .idea folder are meant to be version controlled like the external library settings (jsLibraryMappings.xml) but others will probably change very often and are developer-specific (e.g., workspace.xml).

What is the recommended .gitignore pattern for WebStorm / IntelliJ IDEA?

P.S. There are already questions about this but usually focus only on whether to include the whole .idea folder or whether to fully exclude it. I think some of the files inside the .idea folder should be version controlled while others shouldn't and I'm trying to find out which ones.


Source: (StackOverflow)

How to increase IDE memory limit in IntelliJ IDEA on Mac?

I'm using IDEA 12 Leda on Mountain Lion. I wanted to increase the maximum memory that IDE can use. I set the VMOptions in Info.plist file to be -Xmx2048m -ea -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -Xbootclasspath/a:../lib/boot.jar

When I open up IDEA, I still see the maximum memory to be 711m.

jps -v shows my VMOptions has been loaded but it's replaced by the following options.

29388  **-Xmx2048m** -ea -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -Xbootclasspath/a:../lib/boot.jar -Xms128m **-Xmx800m** -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=64m -XX:+UseCodeCacheFlushing -XX:+UseCompressedOops -Didea.paths.selector=IdeaIC12 -Dsun.java2d.noddraw=true -Didea.max.intellisense.filesize=2500 -Didea.dynamic.classpath=false -Didea.jars.nocopy=false -Dsun.java2d.d3d=false -Dapple.awt.fullscreencapturealldisplays=false -Dapple.laf.useScreenMenuBar=true -Djava.endorsed.dirs= -Dswing.bufferPerWindow=false -Didea.fatal.error.notification=enabled -Didea.cycle.buffer.size=1024 -Didea.popup.weight=heavy -Didea.xdebug.key=-Xdebug -Dapple.awt.graphics.UseQuartz=true -Dsun.java2d.pmoffscreen=false -Didea.no.launcher=false -DCVS_PASSFILE=~/.cvspass -Didea.use.default.antialiasing.in.editor=false -Dcom.apple.mrj.application.live-resize=false -Didea.smooth.progress=false
29392 Jps -Dapplication.home=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home -Xms8m

Where does -Xmx800 come from? I need to remove it.


Source: (StackOverflow)

JetBrains' new intelliJ IDEA 13 slow?

While using intelliJ 13 ultimate edition for a week, it just seems really slow.

First of all, the whole IDE stops for a second or so every once in a while. The java editor's auto complete is really slow compared to 12 version.

I have not changed anything from default setting other than using dracula theme.

Is this happening to everybody? Or do I have to change some setting to resolve this problem??

EDIT

It seems that this is not a problem of my own. Many people suggested setting the heap size higher than default or clearing the cache, but I have not checked or tested on these suggestion.

However, the fact that IntelliJ 12 performs fine with default settings but 13 not still remains. As folks at Jetbrain probably seen how this problems affects many people, they are probably fixing it as we speak(or already found a fix).


Source: (StackOverflow)

IntelliJ IDEA with Junit 4.7 "!!! JUnit version 3.8 or later expected:"

When I attempt to run the following test in IntelliJ IDEA I get the message:

!!! JUnit version 3.8 or later expected:

It should be noted that this is an Android project I am working on in IntelliJ IDEA 9.

public class GameScoreUtilTest {
    @Test
    public void testCalculateResults() throws Exception {
        final Game game = new Game();

        final Player player1 = new Player();
        {
            final PlayedHole playedHole = new PlayedHole();
            playedHole.setScore(1);
            game.getHoleScoreMap().put(player1, playedHole);
        }
        {
            final PlayedHole playedHole = new PlayedHole();
            playedHole.setScore(3);
            game.getHoleScoreMap().put(player1, playedHole);
        }
        final GameResults gameResults = GameScoreUtil.calculateResults(game);

        assertEquals(4, gameResults.getScore());
    }
}

The full stack trace looks like this...

!!! JUnit version 3.8 or later expected:

java.lang.RuntimeException: Stub!
    at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:5)
    at junit.textui.TestRunner.<init>(TestRunner.java:54)
    at junit.textui.TestRunner.<init>(TestRunner.java:48)
    at junit.textui.TestRunner.<init>(TestRunner.java:41)
    at com.intellij.rt.execution.junit.JUnitStarter.junitVersionChecks(JUnitStarter.java:152)
    at com.intellij.rt.execution.junit.JUnitStarter.canWorkWithJUnitVersion(JUnitStarter.java:136)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:110)

Process finished with exit code -3

Source: (StackOverflow)

IntelliJ tooltip shows JavaDocs

In Eclipse, hovering over a method, variable, etc displays a tooltip with the corresponding JavaDocs. Is there such a feature in IntelliJ?


Source: (StackOverflow)

Is there "Break on Exception" in IntelliJ?

Is there feature that will automatically break debugging on first exception occurrence?

So we

  1. start application
  2. do something that throw exception
  3. got IntelliJ popped up highlighted line where exception occurred.

Source: (StackOverflow)

IDEA: javac: source release 1.7 requires target release 1.7

When running a JUnit test, using IntelliJ IDEA, I get

enter image description here

How can I correct this?

  • Using SDK 1.7
  • Module language level is 1.7

Maven build works fine. (That's why I believe this in IDEA configuration issue)


Source: (StackOverflow)