Why doesn't Eclipse need me to configure a JDK? - eclipse

I recently downloaded Eclipse onto a Windows 7 machine. The machine already had a JRE but I noticed it didn't have a JDK. I was afraid I would have to download the JDK and then hook Eclipse up to it. I was (pleasanly) surprised when I was able to code, compile and run in Eclipse right out of the box. However, now I'm confused. From what I know about Java, Eclipse should need a JDK to compile code and a JRE to execute it.
The best I can think of is...
Eclipse is packaged with a JDK (if this is true, I can't find the JDK on my computer)
I'm way out in left field and don't understand JDKs as well as I thought I did.
Admittedly more of a curiosity question, why am I able to compile java without a JDK?

Eclipse has an internal compiler for some time now. Several years ago it needed a JDK but for now a JRE will suffice.
However if you want to browse or debug in the Java source code, a JDK is better.

Related

Eclipse 4.3 Kepler missing JRE system library

I am extremely new to java (about one week of experience at the moment). I have made a fair amount of simple programs in an older version of eclipse Juno on a PC. I copied all of the files onto a flash drive and put them into the workspace of eclipse kepler on my mac laptop. Now every single line of code is unrecognized and the JRE system library folder is gone from all of the projects. I am not sure how to fix this and I would love if someone will help my noob self at this. Thanks!
You have to configure the jre from your mac in eclipse. You find it under window preferences and search for jre.
After that, in your eclipse project you can use the new configured jre (project properties - Java Build Path)
Hope this helps.

How to execute eclipse under java VisualVM

I developed couple of plugins specific for my project and I think I have some leackage because my eclipse slow down after long using time, so I want to profile it. I can run eclipse from eclipse (in plugins development mode) and connect it to JVVM, but problem (slow eclipse) occurs after long time of "normal" development, so I want to start my "normal" eclipse and connect to VisualVM.
Problem is that eclipse appears in VisualVM as and I can't profile it in any way (I see only number of classes loaded, heap and threads).
My JAVA_HOME is set to JDK, I put the same JDK to eclipse.ini under -vm parameter and from the same JDK I am starting VisualVM.
Does someone know what should I do?
Are you using Windows? It looks like VisualVM is running under 32bit JDK, while Eclipse is running on 64bit JDK (or vice versa). Check 'Overview' tab when you open Eclipse and VisualVM in VisualVM. This will tell you, which JDK is used.

How to specify which JRE to use in Netbeans?

I have two JRE in my system. One is 32-bit and the other one 64-bit. In Eclipse I can configure both and choose which one to use when running my application.
I'm wondering if I can do the same thing in Netbeans. I've tried to go to Project Properties, Libraries and then tried to configure a new JRE there, through Manage Platforms, but it doesn't accept the directory of my JRE. How should I proceed?
Be aware that I'm talking about JRE, and not JDK ;)
EDIT: I managed to make it work by downloading a new 32-bit JDK and selecting its directory. I still couldn't make it accept a JRE directory.
Whether or not you can run Netbeans with just the JRE depends on what bundle you have downloaded. In Netbeans 7 only C/C++ and PHP bundles can be run with the JRE.
Older versions of Netbeans include more languages under this JRE umbrella, but the principle is the same.
The JDK contains the JRE plus tools to debug and compile code, so if you're doing anything Java based apart from just running the IDE, netbeans depends on the JDK.

How do i find out the JDK version Eclipse is using?

I see JRE all over the place, but i can not be sure which JDK is compiling my code. How do i find out?
You can still check/set which JDK version you want to compile to. If you go to Window->Preferences, then click "Java" from the menu on the left and then "Compiler". The first setting allows you to see which JDK version is being complied with.
I know this doesn't directly answer your question since JDK isn't actually compiling it, but hopefully it helps!
Actually Eclipse has its own compiler. You can develop java apps using only the JRE and Eclipse
You don't find JDK explicitly mentioned anywhere because way to point to a JDK is under the name of 'Installed JRE'. That is Window > Preferences > Java > Installed JREs. This is useful when using m2e plugin.
secondly apart from having it's own built in compiler, it is recommended to you install one of your own to support development of Java programs. Except below from eclipse wiki page :
If you intend to use Eclipse for Java development, then you should install a JDK

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?