Error running: Project has no JDK configured in IntelliJ IDEA Ultimate - java

When I try to execute program ergo, it gives me an error.
Error running: Project has no JDK configured
Can anybody help me? I'm newbie in IntelliJ IDEA.

1) Open Project Structure present under File menu or use shortcut ctrl+alt+shift+S
2) SDKs is located under Platform Settings. Select it and click the green + up the top of the window.
3) Set JDK home directory path (e.g.: /usr/lib/jvm/java-1.8.0-openjdk-amd64) and click on Apply and OK.
You should be able to execute your program now.

First, close IDE and follow this step:
1. You can delete these folders in the project structure:
.gradle
.idea
build
2. Then open IDE and reimport the project.
Hopefully resolved !!

open File -> Project Structure, under project SDK, where it says no JDK select dropdown and check if they are any JDKs available, select available JDK then click Apply then OK, your project should run now.

Related

IntelliJ : Cannot resolve method 'run(java.lang.Class, String[])'

I've encountered a problem where on all of my applications, there's a red cross on the top right. I can run it, but the cross doesn't seem to go away.
I've opened the run/debug configurations and it says Warning : Main method not found. I don't understand why it's not found when I already have a corresponding main class and method for each and every application.
I tried to close the project, restarting IntelliJ, restarting my laptop, refreshing my desktop, refresh Gradle by clicking Reimport All Gradle Projects, rebuild the project and clicking Invalidate Caches / Restart. I also tried other suggestions I found on StackOverflow such as deleting the .idea folder. Nothing. The red cross still shows up. I've also realized that I do not have the out folder in all of my Applications.
I just set the language level to equal my SDK version at Project Structure. Finally, it is disappeared.
In Project Settings, First make sure SDK path is correct. Preferably install and use your own SDK. Then use the same SDK in Project and Modules in Project Settings.
File->Project structure ->SDKs
Choose JDK home path, if no jdk is in the path,
you'll see an icon download jdk
download then ok
Try to copy src and gradle folders and buil.gradle and settings,gradle files in separate folder. Then open this new folder as new project in intellij. Then intellij will propose Import as gradle project... - push it.
If problem remained see you build.gradle

Eclipse editor not showing error markers

My eclipse is not showing error in its file editor. I have tried cleaning and putting project on Build Automatically. However when I run it then I do see the compiler error in console and also in problem view just after saving the file. Does anyone have any idea how to fix this ?
This is the version of my eclipse:
Eclipse IDE for Java Developers Version: Neon.2 Release (4.6.2)
Adding more images:
Check the Build Path of the project by right clicking the project and select Build Path -> Configure Build Path.
JDK is not properly configure for project. Configure your JDK instead of in-build JRE.
Also make sure your source folder is also configure in Build Path (for example MyProject/src) must listed as a Source folder.
In Java Compiler-->Errors/warning, click Restore Default.
Make sure "Build Automatically" is checked.

Compilation Error not displaying in Eclipse

I am using Mac Yosemite and Eclipse Luna.
I have successfully imported Maven projects into my workspace and the projects were running without any errors. The issue is Eclipse is not showing compilation error in editor or in project explorer.
Default Builders is "Maven Project Builder".
Right click a project in the project explorer and choose Maven > Update project, or press
Alt + F5. Select all the relevant projects and Ok. This automatically cleans and updates the workspace.
Right click on your project and go to Properties.
Goto Java Build Path and then select Source tab.
In this Tab there should be an entry with yourProjectName/src .
Expand this and in the Excluded-property, remove everything, i.e., it should
not exclude anything.
Remove any other entries in Source tab only yourProjectName/src should reside.
After this you may see errors in your project in package explorer.
Expand src folder and remove the package that is showing the error.
It helped me this way.

java - Eclipse gives me an error when i create a new project

I am using Eclipse IDE Galileo, on windows 8.1
When I want to create a new project, I go to file> new> java project.
I name my project then click on finish.
I then open the src file under my project and right click it. new> class. And I name my class
But before i even write any program, I have these errors. So can anybody please help me? Thanks in advance.
Here's the errors:
NOTE: My friend have the same problem, but she is using windows xp.
Dear #rebecca richa This problem will occur if your project have not JDK libraries. To add JDK libraries follow the following steps
right click on project --> Properties --> java build path --> select Libraries tab --> now click on Add Library --> select JRE System Library --> select Workspace Default JRE
your problem will be solved. other wise click on alternate JRE and select the path of jdk in your system where you have installed. now your problem will definitely solved.
for further help follow the image below
Seems like eclipse couldn't find Java Classes for your project.
Do This...
Right Click your project
Hover on Build Path
Select Configure Build Path...
Select Libraries Tab in the newly opened window
Click Add Library
Select JRE System Library from the newly opened popup
Close the Window using OK
This should remove the errors

java eclipse red exclamation mark

I have just got a new computer and installed Eclipse Indigo and all of the plugins that I use. But when I open my workspace from my old computer some projects have an exclamation mark.
What does a red exclamation mark mean on a project folder?
The red exclamation mark usually means there is a problem with the Build Path.
Do you see any alerts in the "Problem" View?
It means that there is an error on that project..
You can look at all the errors in the Problems tab. press ALT SHIFT Q followed by X to
show this tab.
It means that there are two things happened.........
What ever jar file or project setup jar file for your application
are not located at that point where it was earlier in your computer.
So that First you have to setup your project with all the jar files
and refresh it.
Check syntax in your project might be some mistake in that.
The red exclamation mark in eclipse is because of the problem/issue with the build path.
To find the specific issue look at the problems tab of the eclipse.
Window -> Show View -> Problems (or) Alt+Shift+Q,X
If you didn't find any error on the project files, usually it means your build path has some issue. First Check your jar file and jar file locations.
On eclispe, right click on your project, Go to build path and go to Configure build path. Check any errors under libraries. Configure it correctly and refresh the project.
It appears mostly because of "build path" only. But just in case you are working on a MAVEN project, here is the solution.
Solution
Step 1. Expand your project in Eclipse > Right click on "JRE System Library" > "Build Path" > "Remove From Build path"
Step 2. Expand your project in Eclipse > Right click on "Maven Dependencies" > "Build Path" > "Remove From Build path"
Step 3. Reach out to your local repository and follow below path "C:\Users\userName\.m2\repository" and delete everything inside repository folder
Step 4. Refresh your project in Eclipse
Step 5. Right Click on your project > "Maven" > "Update Project"
Step 6. Just refresh your project and now we are Ready to GO..
In my case show hidden files was enabled and i had added hidden jar file extensions along with the original jars. Adding only the jar files except the hidden files solved the problem
It can appear when any other file other than .jar is added in the jar library. To fix this, remove the file and clean the project.
If it is maven project and your project view having no error. Then try the following steps
Right click the project ---> maven --> update maven
It works for me.
What the error means is that the Java (JDK) version installed needs an update, as the older version could not be read. To rectify the issue, uninstall your Java (JDK) and install the latest version. Restart eclipse and the would be seen resolved.
This may help in case your build path is correct and you have put the right signature and access specifier for main, so maybe used as a hook to try before you make any modifications to your build path.
Just go to your problems bar and delete the problem given for the project, clean the project and build it. It should solve the problem, if these steps cause the red exclamation to go away.

Categories