Oh Ya! Another new thing to learn.
Let’s roll, In this java tutorial or java tips, we will learn how to set java version and javac version.
The main reason is you might have a few different java versions installed in your machine. But Sometimes for some projects, we need to use some specific java version and javac version to build that project.
If you are curious enough to learn more about javac please click in this link – https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html
Now If you know enough about javac then you must know why it should be the same. If you compile with Java8 and try to read with Java7. The result will drive you crazy.
So here is the thing. In my machine, I have JAVA7 & JAVA8.
Now please don’t ask me why I am still using windows7 and java7. Long story, in short, I needed it.
As you can see that in my machine I have JAVA7 & JAVA8 both. Now we have to make our JAVA version and JAVAC Version are the same.
when we type
java -version and
javac -version in cmd it should show us like this.
According to my CMD result. I already have this set up correctly. If your CMD is not showing then please try to do the following things.
Checklist Item 1:
In your windows please find the configure java option to view or change java settings. click this configure java option.
This will open a Java Control Panel. Now you how to open java control panel.
- Now click Java Option.
- Click View
- Now from this Enabled option, you can choose which version you want to use by simply check the checkbox from the enabled option.
- Or you can decide which version you don’t want to use by simply uncheck the checkbox from the enabled option.
Restart your CMD and See any changes or not from your previous output. If not please follow the Checklist Item 2.
Checklist Item 2:
Checklist item 2 and the most important things for your java and javac version are the system variables of your machine.
Okay, let’s see this scenario. In my System variables inside the path
%JAVA_HOME%\bin; was missing.
JAVA_HOME is set up as a =
C:/Program Files/Java/jdk1.7.0_80 my desired JDK folder path.
let’s see what is the output came from CMD.
Now you will see that
javac is not recognized as an internal or external command.
If you see clearly java version is also changed BTW still I have
JAVA_HOME is set up with
So inside the path, the JDK bin folder is really important to decide which javac will be used to compile your java code.
So follow this step to set up your JDK path
- in windows machine go to your computer -> properties > advanced system settings.
- click advanced and then Environment Variables
- under system variables set
JAVA_HOMEas your JDK folder path example: ”
- then choose the path and then click edit and put your bin folder path in front as you see in the picture mentioned as 4 . Make sure you put
;at the end.
- If you don’t want to add JAVA_HOME variable then put in the path like this ”
Now restart your cmd and try to see your java version and javac version.
OHH YAAA !!! here you are.
If this step doesn’t help you to set java version or javac version please let me know by comment below.i will find a way to help you. Thank you so much for reading this post.
If there is a mistake in this post or I missed any better way to do this please let me know by commenting below. I will appreciate your help and advice.
I love to explore new technologies. If you like my tutorials please share your thoughts about my work.
Check out my YouTube Channel For Video Tutorials.
To Hire Me Please Contact Me Through Social Media or https:www.amialif.com
If you want to help others by doing donation please Help Them.
You also can connect with me via social media. Thanks