What is difference between JDK7u45 and Java7u21 - java

I am starting with android development and while setting up Eclipse SDK i got an error that Java Development Kit(JDK) or Java Runtime Environment is missing. I had Java7 update 21 installed already. but now I downloaded JDK7u45 from Oracle site.
I want to know the difference between Java 7 and JDK 7 and also if I remove JAVA and install only JDK(as EclipseSDK is giving an error that JDK is missing) then will it make any difference in my desktop environment?

I want to know the difference between Java 7 and JDK 7 and also if I
remove JAVA and install only JDK(as EclipseSDK is giving an error that
JDK is missing) then will it make any difference in my desktop
environment?
Java 7 = JDK7(Java Development Kit) + JRE7(Java Runtime Environment)
JDK 7 = just JDK i.e. Java Development Kit
JDK is required to compile/build your java programs, generates the class files. Whereas JRE is required to run the generated class files. Eclipse requires JDK to compile your code, hence it is necessary to have it. Generally JDK contains Java Runtime Environment under the directory name jre inside jdk.

Related

JDK and JRE version confusion

I've been working with Java for a bit now and the JDK/JRE version has given me quite a bit of trouble lately. I am developing using the Intellij IDEA IDE and it of course uses the latest version of the JDK, 14. However when I attempt to execute software compiled with JDK 14 outside the IDE, I get an error that the JRE isn't new enough to run this software. So I updated Java on my computer and another machine and attempt to run again without any success. After some digging, I tweaked my machine to use the JRE included in the JDK 14 which is compatible.
However it is kind of odd that I had to do that, one would think that the latest version of java should of been enough to run applications made with the latest version of the JDK (14). Right now Java is version 8 build 251 and says there is no newer update available. If JDK 14 is out for a while now, why would they not update the version of Java they ship?
The problem is partially solved, as only the machine I am using for development is capable of executing the created applications. Other people I've sent them to have been unable to run them, despite having the latest version of java. Also it is a pain to get the latest JDK, especially when having limited experience on how to get rid of old versions, change path point to the latest version, get the right package (open/oracle JDK) and do that for windows and several distrubutions of linux. What is going on? Did I get Java from the wrong place and everyone else as well? Why are oracle doing this and why are there no java updates since clearly there exists a newer version?
Starting with Java-11, separate JRE does not exist anymore. In other words, if you are using Java-11 or above, you should care about JDK only.
You should uninstall JRE-8 from your machine and make sure your JDK-14 bin folder in the PATH variable. Some application even requires JAVA_HOME to work and therefore you should make sure that your system has an environment variable called JAVA_HOME and its value set to the root folder of JDK-14 (i.e. one level above your JDK bin).
Q: What should my clients do to run my application compiled on JDK-14?
Ans: Your clients must install JDK-14. Also, check this thread for some alternatives.
You're confusing how IntelliJ or JDK are used on the OS. IntelliJ, now, often comes with its JDK binaries (but even this can be configured, IntelliJ can be configured to use any JDK/JRE build you'll provide to it); however, if you run your Java application out of IntelliJ, most likely you're using Java installed locally on your OS, which might be referenced via your JAVA_HOME environment variable.
I'd suggest to:
Check java -version in your shell (and hence you'll see what JVM instance your OS spins up when you run a Java application);
Check where java (on Windows, or which - on Linux) in your shell, to see all the Java binaries available on your OS.
Try to uninstall Java SE Development Kit and Java JRE(if you have both in your machine) and reinstall both again, JDK and JRE both, I am sharing my google drive link where you can find the latest version of both JDK and JRE and when you are done installing, add there bin folder path in the Environment Variables of your machine.

Java 11 does not set Java Environment Variable

usually when installing an updated JRE, the environment variables will be set so that running any java command in CMD will use the new version.
I've just installed JDK 11 which doesn't have a JRE equivalent - well it's in the JDK - but java commands are still being sent to JRE 8.
This is no problem for me, I can always change the environment vars myself and point to "C:\Program Files/java/jdk-11/bin/java.exe", but anyone who wants to use my program, which requires Java 11, will not have their variables set and it's a bit much to ask them to do so.
Why are they not being set on a standard Java 11 install? Am I being stupid?
Oracle is still pushing 8 as the "end user" Java install. That's why it's the only one you can find on java.com. Newer versions of Java are designed either for back-end use on servers, or to be bundled with the application itself. The latter option is what you want.

Eclipse compiling with JRE or JDK

I have one question in my mind and I should note that I know the differences between JDK and JRE. I am not a new programmer in Java.
What I would like to ask is in Eclipse I can specify the compilation environment (correct me if I a wrong) in window> Preferences but we can also change it for a specific project.
OK. I added jre and jdk folder in the options. I can use both.
But JRE has no javac (no java compiler) in it. So how it is possible that some projects requires that I need to change to jre1.7 to COMPILE?
I was getting some minor.major version error and setting JRE solved my problem?
How can this be possible?
In fact now I realized something.
Ok the question changes a little.
I saw that these are VM not compiler. I understood.
Does JDK have also JRE in it? so if I specify JDK1.8 I am setting jre1.8 as VM and if I specify JRE1.7 I am setting jre1.7 as VM?
Is it right?
It makes confusions. Why JDK has JRE in it?
JDK has whole JRE (regular Java VM) inside, in order to allow you to run what you will develop with it.
Theoretically someone could make some small-JDK with just tools and without JRE, but it would make a whole lot more confusion as to which tools version run with which JVM version (most JDK tools needs JVM to be run). Look at you, how many people have only this problem? So it is bundled together, tools and JRE as a whole named JDK, thanks to that you have some guarantee that those JRE and tools will work together.
JRE - Java Runtime Environment - allows you to run java programs
JDK - Java Development Kit - allows you to run and develop java programs
JDK = JRE + tools for developer
Also note, that You can choose for the java compilation process two things:
compatibility with source version - this is basically the syntax you are allowed to use.
compatibility with VM version - this is the minimum VM level on which you can run the compiled binaries.
example from your post: If you have compiled something as Java 8, you can't run it on Java 7, this is the minor/major version problem you have. But the opposite (to run something for Java 7 on Java 8) is valid.
in your example JDK8 and JRE7 both are just fully functional VM's, but JDK8 has additionally (in comparison to JRE) development tools inside it.

Requires Java 1.7, but running version 1.8.0_20. Shouldn't this work?

I am trying to install something via a jar file:
java -jar filename.jar'
I then get this error:
You need at least Java version 1.7 to run the installer.
However, you appear to be running version 1.8.0_20.
Please run the installer with the requisite Java version.
Aborting...
I am still kinda new to this, but doesn't this mean it needs Java 1.7 or higher and I am running 1.8?
How would I go about fixing this?
Java 8 has some bugs right now... Just install Java 7 alongside Java 8 and it should work
If you cant find a download, here's a link to the official Oracle site with at least Java SE 7:
http://www.oracle.com/technetwork/java/javase/archive-139210.html

Upgrade Java version for Web Application

I have a web Application and i need to upgrade java jre version from 6 to 7 .I am using Eclipse as IDE.I tried to update the Jre from eclipse .I have even updated the JAVA_HOME environment variable but i am getting following error
C:\Program Files\Java\jdk1.7.0_55\jre..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.
Thanks
Download java hereand install it as a common application.
Then in Eclipse use Window->Prefrences->Java->Installed JREs
#Roman Bondar I guesss OP wanted to know more than just the setting.
Basically, JREs are meant to be downwards compatible, so that you are able to execute java classes compiled with version 6 with a runtime from java 7.
But as always, there may be special cases when things have to be changed, e.g. container or libraries. I remember a case back when I migrated to java 6 that it required a special version of JBoss.
Check out this Oracle blog as a starting point.

Categories

Resources