What happen to my pre-installed JRE when I download a JDK? - java

I am just interested, as far as I know if you want do some Java programming, you will need to download a JDK. As part of the JDK, it comes with the JRE. However, I think most Windows OS has pre-installed JRE already. I have several questions:
Does this mean this pre-installed version will get overwritten by the freshly downloaded and installed JRE?
Does a JRE have a version e.g. JRE-7,JRE-8?
If there is version for the JRE and the pre-installed JRE gets overwritten, does that mean there is a risk that some old applications will not work anymore?

1) This depends on your installation directory choice.
2) JRE is just a runtime part of the JDK (no compilers and tools) and thus is has the same versioning scheme as JDK.
3) Java is developed in the way that guarantees backwards compatibility. However you can get incompatibility problems with tools like Maven or libraries like JAXB.

Go to the Windows control panel, click Java, click the Java tab and then View. You will see all of the versions of Java that have been installed.

Related

How get a Mac JRE (on linux) that is ready for embedding?

For years I have distributed a piece of software that relies on javafx, and the solution has been to include a JRE in the distributed software and run my .jar file with a script that sets JAVA_HOME. It has worked great.
The Mac version has always been a challenge: I have to download the .dmg from java, unpack it, and tweak the script for (historically) a different directory structure (which may be an artifact of the .dmg packaging, I don't know). But it always worked. (I do this on Linux.)
I recently updated the included JRE to the latest version (1.8.0_291) and it no longer works on the Mac, even after I corrected for the new directory structure. Users report that the script errors with:
Error: could not find libjava.dylib
Error: Could not find Java SE Runtime Environment.
...and indeed, there is no libjava.dylib. In the previous Mac JRE version I was using (1.8.0_92) this file was at:
lib/jre/Contents/Home/lib/libjava.dylib
...but it is not present anywhere in the latest. I also note that the latest JRE totals 107 MB, where the older one was 164 MB, so it would appear that there is something I'm not understanding about these more recent JRE downloads. E.g. perhaps the mac version requires an installer to run to be complete?
Where can I download a distributable Mac JRE?
Failing that, what is the proper way to make a contained Mac JRE?
It appears that AdoptOpenJDK is a good general way to go for multi-platform pre-built JREs, but they do not include JavaFX.
I attempted to use OpenJDK in conjunction with libraries from OpenJFX from openjfx.io, and although my application superficially worked, there were very many exceptions implying poor compatibility between the two. (I was unable to match versions precisely for JDK 11. It's possible that the latest version of both (JDK 16) might interoperate better.)
I found the Liberica JDK from BellSoft. Their "Full JRE" includes javafx and is working. I do get one swing-related exception on startup, but it doesn't seem to matter to functionality.
Apparently there is also the Azul platform, but I have not investigated it.

JRE included in JDK cannot be used as public JRE?

So I installed the latest Java SE Development Kit (jdk1.8.0_112) that come with JRE (jre1.8.0_112) so I notice I now have two JREs one I got from java.com (jre1.8.0_111)
So what I did is I uninstalled the (jre1.8.0_111) but then when I tried to visit java.com to verify if my JRE is working it seems like it does not work. it just ask me to download it which is the version (jre1.8.0_111).
My question is does the JRE included in the SDK is for development purposes only? and is different from the JRE the end users get??
both JRE foot prints are same. only difference is additionally you get development libraries(+ JRE) with JDK(java development Kit) as opposed to standalone JRE installtion
My question is does the JRE included in the SDK is for development purposes only?
No.
and is different from the JRE the end users get??
No.
What has actually happened here is that your web browser's Java plugin apparently cannot find the previously configured Java installation anymore. The "verify" page is checking that the Java that your browser is using in its plugin is the right one.
If you don't have Java enabled in your browser (wise move!!) then it doesn't matter that it won't work (!)
If you do need the browser's Java plugin to work, the I suggest that you uninstall the JDK and reinstall it. If that fails, you will need to dig deeper to find out why the plugin is not working.
Alright, so reinstalling the SDK didn't actually solve my problem but I think I figured out what's wrong. So the JDK that I downloaded is for 64bit windows thus it includes 64bit JDK and JRE BUT the browser that I am using is 32bit! which is why it needs a 32bit JRE to run Java. So basically I need 32bit JRE for it to work on my browser.
(by default internet explorer and firefox uses 32bit regardless if u have 64bit OS, but u can freely switch to 64bit if you want but not recommended since some web content may not work properly in a 64-bit browser - got this info from this link)

Do I need both JDK and JRE?

I used to have JRE 7 before, and now I installed JDK 8 and deleted my JRE 7 folder. I'm using Eclipse Kepler, and I added JDK 1.8 to my installed JRE's. Can I delete the JRE 1.8 folder as it's taking up space in my computer? Will it cause any problems?
JRE is a part of JDK.
No need to have JRE when you have JDK. If you open JDK folder and see, you'll have JRE folder inside it which is the same of JRE folder initially you have.
As all have said that JDK includes JRE, that is perfectly right.
But let me add more on it to fulfill an industrial Structure.
While an employee works on some project, they need JDK for they need to write code as well as compile it.
But after the development process completes, the software is ready to deliver and the client's machine will have to choose whether JDK is needed or the JRE.
I would recommend to install JRE on clients' machines because clients don't have to compile the code. Clients always goes straight forward to execute it.
So, make sure to install JRE on clients' machines, not JDK. It will give the advantage of Memory - Utilization too.
Thanks.
You can delete JRE. JDK is a superset of JRE and contains everything already.

Linux (centos), openjdk 8, openjfx and netbeans 8

So I installed at centos 6.4 openjdk 8, netbeans 8 and build openjfx. The only thing I can't uderstand is how to make netbeans work with built openjfx sdk. As openjdx sdk is in folder /temp while jdk is in /usr/lib/jvm/java-8... I can't undertand how to add openjfx to netbeans as everywhere people say that jfx is already in jdk.
So, what now should I do to make all these work together?
It's easiest just to use the Oracle JDK if you can do that. You could possibly hack something together by installing the Oracle JDK, seeing where in the JavaFX code is placed in the Oracle JDK and copying the OpenJFX build artifacts you created to similar locations in the OpenJDK, then pointing your NetBeans at the integrated OpenJDK/OpenJFX install. Seems a lot of a work for a development environment though when you could just use Oracle JDK and it would just work out of the box. You could always switch to OpenJDK/OpenJFX for final packaging for customer delivery once your development is completed.
Ubuntu has binary OpenJFX packages available, so if you could switch to Ubuntu, you should be able to use them (I've never tried it).
I am not aware that anybody has created anything similar for CentOS (this may change in the future). If you stick with CentOS, you would probably need to follow my earlier advice of manually copying JavaFX files into the OpenJDK structure at the locations that NetBeans expects. Usually the files you will need to worry about are the jfxrt.jar file (see What's the location of the JavaFX runtime JAR file, jfxrt.jar, on Linux?) and the associated binary libraries (which must be in the correct location to be found), though there are possibly other files such as property files or javafx swt integration libraries that might be needed for correct function.
See related question:
JavaFX and OpenJDK

Do I need JDK or only JRE?

I use Solr in my website, and now I am about to configure my VPS account.
I am at the stage where I need to install java in order to make Solr work.
Now, I only plan on running solr, and using it as it is (I have no java programming skills at all), so my Q is, do I need the entire JDK which includes JRE, or is JRE enough?
Thanks
BTW: My server OS is Linux (ubuntu 9.10).
Thanks
To only make it run JRE is sufficient.
However in development environment having a JDK is useful cause with it comes bunch of handy tools for profiling/monitoring the application.
In a production build while packing consider just the JRE.
This FAQ explains when a JDK is needed instead of just a JRE.
You need the JRE only. If you do use the admin screens you will however need the JDK as these are servlets.
Installing Solr just need JRE which is Java runtime environment, you require JDK if you intend to compile the java programs. Although, installing JDK gives you JRE as well but that is something which is not required by you.
Just install JRE and you will be good to go. For more details on difference between JDK and JRE, use following link:
Which one to download: JDK or JRE?

Categories