Application Performance issues due to multiple JRE versions - java

Hi for suppose i have multiple JRE versions(1.6.1 till 1.7) on a single machine and one of the application is supposed to use JRE 1.6, at the same time another application is using JRE 1.7.0_17 ,Will that cause any performance issues???Please advice

No it shouldn't cause any (big) problems. Each JVM will run as a seperate process and will be handled independently by the OS. If your apps use the same resources, then there might be a deadlock somewhere.
As a general note (which applies to any process), having more processes will consume more CPU.

Yes, you can have multiple JRE installed on the same machine. And you can have one project configured with one version another with another version.
But if you run Higher version of Java compiled code on a JRE having lower version, you might face some issues.
It will not slow machine. A machine can have multiple JVM on single machine.

First in hand, since you are talking about JRE (not JDK), you need not to have multiple JRE's.
JRE 1.7 supports JRE 1.6 because of backward compatibility. Just remove 1.6 and connect to 1.7.
Might helpful : Do I need both JRE 1.6 and JRE 1.7?

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.

how to find duplicated libs and version conflicting classes using Memory Analyzer Tool

IS Memory Analyzer Tool allows to find duplicated libs, classes and version conflicting classes present in the given input application
See this if it helps and I Didnt use it though
http://community.bonitasoft.com/effective-way-fight-duplicated-libs-and-version-conflicting-classes-using-memory-analyzer-tool
It seems there was a problem with different Java versions.
A long story short: If JDK is outdated re-install it, and delete Java executables from C:\Windows\System32 and C:\Windows\SysWOW64.
Firstly, I want to tell you that I have multiple versions of Java on my computer. My JDK is 32-bit because of some drivers not running with 64-bit Java. Also, I have both 32-bit and 64-bit JRE installed, the latter for better performance for Java games.
My JDK was version 7, update 40. The VisualVM was so also that version. However, my JRE with auto updates was version 7, update 45.
java -version told me it was version 45 (which it was), so I didn't think the problem was there.
Then, I checked the versions via Control Panel. I now knew my JDK was outdated, so I uninstalled it and redownloaded it.
Uninstalling removed Java from the system path, so jvisualvm wouldn't run. I added it to the path. Now both the app and VisualVM ran normally, but still the problem persisted.
The final problem was that the system was using the java.exe from C:\Windows\System32 instead of the JDK one. By the date it seemed to be the latest one, but maybe it was that the JRE was installed in a different location that the VisualVM (= the JDK).
Finally, I just deleted the Java executables in both C:\Windows\System32 and C:\Windows\SysWOW64.

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.

running different jre versions on the same machine [duplicate]

This question already has answers here:
Multiple Java versions running concurrently under Windows
(10 answers)
Closed 9 years ago.
I was wondering if there would be any implications (slowed performance, crashes and so on),
running a java 1.4 application and a java 1.6 application on the same machine
Different java version are installed in different directories so running 2 java programs with different JRE version will not make any effect other than that you are running 2 processes of java.
So bottom line, there is no problem with that, it will not slow you down.
Also, java 6 has better performance than 1.4 so if you can run both on 6 its usually better.
None, The only problem is you can only have one default JVM. If you have too many versions e.g. hundreds it is likely to be a bit of mess, but it won't slow you down.
It seems that the header does not correspond the question. Running different jre versions on the same machine is not the same as running a java 1.4 application and a java 1.6 application. So I will give 2 answers
Yes you can have 2 different jre installed on your machine.
You can run 1.4 application (classes compiled in Javac 1.4) on JRJ 1.6 but you cannot run 1.6 application (classes compiled in Javac 1.6) on JRE 1.4.
Of course, It will not slow machine. A machine can have multiple JVM on single machine. There will not be any kind of conflict because everything would be in separate folder.
There is only special case in case of multiple JDK/JRE.
Case : - What version will be used by your browser.
For this you can control all the things from java console from control panel in windows.
Yes, you can have multiple JRE installed on the same machine on the same O/S. And you can have one project configured with one version of Java Compiler on your IDE. But remember when you run Higher version of Java compiled code on a JRE having lower version, you might face some issues with the new features and enhancements introduced with the later versions.

Using Java 1.4 for applet when 1.6 is installed

My Java applet only supports 1.4 java run time(1). I am having one machine on which both Java 1.4 and 1.6 environment is installed. Is there some setting available by which I can make sure my applet will always use Java 1.4 run time when it runs?
We are using key event class private data array bData with the help of Java reflection. The data which is there in this array JDK 1.4 and 1.6 is different in both the version.
A Java application compiled with JDK 1.4 will run on JDK 1.6.
You can compile a Java application with JDK 1.6, but compatible with JDK 1.4 by configuring the 'source level'.
Although you can choose your default JDK to be safe, but it depends on your operating system. If you are on Linux, you can choose between available Java versions using pdate-alternatives --config java command (which will modify some symlinks in the hindsight).
On Windows 7:
Control Panel -> Programs -> Java
Select 'Java' tab, and View the Java Runtime Environment settings.
Ensure that your Java 1.4 entry is selected.
There's a way to force a specific installed version to run, but if one Java plugin replaces the other there might be an issue with this. See linked question for further details.
Force Internet Explorer to use a specific Java Runtime Environment install?
Are there any issues with running the 1.4 code on 1.6? If not, you should be fine. Just avoid using anything in the classpath that changed significantly between these versions. Otherwise, look [here][1]. The codebase download thing is interesting, since it lets you download a different classpath. So, regardless of the JRE version, you could force the download of a 1.4 JRE classpath, which should ensure full compatability.
Edit: found an updated guide to using previous classpaths with newer Java versions in applets, which actually seems to work:
http://download.oracle.com/javase/tutorial/deployment/applet/deployingApplet.html
Edit 2: I actually have it working, but it appears to need to download JRE 1.4 and install it, but then it will run the applet with it automatically. However, this might be suitable for your needs.
http://www.2shared.com/file/bl3Rua2e/applet.html -- extract the archive, and then run index.html inside this. All source code is included.

Categories

Resources