Do I need JDK or only JRE? - java

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?

Related

Java versions confusion

I want to install Java on a few different servers for running a third party service on tomcat.
I am not a Java developer and I got a bit confused when I began searching for the installer.
I checked the different Java versions and their long term support dates.
It seems that Java 11 JDK is - LTS so i decided to use it.
But when I was trying to find a runtime version (JRE?) since this is the version I am supposed to install on the server(?) I only found Java JRE 8.X.X, and this got me confused.
There is no higher major version of the JRE?
How does it work if you use the JDK 11 or even 14-15 as a developer and then use Java 8 JRE on your deployed servers?
Maybe the JDK holds inside of it the Java 8 JRE version?
Or do you actually need to install the JDK version on the servers instead?
The JRE is a subset of JDK. It contains everything needet to run Java applications but no support for development. So, if you need a JRE, a JDK is also good, although it conatins much stuff that you will not need.
Normally, for executing a Java application, you need a JRE with the same version or higher than the JDK used for development. But the developer can advise the compiler to generate code for a lower version. If he does so, he cannot use the features of the higher versions. For example the compiler of JDK 1.8 can produce code for JRE 1.6. You should consult the manual, to see which old versions are supported by the compiler of a specific version.
After some research,
It seems there is no separate JRE section anymore.
Also JDK 11 for production is not free and I guess this is an ongoing trend for the near future.
On a side note there is the open JDK 11 version but it does warn you about outdated security updates.
So basically in my case sticking to updated Java JRE 8 version is good enough for the near future.

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)

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

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.

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

When to use JDK to launch application (javaw.exe) and when to use JRE?

I am try to set java virtual machine path in eclipse and tomcat, and find out there is "javaw.exe" in both the JDK and JRE directories.
Which "javaw.exe" should be used, and why?
You shouldn't be using javaw as it is java without a console. Using the java in JDK is probably the safest. JRE is only the runtime and it will also work. But when developing I recommend JDK because that's also where javac.
These javaw executables are identical. You can see it yourself - compare their sizes.
As this link says
JDK includes the JRE plus command-line development tools
So whenever you are doing some development-related stuff you should use the one from JDK.
PS:
as Amir mentioned earlier - you probably don't want to use javaw at all...

Categories