Hot questions for Using Ubuntu in intellij idea

Top Java Programmings / Ubuntu / intellij idea

Question:

I'm on Intellij 2018.2.1, Ubuntu 18.04.1 and having trouble to chose the JDK in IDE settings. None of the following can be selected:

/usr/lib/jvm/default-java
/usr/lib/jvm/java-1.11.0-openjdk-amd64
/usr/lib/jvm/java-11-openjdk-amd64

Result:

The selected directory is not a valid home for JDK.

java -version shows openjdk version "10.0.1" 2018-04-17.

What can I do?


Answer:

I just run another sudo apt install openjdk-11-jdk, which magically solved the problem...

Question:

I am using Linux Mint and trying to run Intellij IDEA from icon on the start menu. Starting Intellij via terminal ./idea.sh works fine. However launching from icon (points to the same ./idea.sh) ends up with following error:

No JDK found. Please validate either IDEA_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation.

Running echo $JAVA_HOME and java -version works correctly and shows installed JDK. How can I fix this issue and why starting from icon differs from starting from terminal?


Answer:

As @lealceldeiro and @millimoose pointed out, SDKMAN exposes JAVA_HOME every time terminal is launched. That is why JAVA_HOME was unavailable from other places. All I had to do is add JAVA_HOME to /etc/environment manually:

JAVA_HOME="/home/dmkach/.sdkman/candidates/java/current"

Question:

I have used IDEA for several months, and it was ok until now.

Now launching IDEA from shortcut has no effect. I suppose that happened after some updates.

I tried to reinstall IDEA, but problem is still there. Launching idea.sh from Terminal gives similar effect:

chronoexp@ChronoExp-PC:~/Programs/idea-IC-135.1289/bin$ ./idea.sh
Java HotSpot(TM) Server VM warning: ignoring option MaxPermSize=250m; support was removed in 8.0
chronoexp@ChronoExp-PC:~/Programs/idea-IC-135.1289/bin$ 

Note that message about HotSpot Server is ok. Previously after printing that, IDEA was launched. Now it simply kicks out with no error message.

Maybe there are some log files, where I can see possible error?

Ubuntu 14.04 LTS IDEA Version: 13.1.5 Build: 135.1289 java version "1.8.0_20" Java(TM) SE Runtime Environment (build 1.8.0_20-b26) Java HotSpot(TM) Server VM (build 25.20-b23, mixed mode)


Answer:

IntelliJ (and few other Java programs) sometimes has a problem with window not appearing or being frozen. It took me some time to find this simple solution that might be useful for someone in the future:

wmname LG3D

It solved the problem for me.

Question:

I am using IntelliJ IDE for the development and started the project using Play 2.x framework instead of activator:

Now I want to deploy this project to EC2-Ubuntu but to do that everyone is suggesting to install the Typesafe activator which will not work in my case.

I tried to follow the official documentation but they are also redirecting to download "play with activator". Is there any other way to deploy it instead of converting the whole project to typesafe activator?


Answer:

The play has a deployment system , you need to read the documentation to prepare the project in the right way , but basically you had used the command:

  • `activator dist
  • unzip file in target/universal/file.zip
  • `file.sh in bin folder

`Deploy documentation

Question:

In my Ubuntu 14.04 system I installed Oracle Java 8(JDK/JRE 8u111) because IntelliJ version 16 requires JDK version 1.8 or later(I had openjdk-7 installed).

IntelliJ installation is successful but creating new project gets error:

I get error "No Java SDK Found"

No Java SDK of appropriate version found. In addition to the IntelliJ Platform Plugin SDK, you need to define a JDK with the same Java version (JDK_1_8, description: 1.8).

How can I fix this problem?


Answer:

Have you tried to go in file then project structure , under Platform Settingsis SDKs , select it. Then add the path of your JDK. Hope this will work for you.

Question:

I have Intellij 2017.2.3 and Checkstyle-IDEA 5.10.0 running on my Ubuntu 17 dekstop. When i try to add a checkstyle for my Java project (at Settings->Other settings->Checkstyle) I get this error message:

java.lang.NoClassDefFoundError: org/apache/commons/collections/FastHashMap
    at org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:963)
    at org.apache.commons.beanutils.BeanUtilsBean.copyProperty(BeanUtilsBean.java:391)
    at com.puppycrawl.tools.checkstyle.api.AutomaticBean.tryCopyProperty(AutomaticBean.java:217)
    at com.puppycrawl.tools.checkstyle.api.AutomaticBean.contextualize(AutomaticBean.java:249)
    at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:455)
    at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:186)
    at org.infernus.idea.checkstyle.service.cmd.OpCreateChecker.execute(OpCreateChecker.java:58)
    at org.infernus.idea.checkstyle.service.cmd.OpCreateChecker.execute(OpCreateChecker.java:26)
    at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.executeCommand(CheckstyleActionsImpl.java:126)
    at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.createChecker(CheckstyleActionsImpl.java:56)
    at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.createChecker(CheckstyleActionsImpl.java:47)
    at org.infernus.idea.checkstyle.checker.CheckerFactoryWorker.run(CheckerFactoryWorker.java:44)

Is it familiar for anyone?


Answer:

I got the same issue while migrating the project from WAS 8 to WAS Liberty. I did copying the jar commons-collections.jar in to the server location /servers/<server_name>/lib/global and resolved it. So try to place the jar at IntelliJ local server.

java.lang.NoClassDefFoundError: org.apache.commons.collections.FastHashMap 
at org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:963)
at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:935)
at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:823)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:431)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)

Question:

I've upgraded my Ubuntu laptop (Dell XPS-13) from the factory installed version 16 all the way to 19.04. I've dealt with a few issues, but currently my only problem seems to be a few keyboard shortcuts going nuts.

For example, I can no longer comment out code on my IDEs, both IntelliJ and VSCode.

The shortcut is normally Ctrl+/, but now when I enter this, IntelliJ folds the code around where the cursor is, VSCode zooms out (everthing gets small).

Another shortcode that's broken is Ctrl+], which is supposed to navigate forward in IntelliJ, but now doesn't seem to do anything at all, even though Ctrl+[ still works and is the "opposite" shortcut, i.e. it navigates back instead of forward. However, both shortcuts actually seem to work on Firefox!

So, there's some evidence that the problem is not Java-specific, as VSCode, which is Electron based, is also suffering from at least one broken shortcut... but one of the broken shortcuts in IntelliJ seems to work fine on FireFox, which is very confusing.

In any case, I found a small keyboard logger Java app here and this is what it shows when I enter Ctrl+/:

KEY PRESSED: 
key code = 17 (Ctrl)
extended modifiers = 128 (Ctrl)
action key? NO
key location: left
KEY PRESSED: 
key code = 45 (Minus)
extended modifiers = 128 (Ctrl)
action key? NO
key location: standard
KEY TYPED: 
key character = '/'
extended modifiers = 128 (Ctrl)
action key? NO
key location: unknown
KEY RELEASED: 
key code = 17 (Ctrl)
extended modifiers = 0 (no extended modifiers)
action key? NO
key location: left 
KEY RELEASED: 
key code = 45 (Minus)
extended modifiers = 0 (no extended modifiers)
action key? NO
key location: standard

Java, at least, seems to see me pressing both - AND / when I only pressed /, but only while Ctrl is pressed!! This explains why VSCode zooms out and IntelliJ folds the code: they both see Ctrl+- rather than my intended Ctrl+/.

When I enter Ctrl+], the key logger shows:

KEY PRESSED: 
key code = 17 (Ctrl)
extended modifiers = 128 (Ctrl)
action key? NO
key location: left
KEY PRESSED: 
key code = 135 (Dead Diaeresis)
extended modifiers = 128 (Ctrl)
action key? NO
key location: standard
KEY TYPED: 
key character = ''
extended modifiers = 128 (Ctrl)
action key? NO
key location: unknown
KEY RELEASED: 
key code = 135 (Dead Diaeresis)
extended modifiers = 128 (Ctrl)
action key? NO
key location: standard
KEY RELEASED: 
key code = 17 (Ctrl)
extended modifiers = 0 (no extended modifiers)
action key? NO
key location: left

This time, it seems to see something entirely different from what I entered. Instead of ] (which I can type here easily enough) it seems to see 135 (Dead Diaeresis) and ``, whatever that is.

My keyboard is set to use English (Australia) layout and I have a few languages installed (Portuguese, Swedish, English) but I only use English while writing code.

Any idea of what I can do to fix this problem would be highly appreciated!

PS. I've already asked this on the Ubuntu community but got nothing there, not even comments... https://askubuntu.com/questions/1192805/ctrl-shortcut-does-not-work-after-ubuntu-upgrade


Answer:

What layout goes first in your system settings?

There's a known issue that the first in order layout is used for shortcuts: https://youtrack.jetbrains.com/issue/JBR-1675

Question:

screenshot of intellij project

i know there's alot of question with my title but i can't find answer

intellij was working fine but i remove the old ubuntu and install new one and then install intellij

so now intellij new projects work also fine but when i open existing project that exists before new ubuntu they doesn't work well and i can't select class as Main class and the project structure itself is so strange i can't find source and classes and so on

and when new project created it say no idea annotations attached to the jdk intellij


Answer:

Were the project settings for the old projects preserved in the same place (directory)? If not, open existing projects via File | New | Project from Existing Sources... action so that IDE re-creates the project settings and project structure.

If you do not want to delete previous settings and there are issues with project structure - change it manually in File | Project Structure | Modules | <module name> by configuring content roots for module: e.g. on the image you need to add content with the StronglyConnected components root directory and specify src folder as a source root by marking it as such.