How to change project's java version in Intellij Idea? - intellij-idea

I reinstalled java on my laptop with different version, and after that, my project can't run well in Intellij Idea. So I want to know how to change project's java version in Intellij Idea?

Make sure that the compiler correctly chose the version:
You need to go to Settings > Compiler > Java Compiler and update the Target bytecode version
Easier: press Shift twice and type Java Compiler and will lead you to that.
Setup the project SDK
Go to Project Structure > Project > Project SDK and add the link to the local Java file

File | Project Structure
Add your new SDKS, and chose right sdk for your Project.

Related

Netbeans 11 how to add a library to a project when "Libraries" node is missing?

I am trying to run a simple java fx example with Maven on Netbeans 11 with openjdk 11. I followed the OpenJfx tutorial up to the creation of JavaFx as a global library.
But then when I want to add this global library to my project, the "libraries" node is missing in the project properties menu ?
How can I have this Libraries node present in the menu ? Or is there another way to add a global library to a project ?
Any help appreciated,
Indeed I was following the part of OpenJfx tutorial that creates an Ant project, whereas I was creating a Maven project.
If instead I use an Ant project, then the "libraries" node appears.
But the interesting part for Maven is further down. And there they write to create a Maven project from archetype.
Eventually it is working !

Intellij plugin Fortran

I have installed Intellij IDEA Version 2017.1.4 and installed the Fortran plugin. However, I don't see an option of starting a Fortran project even after restarting IntelliJ. I see the plugin has been successfully installed though.
Is there a simple hello-world fortran example with Intellij?
Thank you
No, you can't create a Fortran project in Intellij IDEA. You can use cmake to build you project and import such project in CLion. Here you can find some information about compiling Fortran project with CMake. Also several example projects can be easily found in the Internet.
General idea behind this is that IDE is not a build tool, so you are building your project with build tools and we are doing our best to support build tool that you're using. For now from all JetBrains IDEs only CLion supports build tool that is capable of compiling Fortran project (CMake). In the future CLion will support other build tools capable of doing this (make for example).
JetBrains just released a new Fortran plugin you may be interested in. I tried it in IntelliJ 15 and it did not allow me to create a new Fortran project. I have NOT tried it in CLion yet.

Java 8 doesn't compile on Intellij15

Recently our company moved to Java 8 (previously working with Java 7).
Everything was fine while I was using Eclipse, but now I switched to IntelliJ Idea 15 (it's my first time in IntelliJ Idea) and it simply won't compile any Java 8 code (lambdas, etc.)
I searched for a solution and found out that I have to set a project language level to 8 in IntelliJ project settings, but it still doesn't help.
Any ideas?
Make sure that you correctly selected the JDK.
In IntelliJ you should go to: File -> Project Structure... project settings tab, and make sure the project SDK points to the location of your java 8 JDK, (something like: C:\Program Files\java\jdk1.8.0_45)
And, of course, make sure the project language level is set to 8 - Lambdas, type annotations etc.

How to use script to build IntelliJ Idea project to a jar

i have created an IntelliJ Idea (Community Edition) java project. the project is quite simple. it only contains a main() method, but uses another 2 jars as dependencies. I also created an artifact to the project to build it to a jar.
My question is there any way to build the jar using script? because I want to add the build process to an existing build script.
thanks
IDEA doesn't do anything with the code on its own, it just counts on the default tools provided by SDK. In short, you will need javac and jar for packaging.

Why does IntelliJ import extra libraries from JDK 1.6 for a simple hello world program?

I'm new to Java and IntelliJ and I am just doing a simple "hello world" program. IntelliJ has about 10+ libraries from JDK 1.6 added to my project even though I'm not importing anything in my classes that would seem to need them. I created a new project from scratch.
Some of the libraries are alt-rt.jar, charsets.jar, deploy.jar, dnsns.jar, javaws.jar, jce.jar, jsse.jar, localedata.jar, etc.
Can anyone explain why those libraries were added? Can I remove those libraries from the Module Settings/SDK with no ill effect?
They will be in the classpath anyways as they are part of the standard library. I'm not sure what will happen if you remove them, but you definitely don't need to do that.
These libraries aren't imported in your project, intelliJ has just parsed these jar to see what were the accessibles classes (for auto-completion) with the default classpath.
They won't be packaged with your project.
Plus as your JDK (or any SDK for what it worth) is defined for intelliJ and not for your project only, every project you will create in the future will use the already parsed data from your JDK.