Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

What's the difference between 'javac' and 'java'?

I am taking the Java course at Treehouse and on the first video, he teaches us about compiling. I didn't quite get what the difference between 'javac' and 'java' mean't. Can someone thoroughly explain?

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

The java code that you write must be built/compiled before we can run it. javac compiles the code and makes it into an executable format. java runs the code you just built. Hope this helps! :smiley:

Dennis Addo
PLUS
Dennis Addo
Courses Plus Student 2,943 Points

javac (as "Java-see or Javack" "java compiler") is an executable, which could be theoretically even a platform-dependent executable or a script. This is called to compile a .java to a .class. And Java is the programming language where you learn the syntax from its documentation to write a set of commands. you can read more from here

https://en.wikipedia.org/wiki/Javac```

javac is the command to compile (create) the source code into a program that can be run. If you program's name is "file" then

javac file.java

is a command to take your file.java source code and compile it into something than can be run. After this process is completed you can now run your file by typing

java file

into the command prompt.