Compile with Windows
jerome
-
clacla -
clacla -
Hello,
I copied the JDK 1.4.2 to my computer (Windows).
In the MS-DOS commands, when I run "javac fichier.java", it tells me that javac is not a recognized command. How can I make it recognized?
Thanks
PS: "java fichier" is perfectly recognized and executed
I copied the JDK 1.4.2 to my computer (Windows).
In the MS-DOS commands, when I run "javac fichier.java", it tells me that javac is not a recognized command. How can I make it recognized?
Thanks
PS: "java fichier" is perfectly recognized and executed
Configuration: Windows XP SP1 JDK 1.4.2
5 answers
To compile under the Windows command interpreter: you need to use the command javac
To run a .jar, execute a java program, you need to use the command java
How to configure your machine?
1. If not done: Install the SDK (or JDK) (See the SUN/Oracle website)
2. If the environment variables are not configured, you need to configure the following:
2.1. Right-click on the "Computer" icon: "Properties" > "Advanced" tab > "Environment Variables"
2.2. In "User Variables for XXX" click: "New": [Name: "PATH" Value: "Your_Directory_where_the_jdk_is_located\bin" (=> example: "C:\Sun\SDK\jdk\bin")]
2.3. (Optional) In "User Variables for XXX" click: "New": [Name: "JAVA_HOME" Value: "Your_Directory_where_the_jdk_is_located" (=> example: "C:\Sun\SDK\jdk")]
2.4. To call in the command interpreter: In "System Variables":
Double click on the path variable. DO NOT DELETE THE ENTERED VALUES but add after the last ";" : "Your_Directory_where_the_jdk_is_located\bin" (=> example: "C:\Sun\SDK\jdk\bin;")
Attention: check that javac.exe and java.exe are present in the pointed folder.
2.5 Check that .exe is included in the variable: "PATHEXT"
2.6 Save (Click Ok, etc...)
2.7 Restart the PC
2.8 Check the pointing: in the command interpreter (run: CMD) do: "echo %path%. Normally, the paths of the variable are displayed, the one of jdk\bin is included. Otherwise, check the input in the variables (do as previously).
3. Use the command interpreter to perform your compiles and executions.
For more info: https://www.webmaster-hub.com/publications/java-installation-du-jre-et-du-jdk/ or... google.
To run a .jar, execute a java program, you need to use the command java
How to configure your machine?
1. If not done: Install the SDK (or JDK) (See the SUN/Oracle website)
2. If the environment variables are not configured, you need to configure the following:
2.1. Right-click on the "Computer" icon: "Properties" > "Advanced" tab > "Environment Variables"
2.2. In "User Variables for XXX" click: "New": [Name: "PATH" Value: "Your_Directory_where_the_jdk_is_located\bin" (=> example: "C:\Sun\SDK\jdk\bin")]
2.3. (Optional) In "User Variables for XXX" click: "New": [Name: "JAVA_HOME" Value: "Your_Directory_where_the_jdk_is_located" (=> example: "C:\Sun\SDK\jdk")]
2.4. To call in the command interpreter: In "System Variables":
Double click on the path variable. DO NOT DELETE THE ENTERED VALUES but add after the last ";" : "Your_Directory_where_the_jdk_is_located\bin" (=> example: "C:\Sun\SDK\jdk\bin;")
Attention: check that javac.exe and java.exe are present in the pointed folder.
2.5 Check that .exe is included in the variable: "PATHEXT"
2.6 Save (Click Ok, etc...)
2.7 Restart the PC
2.8 Check the pointing: in the command interpreter (run: CMD) do: "echo %path%. Normally, the paths of the variable are displayed, the one of jdk\bin is included. Otherwise, check the input in the variables (do as previously).
3. Use the command interpreter to perform your compiles and executions.
For more info: https://www.webmaster-hub.com/publications/java-installation-du-jre-et-du-jdk/ or... google.
Info for Windows Seven users: The 'Advanced system settings' can be found in the left pane of the system properties window, and then you need to go to the tab of the same name. The rest is the same as under XP (method described above).