0

I know this question must've been asked alot of times already, but I've got some specific questions that need answering to.

The underlying question I am trying to ask here is What's the difference between JRE/JDK/IDE.

I understand that JRE has the run time libraries, JDK contains the compiler/debugger and everything else that JRE has. IDE is my Eclipse.

Question 1 : If I am trying to develop something in Java, is it necessary that I need JDK for it? Because as I understand, I can make do with IDE + JRE. My IDE provides me with compiler/debugger, and I will refer the JRE from my IDE. So, it should be alright right?

Question 2 : From the above question, is it safe to say that IDE contains JDK in it already?

Question 3 : When exactly will I need just the JRE and nothing else? i.e. under what circumstances will only having JRE suffice. If I were to emulate such behaviour, what are the necessary steps required. (I can make it more clear if you have not understood it. )

Thanks

Kraken
  • 23,393
  • 37
  • 102
  • 162
  • Please note that this are multiple questions. Normally only one question should be asked. – Uwe Plonus Sep 18 '14 at 08:36
  • Eclipse is bundled with its own compiler (Eclipse compiler) different from standard javac. So if your IDE is Eclipse, then its ok (with nuances) to develop only using JRE and Eclipse. JRE required only for running your java app. – Alex Sep 18 '14 at 08:42
  • 1
    @UwePlonus The way it's been asked is much more coherent than if it had been submitted as three separate questions. Lots of questions on SO have multiple sub-questions in, and no one complains; the only difference here is that OP has had the good sense to give them three separate headings to clarify things. – chiastic-security Sep 18 '14 at 08:50

5 Answers5

2

Question 1: Yes. The IDE will use the compiler from the JDK in order to compile your program. You can't develop Java programs without the JDK. (Of course, it's possible for an IDE to include a JDK as part of what it provides, so in that sense you could have an IDE without installing a separate JDK, but you'll have to have a JDK from somewhere.)

Question 2: It might do, or it might rely on an external JDK.

Question 3: If all you want to do is run an already compiled Java program, then a JRE is all you need. So if you were developing software for someone else, you'd have JDK and IDE installed on your machine for development purposes, but you'd only need to install the JRE on the client machine for them to be able to run it.

chiastic-security
  • 20,430
  • 4
  • 39
  • 67
1

Question 1 : If I am trying to develop something in Java, is it necessary that I need JDK for it? Because as I understand, I can make do with IDE + JRE. My IDE provides me with compiler/debugger, and I will refer the JRE from my IDE. So, it should be alright right?

As you said, JDK is required for compilation and JRE is required for running the program. No matter who provides(IDE or system path), if you have those, you should be able to compile and run your programs.

Question 2 : From the above question, is it safe to say that IDE contains JDK in it already?

You can't generalise the statement tha IDE contains JDK. Few does, few may not.

Question 3 : When exactly will I need just the JRE and nothing else? i.e. under what circumstances will only having JRE suffice. If I were to emulate such behaviour, what are the necessary steps required. (I can make it more clear if you have not understood it. )

If you have classes/jar with you. You can run them without needing JDK.

Juned Ahsan
  • 67,789
  • 12
  • 98
  • 136
1

Answering backwards...

Question 3 : When exactly will I need just the JRE and nothing else? i.e. under what circumstances will only having JRE suffice. If I were to emulate such behaviour, what are the necessary steps required. (I can make it more clear if you have not understood it. )

If you have classes / jars that have to be executed. i.e, if you don't want to compile java source-code to byte-code(.class files) and you want to only run java code.

Question 2 : From the above question, is it safe to say that IDE contains JDK in it already?

Yes, some IDEs like Eclpse ship jdk with the ide. The downside, you can't use cmd prompt to execute java code.

Question 1 : If I am trying to develop something in Java, is it necessary that I need JDK for it? Because as I understand, I can make do with IDE + JRE. My IDE provides me with compiler/debugger, and I will refer the JRE from my IDE. So, it should be alright right?

Yes, without JDK (either installed manually or shipped with an IDE), you can't compile your java code.

TheLostMind
  • 35,966
  • 12
  • 68
  • 104
1

Question 1: You can't develop something in Java without a Java Development Kit. You we're able to do it with your IDE because your IDE is using JDK somewhere.

Question 2: Yes, in some cases. Like Netbeans, you'll have a choice if you want to include JDK to it.

Question 3: You'll need JRE to run every applications thats been written in Java. When you will implement your project, you'll have to setup JRE to your client in order for them to run it.

lxcky
  • 1,668
  • 2
  • 13
  • 26
  • NetBeans does not include a JDK by default. There are two different downloads available: One with JDK and another wirthout even a JRE. – Uwe Plonus Sep 18 '14 at 08:37
1

To understand the difference between the JDK and JRE, see this SO post.

As for your questions:

Question 1:

Yes, you need a JDK if you want to write Java code. The JRE doesn't contain the program javac (Java Compiler) to compile the code.

Question 2:

Depends on the IDE. Most IDE setup includes a JDK bundle. During installation, it installs the JDK first, and then the IDE, application the installation and IDE settings to the JDK path. That way, you don't need to do all the configuration and installation yourself. Like I said, not all IDEs do this.

Question 3:

If you need to only run Java applications only. JDK --> Write and compile code.

I hope this helps.

Community
  • 1
  • 1
Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228