How to set Java path and class path in Windows-64bit

I installed java on windows-64bit OS. but when i execute javac it doesn't work with

no error message, such command is available. "I created the following environment variable

CLASSPATH C: \ Program Files (x86) \ Java \ jdk1.6.0_05 \ lib

+6
source share
5 answers

Add the appropriate Javac path to the PATH variable. java.exe will be found in the bin your JDK. For instance.

 SET PATH=%PATH%;C:\Program Files (x86)\Java\jdk1.6.0_05\bin 
+7
source

Before answering your question, just try this simple question: What are PATH and CLASSPATH for?

Answer:

1) PATH: You need to set PATH to compile Java source code, create JAVA CLASS FILES files, and an operating system to load classes at runtime.

2) CLASSPATH:. This is used by the JVM, not the OS.

To your question:

Just make sure you have the modified PATH variable (Windows System environment variable) so that it points to bin dir that contains all exe, for example: java, javac, etc. In my case, it looks like this:; C: \ Program Files \ Java \ jre7 \ bin .

Thus, it does not matter that your system is 32 bit / 64 bit until you specify / change the PATH variable correctly.

+4
source

In fact, the most common way to do this on Windows is

  • Go to Control Panel
  • Click System
  • Open advanced settings
  • Select environment variables ...

The path is one of the variables in the System Variables section. Here the system will search when you try to execute a command.

  • just add the full path to the bin folder under your java installation path. You can copy it using Windows Explorer so you do not have to enter it manually.
  • Click OK to close the dialog boxes.

To check, open a command prompt window or a console window (for example, WindowsKey-R cmd.exe) and run:

 javac -version 

If the java bin folder is on the way, the system will find and execute the javac.exe file located there, and you will see your version of Java. Sort of:

 c:\>javac -version javac 1.7.0_65 
+3
source

Very simple:

You need to set only two environment variables; PATH and java

=> Right-click My Computer

=> Properties

=> Click on the menu of the left hand panel " Advanced system settings " => Click on " Environment variables ", see below.

enter image description here

=> Follow the instructions below to set the User Variable and System Variable .

Set a custom variable named " PATH "

  • Click the Create button in the Custom Variables section.
  • Set the variable name like " PATH " and the value of the variable according to your java version installed (see. figure below).

Set a system variable named " java "

  • Click the Create button on the System Variables tab.

  • Set the variable name as " java " and the variable value according to your installed java version. (shown below in the figure). See the images below for reference. enter image description here

0
source

For me, the variable "JAVA_HOME" should be set as a system variable, not a user variable. When "JAVA_HOME" was changed as a system variable, the "javac" command works. In addition, PATH and CLASSPATH are system variables.

0
source

Source: https://habr.com/ru/post/897529/


All Articles