Some IDEs may come with their own compiler. Otherwise, when you install or configure the IDE, you point it to your JDK installation, and it invokes javac from there just like you would on the command line.
It's certainly possible that the IDE is invoking javac via Runtime or ProcessBuilder. That would actually be my first guess.. On the other hand, I think for the last few versions, the JDK has included compiler classes, so maybe it's using those.
naveen yadav wrote:my point is that even after knowing the location of jdk installed directory , i cannot compile a file without using command line .I have to open command line and then invoke javac from there .
Yes, that's how it normally works when you compile a Java source file manually.
naveen yadav wrote:how can i do it without invoking command line , of course ,apart form using an IDE?
The Java compiler included in the JDK does not have a GUI. The only way to use it directly is from a command line prompt.
naveen yadav wrote:As i pass "javac Myclass.java" to command line .It seems unlikely that an IDE will open command line and then compile a file from there. ?
Eclipse has its own built-in Java compiler. It does not use the Java compiler in the JDK at all. Other IDEs call the Java compiler from the JDK and show its output in a custom console view. Just because you normally use a command prompt window to run the Java compiler, that doesn't mean that it is always necessary to have a command prompt window to run javac.exe. IDEs can just run javac.exe in the background and get the output from the compiler without you seeing any command prompt window.
Also, the Java compiler has an API so that it can be called from a Java program via the API. This API is in the package javax.tools.