My Eclipse can compile but I can't find a JDK! - eclipse

I've installed Eclipse on a Windows machine some time ago. A couple of days back I was doing some Java coding and I noticed I don't have a JDK, but still Eclipse could compile & run the Java classes. Does it have a compiler included?

Yes Eclipse contains it's own incremental compiler.
An incremental Java compiler.
Implemented as an Eclipse builder, it
is based on technology evolved from
VisualAge for Java compiler. In
particular, it allows to run and debug
code which still contains unresolved
errors.
For some history take a look here:
http://onjava.com/pub/a/onjava/2006/06/28/whats-new-in-eclipse-3-2-java-development-tools.html

Yes. And here's some more characters.

Related

What is the purpose of Java JDK to Eclipse?

I've just installed Eclipse, after i installed the java JDK.
The Getting Started guide (in Eclipse) says i should reference my JDK installation in Window>Preferences>Java>Installed JREs, but that a JRE would also work.
Select the Java > Installed JREs preference page to display the installed Java Runtime Environments. Confirm that a JRE has been detected. By default, the JRE used to run the workbench will be used to build and run Java programs. It should appear with a checkmark in the list of installed JREs. We recommend that you use a Java SDK instead of a JRE. An SDK is designed for development and contains the source code for the Java library, easing debugging.
There was already a JRE set up there (not a JDK), so i did nothing and tried to compile a Hello World (just to see what would happen). To my surprise, it compiled!
I searched a little bit and it looks like this works because Eclipse has a built-in Java Compiler. I tried debugging using the same eclipse set up, and it was also successful.
So, what is the difference between setting a JDK and JRE there? Why is it important to download the JDK, since in my default configuration Eclipse doesn't seem to use it?
Probably the main difference is you get the source to all of the Java runtime libraries (with the JDK) which can be a big help. I always use the JDKs for that reason.
Also if you are debugging, this will allow you to meaningfully step into Java runtime libraries.
There are a number of tools that come with the JDK that don't come with the JRE - JConsole (http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html) springs to mind. This for example can help you understand & monitor the memory usage of your application and so on. Either way if you head into unfamiliar territory, I highly recommend you follow the Eclipse suggestion and use the JDK!
JDK is equipped with different helpful tools, as DotMasta mentioned. Eclipse's "version" of JDK is called JDT. Apart from range of shipped tools, there are also differences between javac and Eclipse built-in compiler ecj, so check here to see the comparison. One of the most important differences is that javac is strict, i.e. with ecj you can create a class file even in case of errors in code, which is perfectly suitable for testing phase, but not for launch :)
JDK contains software development tools which are used to compile and run the Java program.
Plenty of classes and methods in standard jdk library
Javac java compiler
Diffrences and why you will need this?
JDK includes the JVM, standard class libraries, and several other tools that a developer needs in order to create a Java program.
JRE includes the JVM, as the JRE provides some standard libraries and the JVM which can be used to execute a Java program.
You can even look there: http://en.wikipedia.org/wiki/Java_Development_Kit

Eclipse running in JRE but a JDK is required

I always get the above mentioned error when i restart eclipse.I have gone through other posts in stackoverflow and understood how to resolve the problem( i.e by changing configurations in windows>prefernces and editing eclipse.ini file).
But the basic question is what is the meaning of that error?Someone please explain and also provide link to resource on how eclipse works internally with those preferences set.
Thanks in advance..
The JRE runs Java applications. The JDK can also compile Java source code, which is what your Eclipse is trying to do.
Basically Apache Maven requires a Java compiler (javac) which is not part of a Java runtime environment. (JRE) So it asks to use Java Development Kit (JDK) instead because JDKs are including a Java compiler. Nearest explanation for this can be found in below link.
http://wiki.eclipse.org/M2E_FAQ for question "Unable to locate the Javac Compiler Error". How to force Apache Maven to use the Eclipse Java Development Tools (JDT) as its default compiler can be found here.

Scala Eclipse IDE - strange behavior

I am giving a try to Scala Eclipse IDE after a very long time. I installed Eclipse and the said Scala plugin only a while ago, but I am unable to get stuff working. In all of the Scala files, I get the errors like following (See the tooltip):
This project uses Gradle for building, and I also have the latest version of Groovy plugin installed. Please help me get this thing working. Thanks.
Edit:
Thank you, everyone. The problem was solved. It appears there was a problem with my Scala plugin installation. A complete reinstall of everything (including Eclipse) helped. Also, this time I did not install the Groovy plugin.
I don't know which version of Eclipse / Scala-IDE you're using, but there are two reasons I know this sometimes happens:
1) You don't have JDT weaving for Scala installed.
The scala-ide uses aspects to weave in code into the JDT compiler. If you don't have this installed, this may cause the Scala files to be seen as Java files.
2) If, somehow, the Java Source File content type includes *.scala. In fact, it should be Scala Source File. If this is the case, you should remove the *.scala from the Java Source File content type.

Does XText require minimum versions of Eclipse or Java

While I can just try and run it and see if it fails I may not know if some internals will fail at inopportune times does anyone know if specific versions of java or eclipse are needed?
I'm sure, no special version of Java nor Eclipse is needed. It needs Java 1.5 and some Eclipse Modeling components (such as EMF); but they are already installed with Xtext.

How can MyEclipse compile Java classes without having a javac?

On my system, I have installed a Sun JRE (not JDK) and MyEclipse IDE.
I have searched for javac.exe in the installed files of MyEclipse in Program Files (windows platform), but there I got no results found for javac.exe.
Which tool is MyEclipse using to compile .java files?
Eclipse includes its very own Java compiler, written by the project from scratch. It doesn't always quite agree with Oracle's compiler in some edge cases. They did this to get speedy incremental compilation. You can even use it from ant in place of the javac if you want to roll that way.
#1: normally you need JDK. JDK mean Java Development Kit which includes the java-compiler javac
#2: Don't get what you really want to ask with the second question?