Need help using IntelliJ and setting up a project SDK - java

When I try to run my program using IntelliJ it says I need a project SDK but when I try to set up a project SDK, it says "The Selected directory is not a valid home for this SDK"

This can happen when a java SDK is deleted, moved, or configured incorrectly.
Go into Project Structure (Ctrl+Alt+Shift+s)
On the left under Project Settings select Project
Now see the Project SDK: - it is likely red if cofigured incorrectly or it might say <No SDK>.
Firstly, just see if there is another SDK of appropriate java version in the drop down list you can use.
If not, you can use Edit button on an existing JDK to modify the JDK home path if it is wrong.
Or just press New... and JDK to set up a JDK that is already installed on your machine (e.g. C:\Program Files\Java\jdk1.8.0_72)
...if you have no JDK on your machine (be aware of the difference between a JRE and a JDK) then you'll obviously need to download and install that first

Related

How to create Java 8 project in IntelliJ IDEA 13.1?

I want to try IntelliJ IDEA 13.1, so I've installed the enterprise edition for evaluation. Also, I have installed JDK8u11 64 bit. I am using Windows 8.1.
When I try to create new project, I need to select JDK. I am able to choose JDK7, but JDK8 is not accepted with message "The selected directory is not a valid home for JDK".
Based on "The selected directory is not a valid home for JDK" Android Studio I've set JAVA_HOME to point to C:\Software\Java\jdk1.8.0 where JDK8u11 is installed, with no effect. I have also run IntelliJ IDEA in Administrator mode, without success.
I'm a bit stuck here. Am I missing something?
A copy of my answer in the comments so that #tptak can graciously give me credit for the correct answer. Thanks.
Make sure the dir you select has the bin, jre and lib directories. Could you have a double jdk1.8.0 dir name (or some such thing) from an error when setting the install dir during install?

Can't get Eclipse to run with Java FX

Alright so basically, I'm trying to run Eclipse with JavaFX, but then it gives me this error:
You are not running your eclipse instance with Java7 or Java8. The JavaFX tooling is disabled because of this.Make Java7/8 the default system java or adjust your eclipse.ini to pass -vm pointing to your Java7/8 install.
In case you want to turn off this check open your preferences and go to General > Startup and Shutdown and uncheck 'JavaFX Tooling Java Check'
Now I know it isn't pointing to the right SDK, but I have no idea how to change it, since I'm kind of new to this this stuff. I've already downloaded JDK 7.40 as well. I'm also using Ubuntu on a virtual machine, if that even matters anyway. Can anyone help me, I'd appreciate it.
Pre-requirements:
Install Java™ 8.
Install Kepler SR2 (4.3.2) .
The Kepler is still not supporting Java8. What to do?
Open Eclipse
Help > Install New Software…
Enter the following URL into the ‘Work with’ field:
http://download.eclipse.org/eclipse/updates/4.3-P-builds/
Press ‘Enter’
Select category ‘Eclipse Java 8 Support (for Kepler SR2)’
Click ‘Next’
Click ‘Next’
Accept Licence Agreement
Click ‘Finish’
Now jre8 is correctly located.
Now configure JavaFx
Open Eclipse
Help > Install New Software…
Enter the following URL into the ‘Work with’ field:
http://download.eclipse.org/efxclipse/updates-released/0.9.0/site
Press ‘Enter’
Select category ‘Eclipse Java 8 Support (for Kepler SR2)’
Click ‘Next’
Click ‘Next’
Accept Licence Agreement
Click ‘Finish’
It looks like the default java on your system is not java7. What do you get when opening a shell and execute java -version? Solution is to:
A) make java7 the default java
B) start eclipse with -vm
Apparently, you have installed 32bit Eclipse and 64bit JRE/JDK on a 64bit OS. Please use 64bit Eclipse and the problem will be solved. Please make sure JAVA_HOME And JRE_HOME is present in environment variables.
I had the same issue. I tried re-installing Eclipse, but it wouldn't work. I had to completely remove the project and delete all the project files. After that, I re-started eclipse and created the project again. However, this time I made sure the project path included the Java FX library as shown in the screen shot.
Java Build Path
I did this while I was creating the project and then I was able to create the project without any issues. Give this a try.

Setup eclipse java SE-1.7

I wanted to start learning java but Eclipse is giving me some trouble.
First of all I'm a beginner with Java with little to no knowledge about it. I want to use 'JavaSe-1.7'. I have no clear reason to use it besides using the latest version. After downloading Eclipse (Eclipse IDE for Java Developers) I created a new Java project and selected 'use an execution eviorment JRE : JavaSE-1.7'. This directly popped the notification saying 'The default compiler compliance level for the current workspace is 1.6. The new project will use a project specific compiler compliance level of 1.7.'. I finished creating the project and started following some tutorials.
However I noticed directly I have 2 errors which dont explain anything or have a source. I ignored it and started typing and tried to import 'java.io.console' however it said 'The import java.io cannot be resolved' and I have no idea what is the cause of it neither how to fix this.
Would like some instructions into the right direction.
Thanks in advance
Check your Eclipse preferences: Java -> Installed JREs. The one that you're using should be marked and it should be a JDK not just a JRE.
Also check your project's build path: Right click on the project -> Properties -> Java Build Path
Check in the "libraries" folder whether the JRE System Library is present and if not add it using "Add library"->"JRE System Library" and then select the correct one (from an installed JDK).
You may not have your JDK/JRE set up correctly.
Check the following:
Did you install a JDK or just the JSE? The JDK is needed to compile .java files to .class files. Without it, you can only run java programs, not develop them. If not, download and install it from Oracle website.
Check in Eclipse, if you have the JRE installed there as well. You just need to specify the path to the installation. You can reach this screen via the "Window->Prefrences" menu. see this screenshot:
The message you receive about project specific compiler compliance level is not a problem, it just means that your workspace is set up to comply to java 1.6 but your project will comply to java 1.7 standards. Also, Java 7 in general is no problem whatsoever.
Paths may differ, especially if you're not running a *nix OS. Just point the location to where you installed your JDK.

Unable to install Android SDK

I had a Windows XP. I also had JDK6. I downloaded "Android installer r11" for windows. When I click the installer, the error message is displayed as alert Java SE development kit is not found, Then the installation cannot happen.
But in my system I had a Java SE 6. I cannot find why it is not take the Java.
Try this step it may help you:
Installation sequence: JDK, Eclipse, ADT, Android SDK
1. JDK
First, head over to Oracle Web site to download and install the latest Java Development Kit.
Ensure that the environment variables look something like this:
CLASSPATH
C:\Program Files\Java\jdk1.6.0_10\lib;C:\Program Files\Java\jdk1.6.0_10\lib\tools.jar;
C:\Program Files\Java\jdk1.6.0_10\lib\dt.jar;
PATH:
C:\Program Files\Java\jdk1.6.0_10\bin;C:\Program Files\Java\jdk1.6.0_10\jre\bin;
At the command prompt type java-version to view the current system has been installed Java version.
2. Eclipse IDE
Next, from the Eclipse Web site Download the latest Java Eclipse Classic as our development environment, select here eclipse-jee-helios-SR1-win32 version, download the Eclipse is not good need to install, unzip to the right place to use.
3. ADT (Android Development Tools plugin, Android Development Kit)
ADT is an Eclipse plug-in, due to the use of the Eclipse version, the installation process referred to in the following menus and options may vary.
Then, start Eclipse, choose Help-> Install New Software ..., pop-up "Install" dialog box.
Click the Add ... button, pop-up "Add Site" dialog box:
Enter the Android update site here: Location: http://dl-ssl.google.com/android/eclipse// When you're finished, click "OK", back to "Install" dialog box.
In the "Install" dialog box, select just added the update site, waiting to find the appropriate version of Eclipse Select ... "Develpoer Tools" of all items, all the way to click "Next", accept the agreement, click "Install" start the installation.
After the installation is complete, restart Eclipse.
4. Android SDK
Next, from the Google website download the latest android-sdk. Extract the zip file to appropriate directory, remember the absolute path. Run the SDK Manager installation.
In Eclipse, select Windows -> Preference -> Android, enter the directory on the step down the path, click "OK".
The latest SDK, only tools, but no longer contains the platform or the Google add-on, we need to use the "Android SDK and AVD Manager" to install and update, such as platforms, tools, add-ons, and documentation of these SDK components.
%JAVA_HOME% should be in your path. Half of the time you can have an SDK and be missing that variable.
Get thee to a command line and type echo %JAVA_HOME%, or simply see if you get any output from javac -version. The exact variable for Java home is probably not quite right, but the second step should work. If javac fails you, you either never installed Java SDK (aka JDK) and instead got the SE, or you still haven't set the java binary folder into your path. Use your Windows search and look for javac.exe.
If nothing else works, go to java.sun.com and re-download and install a new SDK. The annoying part is that Glassfish and other things tend to complicate the java setup because they too must be set up during install or shortly thereafter.

Error in installing Android Eclipse

hi i have installed the Java eclipse in my system according to the instructions given in http://developer.android.com. After the installation when i was to develop my new project the build target space seems to be empty. One of my friend instructed me to go to windows->Preferences->Android and in the SDK location i have entered the dir where sdk is been loaded (ie in my pc D:\Program Files\android-sdk-windows), but then also no change pls help me to clear my issue...
Check if the location you've specified have the folder hierarchy as below?
Have you also clicked on the 'Apply' or 'Ok' button to reload the location after you're done specifying the location?
It Seems like you have installed SDK but Platform packages were not installed. Go to EClipse - > Window - > Android SDK and AVD Manager, check for Installed packages if that is empty go to available packages and install as per your wish

Categories

Resources