Windows 7 64bit. I have a web based application that needs to use the newest version of java (1.7.0.45) and I have another software install the needs java versions (1.5.0.15 & 1.4.2). I'm just unsure how to set the PATH/VARIABLE for this to work properly.. any help would be greatly appreciated.
I have seen several posts & answers regarding very similar situations to this, but I am just unsure how to make this work.
As mentioned by #Moshe here.
It is absolutely possible to install side-by-side several JRE/JDK
versions. Moreover, you don't have to do anything special for that to
happen, as Sun is creating a different folder for each (under Program
Files).
There is no control panel to check which JRE works for each
application. Basically, the JRE that will work would be the first in
your PATH environment variable. You can change that, or the JAVA_HOME
variable, or create specific cmd/bat files to launch the applications
you desire, each with a different JRE in path. Just like below,
set JAVA_HOME=C:\...\j2dskXXX to change the JAVA_HOME environment.
Related
I've been setting Windows environment variables (like JAVA_HOME) every time I installed a Java update. (As per Environment variables for java installation).
However, I've recently noticed that Java updates add C:\ProgramData\Oracle\Java\javapath; to the System Path (not the User Path). I removed JAVA_HOME, etc from my User Path, and java -version seems to work from any directory.
Does that mean that it is not necessary to do that simple but annoying task with each Java update?
That depends on what you are trying to do.
Generally, you don't need JAVA_HOME to run a Java app. Adding the location of the Java binaries to the PATH is sufficient for Windows to find and execute them.
However, e.g. a lot of application servers like Tomcat and build tools like Gradle will use JAVA_HOME to determine the location of your Java installation.
Java itself does not use JAVA_HOME. Some third-party things like IDEs and Tomcat do. I've never set it as an environment variable in 20 years.
Personally, I don't even have JAVA_HOME set and I've been developing at this company for 6 years now (and other companies for 10+ years). To me, it tends to get in the way. The last install sets the windows path which generally isn't what my IDE's, Tomcat, JBoss or SOAP-UI support so I just edit all their startup files to choose/set the JAVA_HOME they work with.
My machine runs Windows 64 bits. I have multiple IDEs installed (eclipse, intelliJ, qt creator, visual studio) and I daily run some work applications that use java (vpn connector being the most important one).
Usually, when I get a java update notification I just accept and everything runs smoothly, but today I found that Eclipse is not starting because of exit error 13, which I read is caused by 32-bit/64-bit conflicts between Eclipse and Java. When I checked my java installation folders, I found out I have multiple folders, both for 32 bits and 64 bits:
I'm not even sure how those JRE folders ended up there, since I only download the JDK when I have to. Maybe they are the JRE installed with JDK but not sure.
Anyway, this is my 32-bit JAVA folder:
And this is my 64 bit-JAVA folder:
How can I get rid of all of those safely, download and install the latest JDK afresh and have everything running smoothly?
Thanks :)
The safest way remove Java installations on Windows is to run the respective uninstaller via the control panel. In addition to deleting the installations themselves, the uninstaller will (should) remove related entries from the Windows registry.
As other answers note, you would still need to ensure that the JAVA_HOME environment variable is updated to refer to the new Java installation, once you have installed it.
However, the problem with uninstalling copies of Java that you didn't explicitly install yourself is that you may end up breaking tools and applications that depend on those copies. If the tools use JAVA_HOME you should be fine. Otherwise, you might need to modify launcher scripts, etcetera.
If you are worried about this, you could rename the Java installations that you intend to remove, launch each of the apps, and see which of them breaks. (Then rename the Java installations back ...)
I had a problem like this before (with a lot of version and JDKs installed).
The best way is just to delete everything and download it again, i know that it isn't the best solution and it will take some time to download and install everything again but it worked for me before.
It does not matter how many jdk/jre folders you have. Just make sure environment variable JAVA_HOME and JRE_HOME points to the 64 bit jdk and jre folders correspondingly. You can remove other folders which are not pointed. The other applications may break after this change. You can fix them by pointing to this JAVA_HOME.
Refer this for setting JAVA_HOME env variable
So I have this neat physics sim I made that, while running at certain settings, runs at around 34 fps when ran via the Netbeans "run" -command. Then I click "clean and build" and go open the program from the dist folder, and it runs at around 10 fps with the same setup.
Can it be about Java settings? I don't have any special setting done in Netbeans but I'm not sure how to check my the settings on the installed JRE, can they even be different by default from what Netbeans uses by default?
I doubt it's running a different JDK but you can check the JDK that your Netbeans installation is using at Tools -> Java Platforms. To check what version of Java is in use by the distributed version look at your JAVA_HOME, and Path environment variables.
A major difference between the distributed version and the development environment may be the libraries. Check your CLASSPATH environment variable, and compare the actual files between the distribution and development environment to see that the size and dates match. I'm not totally sure how to get at the CLASSPATH used by Netbeans but can advise that it has some special magic it uses based on the libraries included. Also be aware that the order of the included libraries may make a differen
What software are you using to deploy your project?
Ok problem solved, it was due to outdated Java. I did have my 32 bit Java updated already - the default download at oracle.com but the program was using the 64 bit version, which was actually way outdated. So installing the latest 64 bit release of Java solved it.
I'm on an Ubuntu Desktop that is set up with JDK 1.6.34 and everything works great. I'd like to install JDK 1.5.11 in such a way that my environmental variables, etc. don't get "blown out" by the installation of 1.5.11.
Is this even possible? Can the same machine have 2+ JDKs installed on it? If so, what are the necessary steps one needs to take to achieve this?
Yes, you can install as many JDK's on a machine as you want. As for "blowing out" environment variables, this is how you control which jdk you'll use (i.e. make sure the desired jdk's /bin directory is first in the path and that JAVA_HOME points to the JDK you want to be using).
Can I have multiple java SDK versions installed on my machine?
Java 1.4
Java 2
Java 6
Java 7
please advise as I have to develop solutions for Maximo in Java 1.4 and Java 2
Plus I want to learn development on Java 6 and 7
Thanks.
Can I have multiple java SDK versions installed on my machine?
Yes
But make sure you use right path in your projects. It will be better to use some IDE like Eclipse. It will handle jdk path problems for you.
Java 1.4 is very old, try to shift to new one as soon as possible.
Yes,you can.
You need change environment variable Normally JAVA_HOME variable.
So you can use another variable.
eg.
JAVA_HOME='/home/jdk1.8.0_45'
JAVA_7='/home/jdk1.7.0_60'
JAVA_6='/home/jdk1.6.0_34'
Add path variable
PATH=$PATH:$JAVA_HOME/bin
PATH=$PATH:$JAVA_7/bin
PATH=$PATH:$JAVA_8/bin
Yes, you can. Just use full path names when invoking javac, java, etc. or set your PATH environment variable to point to the appropriate jdk/bin location.
The IDEs usually allow defining multiple JDKs/JREs, and you can choose which one to use for every project.
Yeah, you can install as many Java SDKs as you want. When you develop you just use the JDK you want to use.
Yes you can. JDK is merely a directory somewhere on your disk. So you can easily download and unpack all the versions you want, and run java and javac from the directory you're currently interested in.
IDEs will do all the messy stuff for you: just let them know where the unpacked JDKs are, and choose a JDK in project's or module's settings.
PS. Java 1.4 is Java 2. Java 2 is actually an umbrella name for 1.2, 1.3, and 1.4
I attach some pics as how I configured VS code to work with two different versions of Java in one machine
1-Environment Variables
2-Configuration inside VS Code
3-Configuration inside VS Code
4-Configuration inside VS Code