Question:
Javac isn't working for compiling my java?
anonymous
2013-05-06 15:07:50 UTC
Hello, I am not very new to Java, I know how to use it. But Javac doesn't work. Don't direct me to the oracle.java.com page because I saw the suggestions and they didn't work! DOes anyone know how to use Javac correctly. I am using Windows 7 HP. I use the start>run>cmd but the Command Prompt doesn't accept it. I'll show you:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\KbaumKids>C:

C:\Users\KbaumKids>:C
C:\Users\KbaumKids>cd java
The system cannot find the path specified.

C:\Users\KbaumKids>cd C:/java

C:\java>dir
Volume in drive C is PowerPoints
Volume Serial Number is 72A6-9BB3

Directory of C:\java

05/05/2013 03:34 PM .
05/05/2013 03:34 PM ..
05/05/2013 03:34 PM 1,903 HelloWorldApp.java
05/05/2013 03:34 PM New folder
1 File(s) 1,903 bytes
3 Dir(s) 250,002,911,232 bytes free

C:\java>Javac HelloWorldApp
'Javac' is not recognized as an internal or external command,
operable program or batch file.

C:\java>Javac HelloWorldApp.java
'Javac' is not recognized as an internal or external command,
operable program or batch file.

C:\java>HelloWorldApp.java javac

C:\java>HelloWorldApp.java

C:\java>jdk
'jdk' is not recognized as an internal or external command,
operable program or batch file.

C:\java>

What do I do? It comes up as you saw above but I cannot use the other way (the jdk1.7.0) and it is starting to make me made 'cause I want to test a game I'm working on (which will be released in a while) but I can't! Please help!
Four answers:
kenzo2047
2013-05-07 03:16:07 UTC
javac as well as java are command-line tools. You need to make sure they are accessible via your path. Did you verify that your path contains the proper pointer to the bin directory of your java installation ?
John
2013-05-06 16:13:27 UTC
1. You want to compile JAVA, you need javac executable file;

2. Have you download the JDK from Oralce? http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

3. Select the target os version, eg windows x86

4. Install the jdk and jre into c:\jdk folder (no space, not default)

http://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html

5. confirm the installation successful

c:\\java -version

c:\\javac HelloWorldApp.java

c:\\java HelloWorldApp
anonymous
2015-12-03 15:26:20 UTC
If javac compiler is not working, then you need to add the location of the javac and java applications in the PATH field.



If javac compiler works, but unable to run the .class file, then probably need to remove the older version of Java from your computer.
?
2013-05-06 15:09:52 UTC
add a "-" (hyphen) at the end because it is contained in a .bin file.



Example:



C:\java>HelloWorldApp.java -javac


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...