intellij-idea

Unable to reference environment variables

99封情书 提交于 2021-01-29 14:42:53
问题 Anyone know why I am unable to reference the User environment variables shown below (red box) but I am able to reference the System environment variables (green box) without any issues? 回答1: Ok so, in short, they need to be placed in <environmentVariables>ENVIRONMENT VARIABLES GO HERE </environmentVariables> within the POM for them to be picked up. As @Andrey pointed out in his reply, they do show as unresolved but will still work. You can stop them showing as unresolved using: <!--suppress

Regex not matching words ending with “Impl”

馋奶兔 提交于 2021-01-29 10:04:45
问题 I want to create a regex that allows only class names not ending with Impl . I'v read that "not ends with" could be tested with a negative lookahead (?!) , but I cannot find a working (Java) regex. I tried [A-Z][A-Za-z\d]*?(?!Impl) but it matches SomeImpl , what shouldn't be the case. What regex wouldn't match class names ending with Impl ? 回答1: A negative lookahead wont work because - with the *? (lazy zero-or-more) quantifier - it'll check at S and find no Impl immediately ahead so the

Global git config Intellij

不问归期 提交于 2021-01-29 09:35:16
问题 I am using the latest version of Intellij IDEA 2019.3 on Ubuntu 18.04 and whenever I create a new project I have to add a local git config because Intellij cannot find the global config. From the IDEA terminal git can read my global git settings but IDEA VCS can't. 回答1: IntelliJ does not have builtin git and thus is not looking for configs itself - it just issues commands to the command-line git client, and git itself reads the configs as needed and applies them. The only reason for git to

Why the following bitwise operation will generate a Numeric Overflow?

六月ゝ 毕业季﹏ 提交于 2021-01-29 08:53:32
问题 I have the following rather straight forward bit-wise operation final int mask = ((1 << 31) - 1); However, I'm really can't figure out why, Android Studio (IntelliJ) IDE will give me Numeric Overflow warning I did a quick run in desktop public static void main(String[] args) { final int mask = ((1 << 31) - 1); System.out.println(mask); // 2147483647 System.out.println(Integer.MAX_VALUE); // 2147483647 } It seems fine to me. However, I was puzzling, why IDE gives me such warning? 回答1: It seems

How to make jar file with all dependencies a.k.a. Fat jar with IntelliJ

て烟熏妆下的殇ゞ 提交于 2021-01-29 08:49:30
问题 I'm trying to make jar file with all dependencies in my project. I'm using IntelliJ. I tried two ways. In maven window of upper-right part of IntelliJ, I clicked "clean" and "package" with below pom.xml. But it doesn't contain any dependencies. I'm using IntelliJ in window, so I can't follow below link which is CLI. I'm using GUI maven window in upper right part of IntelliJ. How can I create an executable JAR with dependencies using Maven? I clicked Build-Build artifact - build following

IntelliJ IDEA (2020.2): Gradle: The cache entry for initialization script 'ijinit.gradle' appears to be corrupted

淺唱寂寞╮ 提交于 2021-01-29 08:30:47
问题 I am working with Intellij Idea (CE) 2020.2.3 And using Gradle 6.7 I have the following situation: IntelliJ IDEA (2020.2): Gradle: The cache entry for initialization script (appears to be corrupted) Part of the solution is disable the Android plugin (I don't work with Android - so is fine for me). But until now each time I start the IDE - it automatically builds the spring-framework project based on Gradle - therefore it starts the daemon and tries to build. But I receive the following error

IntelliJ runnable jar doesn`t work on other computers

南笙酒味 提交于 2021-01-29 08:29:15
问题 In IntelliJ I created a simple program(Im a beginner) and Im trying to create a runnable JAR file so I can run the program on a different computer. But when I tried it on a different computer, It gave me this error, Im not sure if its something wrong on the computer or the runnable JAR:"A JNI error has occured. Please check your installation and try again". However It works perfectly if I run the program on my computer. I created runnable JAR using this guide: https://www.jetbrains.com/help

How can i solve the Array problem in Kotlin?

半腔热情 提交于 2021-01-29 07:53:50
问题 When I try to compile some basic array code I get errors. I tried to re-install IntelliJ and I made all updates. fun main(args: Array<String>) { val numbers = intArrayOf(1, 4, 42, -3) if (4 in numbers) { println("numbers array contains 4.") } } Here are the errors. Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/KotlinPackage at KtlneKt.main(ktlne.kt:2) at KtlneKt.main(ktlne.kt) Caused by: java.lang.ClassNotFoundException: kotlin.KotlinPackage at java.net.URLClassLoader

How to switch active IntelliJ Code Style for all existing local projects?

大兔子大兔子 提交于 2021-01-29 06:43:06
问题 I would like to standardize my java code style as per Google Java Style Guide. I downloaded intellij-java-google-style.xml, made a few custom tweaks and imported it in IntelliJ in the global IDE section: Preferences... >> Editor >> Code Style >> gear icon >> Import Scheme >> IntelliJ code style xml This applies the Code Style to the current project. However, existing IntelliJ projects keep their existing code style. I can see the new Google Style in the other projects' drop-down menus, but I

no suitable driver found error for JDBC DERBY

若如初见. 提交于 2021-01-29 05:34:58
问题 I have run this program over and over, and got no error. But when I packaged it up into an executable it wouldn't run. So I deleted my derbyDB file to run from scratch and get a better sense of the error from intellij. It is saying there is no suitable driver for the derby connection. I have checked the product structure, the jar is in the right place, and the DERBY_HOME variable is still correct. Does anyone have any ideas error message: "C:\Program Files\Java\jdk1.8.0_131\bin\java" -Dfile