IntelliJ, Maven and Java 7 - java

So I opened an existing project in IntelliJ 10.5 as a maven project. I had first added the JDK 7 to my list of SDKs in order to try out the features. However for some reason my mvn commands would fail, so I switched the maven runner back to 1.6. But I'm getting a weird error where some maven commands are still being run with Java 7.
In the Maven Projects view when I right click on a lifecycle in the module and select Run Maven Build everything works correctly, however when I select Run " clean" it still uses the 1.7 JDK. I have removed the JDK 7 from my list and now I get an error saying it can't find JRE '1.7'.
I honestly have no idea how to fix this, but if anyone has any suggestions that would be great.

In the Maven Projects panel press the Settings button (or open Settings | Maven | Runner).
Make sure that JRE is set to the existing JRE configuration (1.6).

Related

How can I switch java verisons in intelliJ?

I'm using the linux beta installation on my chrome-book, and I'm trying to set up a project to use the jdk version 1.8. I previously had a project set up that uses jdk 1.11, and now it seems that even though the current project is configured to use jdk 1.8 in project settings etc, the maven installation used by intellij is still configured to use jdk 1.11. When I run java -version and mvn -verison in the intelliJ terminal, java 11 turns up. I tried changing the maven settings as well, but whenever I try to mvn compile and install, I get the following error:
/usr/lib/jvm/jdk1.8.0_271/bin/java: 1: /usr/lib/jvm/jdk1.8.0_271/bin/java: Syntax error: "(" unexpected
I can't figure out why this is happening, but it must be the fact that maven thinks this is java 11, when it's java 8. Does anyone know how to fix this?
CTRL-ALT-SHIFT-S / Project / Project SDK - you can choose existing or add configure another one
It turns out I had downloaded jdk-8u271-linux-arm64.tar.gz instead of jdk-8u271-linux-x64.tar.gz, which is why the code wasn't recognized after installing the jdk. Apparently the two are designed for different CPU architectures, and arm is for mobile devices, and wasn't compatible with my chromebook.

Conflict in Eclipse Mars with Maven and SVN?

I've been using Eclipse for programming and testing Storm just fine, however, I created an SVN account, where I commit the project, and for that, I needed the SVN plugin for Eclipse. It worked, but after that, i get this message on a popup error window when I try to launch:
Referenced classpath provider does not exist:
org.eclipse.m2e.launchconfig.classpathProvider
I realised that in the "configure" menu, the option "convert to maven project" (right click on project) disappeared. The "runAs" options for the java topology doesn't run with this error, and the "pom.xml" cannot be run as maven.
Possible fix tried:
I tried to reinstall all maven builders to Eclipse(it doesn't let me to unninstall).
I tried to rebuild config by:
mvn eclipse:clean eclipse:eclipse
None of this worked, my Eclipse version is:
Eclipse Java EE IDE for Web Developers.
Version: Mars.1 Release (4.5.1)
Build id: 20150924-1200Eclipse Java EE IDE for Web Developers.
On Ubuntu Gnome 14.04.
As I said, it was running perfect until I installed SVN plugin.
EDIT
I realised that I have installed two plugins of m2e:
Maven integration for Eclipse (Luna and newer)1.5
Maven integration for Eclipse (Luna)1.5.0
Both in marketplace, but I have no way to uninstall them, it says:
[plugin] cannot be fully uninstalled because other installed software requires it. The parts that are not required will be uninstalled.
EDIT 2
In the "Installation History" within the "Help>Installation details" menu, I saw that "Maven integration for Eclipse (Luna)1.5.0" was installed by (or with) SVN plugin, so I think the problem is there, nevertheless, I can't uninstall it as I said in my first "EDIT".
If anyone has a clue about what is happening, please, help me.
Thanks in advance!
We use Subclipse in Eclipse (Kepler and Mars) without problems (Did you install Subclipse or Subversive?).
To check out projects as Maven projects, you should install a m2e connector. Subversive has one in the "Discovery" catalog while for Subclipse there is a separate update site.
If your eclipse plugin configuration is somehow broken, I would start again with a virgin eclipse (Mars.1, Mars.2 or Neon) which already contains m2e in version 1.6 or 1.7. Then you can install Subclipse or Subversive and try again.
Workaround proposal: simply don't deal with SVN within eclipse!
Instead, you can use "git svn" on ubuntu.
Meaning: with git svn you can create a local git repository, that allows you to commit/fetch to a remote SVN server. But to your eclipse ... that repository looks a common of garden GIT repository.
In other words: using that tool, you can still connect to SVN (although I don't understand why anybody would want to do that in 2016); but you have all the features of git available to you as well (including full support within eclipse; without installing any additional plugins).

IntelliJ IDEA 16 can't resolve JDK1.8

I have IntelliJ IDEA CE.
I did some practice coding (had some project in maven) and I was developing it in IDEA 15 CE. Then update came and I cannot build project again, because of error:
JComboBox usage generified after JDK 1.6 API which would couse compilation problem with JDK 5.0. (in maven is target JDK 1.8, in IDEA preferences is JDK1.8 and in project preferences is JDK 1.8. I Tried import settings from IDEA 15 (where it still works fine) with no difference, also I tried clean install IDEA... with no results.
Any help pls?
Finally I find out...
File -> Project Structure -> Module...
And for every module I had to set version 8...(there was version 5 I don't know why...)
You should be able to change it in File>Project Structure>Project>Project SDK and then either pick JDK 1.8 in the drop-down menu, or click 'new' and navigate to the JDK folder.

Intellij build after gradle refresh fails on wrong java version

I am using Gradle with intellij.
I refresh Gradle and then I rebuild my project.
I get the following
Notice the first line - Using:javac 1.8.0_65
But I get the error that I should use -source7 or higher.
I also set the following at the settings
(With all of the inner modules are set to project sdk (1.8))
But I still can't rebuild or compile without this error.
Any suggestions?
(obviously i deleted all my classes and jars and then Gradle refreshed and rebuild project)
Same issue; got it solved with the following:
Go to: File / Settings / Build,Execution,Deployment / Build Tools /
Gradle / Gradle JVM
Then choose: Use JAVA_HOME
As of your second screen, make sure that all your modules are using the project default SDK, like in the screen below. The module setting may somehow be set to point older java version.
I had this problem while trying to build Android Studio. I kept getting
Tools need to be compiled with Java 1.8, you are using Java 11
Everything in the Intellij global and "Project Structure" settings was set to Java 1.8 so I couldn't figure out what was going on. For whatever reason, what ended up working was going to Build, Execution, Deployment > Build > Gradle and selecting the Amazon corretto version of Java 1.8 as installed by sdkman. This is baffling since I'd already tried selecting two other options for Gradle JVM that said 1.8 and both of those still resulted in the same error message as a result of Java 11 being used.
I finally resolved this issue for myself. I'm on Windows and it turns out the order in which the JDKs are listed in the Windows environment variable matter, and overrode what IDEA had set.
Although my project has JDK11 listed everywhere, JDK17 was still being used. I was able to finally resolve this issue by moving their ordering to list JDK11 first.
before I swapped the env var order
after (hurray!)

Can't locate JDK x64 in intellijIDEA

I am starting a new project, and the client requires us to work in IntelliJIdea. I installed it and tried to do the ant build. It turns our I need 64 bit jdk for the build. So I installed it. Now, however I need to configure it in IntelliJIdea. Here is the message I get:
JDK (1.6_x64) needed to run this ANT target is not configured. Please
update your settings in the Project | Libraries menu.
Can somebody help me locate this Project | Libraries menu menu please?
Press ctrl+alt+shift+s, and on the left hand side you'll see Project Settings -> Libraries.
Q: Where do I configure project JDK?
A: In the Project Settings dialog.
To add a JDK to project, press Ctrl+Alt+Shift+S, under Platform
Settings click JDKs and specify JDK path. After that, you can click
Project and specify which of JDK you have configured is used in the
current projects. Remember that JDKs are configured at IDE level, so
when you create another project, you won't need to add the same JDK
again.
reference :
http://www.jetbrains.com/idea/documentation/migration_faq.html

Categories