0

I installed java on my machine and I wanted to compile this group of source code. But when I opened up the command prompt and typed in javac, the command prompt said it was an unknown parameter. The same thing happened when I wanted to build something with ant (I had the build.xml if you are wondering) and the same thing happened. How can I set the javac and ant command to be used in any directory?

1
  • Can you tell us exactly what you typed and what messages came back on the command line? Commented Mar 7, 2010 at 15:49

3 Answers 3

6

First of all you have to be sure you installed JDK and not only JRE

Secondly it depends on your operating system:

  • windows: you have to reach environment variables by using My Computer (manage->advanced->something here)
  • linux/osx: you have to export variables with export command or by using a .profile file in user directory

Then you need to set two things:

  • adding /jdk_1.6.../bin/ to your PATH variable
  • setting JAVA_HOME to your root of java installation ( /java_1.6..../ ) (maybe this is not required by java itself but many frameworks use it)

One note: on OSX, and maybe Linux too you have to split paths in PATH variable with double colon ':' instead that semicolon ';'

Sign up to request clarification or add additional context in comments.

Comments

1

Add the directory the executable is in to the PATH environment variable.

Comments

0

Guessing that you are using Windows. Right click My Computer and click Manage. Then, in the Advanced tab, select Environment Variables. In the new window, under System variables, find Path and append the full path to the binaries (javac and ant) at the end, separated by semicolons.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.