I have just installed Eclipse Indigo, and created a new project. It's telling me that the build path is not configured.
I have followed RighClick on the project -> Build Path -> Configure Build Path -> Libraries and there I found JRE System Library [jre1.8.0_31] and I don't understand why it doesn't recognize it.
Any help?
First of all you have to know some stuffs about JAVA. Java uses a JVM (Java virtual machine) wich is the JDK and need to be installed on your computer.
The JDK makes the JVM run and the JRE allow you to compile etc java class. (No need for both, just install the JRE)
see this page.
Then you'll have to configure a window GLOBAL VARIABLE. The JAVA_HOME var.
"1-Right click My Computer and select Properties.
2-On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located".
This way Eclipse will be able to find the installed JRE.
Finally, in eclipse, check that it know the JRE.
And that's it. There is a lot of info over the web about this for more details.
Related
I have installed the JDK jdk-8u144-windows-x64.exe in my computer in order to set up the tool IntelliJ to play with Scala, well before move forward to IntelliJ installation I ensured the JDK in my computer:
running path:
the running a java version:
Then, I installed the IntelliJ and the Scala plugins, so when finally I'M going to create my first project my laptop configuration is not mapping the JDK:
I tried to add the required environment just clicking on new and go thru the path where I installed the jdk but it doesn't go thru either.
Please, guys, I'm a bit nooby with Scala and IntelliJ, could you please guide me a bit. I tried to follow the instructions in this link but it is not going thru. https://www.scala-lang.org/documentation/getting-started-intellij-track/getting-started-with-scala-in-intellij.html
thanks
Make sure you have set environment variable JAVA_HOME to your java directory, IntelliJ detects JDK using that environment variable, or you can browse the path of java installation directory using "New" button beside jdk and select it.
I installed java(jdk and jre) along with eclipse.
I was having trouble with launching eclipse(was throwing jvm not found kind of error) and hence on googling found that I need to place the javaw.exe file inside the eclipse folder or update the vm location in .ini file to the bin folder of the jre.
Eclipse then started working fine.
However just to understand things in deep, I tried to remove the -vm location and also the javaw.exe file from eclipse folder.
Still I find that the java program in eclipse is running successfully. I was hoping for eclipse to throw the jvm not found type of error.
I am fairly new to java/eclipse but my understanding is that only jre is needed for running an existing java program.
Also I remember running java programs from command prompt where setting of environment variables were required. But while working on eclipse so such thing has been done. Is setting of environment variable not needed with eclipse?
Eclipse doesn't use environment variables to decide which JRE to use.
The JRE/JDKs that Eclipse can use to run a Java program are listed in the Preferences in the 'Java > Installed JREs' page.
You choose which JRE to use from the installed JREs list when you create each Java project. You can change the choice in the Properties for the Project on the 'Java Build Path' page.
How can I find out where the JDK which Eclipse is using to compile resides? It's possible to find the location(s) of JREs in Window, Preferences, Java. Even the compiler level (1.7) is there.
I can also find out which version of Java is installed using "where java", but "where javac" does not yield a result.
Since .java files can be compiled, some Java compiler (so a JDK) must be present. It's very tedious to search all directories and hasn't shown a usable result yet.
Somewhere in Eclipse's settings the path to the JDK must be saved. As far as I know, JAVA_HOME environment variable isn't used.
So how can I find out where the used JDK is? I actually need to find the programs xjc and schemagen, but the search of the total disk couldn't find it. I find this contradictory.
Help menu -> About -> Installation details button -> Configuration tab
Here you can find all system properties and Eclipse arguments including:
-vm
C:/Program Files (x86)/Java/jdk1.7.0_55/bin/javaw.exe
This is the Java VM on which Eclipse runs.
Eclipse has its internal compiler. It does not use javac to compile Java sources, Eclipse doesn't even require JDK just a JRE (and is still able to compile Java sources).
window -> preferences -> java -> installed JREs -> if there are more jre then select the right one and check the location for JDK or JRE installation directory
I have 3 versions of Java installed on my system: 6, 7, and 8... I am required to have JRE6 available for a product my company develops, so I cannot get rid of it... But despite copying my Eclipse install to a new folder for another project I need to work on and removing JRE6 from this version alltogether, I still cannot get it to work.
How can I get the google plugin for Eclipse to work in my scenario?
If you have created a shortcut to start eclipse, you can add a parameter to tell it to use the jre of your choice like this -
C:\eclipse\eclipse.exe -vm "C:\Programs\jdk\jdk1.7.0_55\bin\javaw.exe"
I have used "javaw" executable from a jdk installation, but you may point to the same executable within a JRE installation as well.
This will resolve the error.
Keep in mind that there is a separation between the JVM that Eclipse itself is running in and the various JREs that you can configure in Eclipse to run your programs/applications. You need to specify to Eclipse what JVM you want it to run under, using eclipse.ini.
That's separate from the Installed JREs configuration you show in your screen shot above.
Add Java 7.0 to Eclipse if you haven't: Window -> Preferences -> Java -> Installed JREs.
Next add Java 7.0 library to your project: Right click on project -> Properties -> Java Build Path -> Libraries tab -> Remove JRE 1.6 and add New Library (JRE System Library, 1.7.0).
Last set Java 7.0 compliance level: Right click on project -> Preferences -> Java Compiler -> Compiler compliance level: 1.7
Also since you can use different Java to run applications, you also have to change this in the Run configuration which you use to start AppEngine related tasks.
I downloaded 'Eclipse IDE for Java EE Developers' for Linux from eclipse.org. I am able to write, compile and run Java programs. But I don't understand what JDK / JRE is being used.
If I start a new 'Java Project' I can choose which JRE to use, but if I choose for instance 'JavaSE-1.6' I still don't know what that is? Oracle? IBM? And I don't know where that JRE is in my file system.
Let's say I want to use that same JRE to execute my Java program from command line, how do I find the 'java' executable?
While you are in Eclipse:
Open Help -> About Eclipse
click on Installation Details
select the Tab Configuration
search for the entry
eclipse.vm=
there should be the path to the used JRE.
If you want to know where is Java located in you'r system, run it in terminal whereis java.
If you want to know which Java is using in you'r system, run it in terminal which java.
If you want to know what is Java version is using in default, run it in terminal java --version
If you want to know which JDK is using in Eclipse,Refer to Project->Properties->Java Compiler.
If you want to know which JRE is using in Eclipse,Refer to windows->preferences->Installed JREs
It is up to your configuration.
Go to Windows/Preferences, then check:
Java/Installed JREs and Java/Compiler/
You can also override your settings per project: project preferences, Java Compiler.
(this is too long for a comment)
Let say I want to use that same JRE to execute my Java program from
command line, how do I find the 'java' executable?
On Linux the java executable is the first executable named "java" found on your path.
For example:
... $ echo $PATH
/home/f/jdk1.6.0_33/bin:/usr/local/bin:/usr/bin:/bin
... $ which java
/home/f/jdk1.6.0_33/bin/java
You can install as many JRE/JDK as you want. You can even trivially create user accounts with Java (e.g. a user account for development) and users account without Java (e.g. a user account without Java that you'd use only for browsing the Web [see comment]).
If you try to launch Eclipse when the $PATH doesn't contain any Java executable and if you didn't install any JRE/JDK inside ~/eclipse/, then Eclipse shall complain and refuse to launch:
"A JRE or JDK must installed in order to launch Eclipse"
At that point and if you did install Java, you can simply add it to the $PATH and Eclipse shall launch:
... $ export PATH=~/jdk1.6.0_33/bin:$PATH
Eclipse gives you an option to select the JDK on per project basis as well as for All projects.
For All projects :
Windows ---> Preferences ---> Java Compiler ---> Compiler compliance level ---> Select the JDK you wish to work with.
For Specific projects :
Project ---> Properties ---> Java Compiler ---> Compiler compliance level ---> Select the JDK you wish to work with.
The settings for the specific project is given priority over the All project settings...