Eclipse has its own compiler and can run on a non-JDK JRE. So, I gotta download JDK by myself.
Run Command Prompt (found under All Programs/Accessories in the Start menu). Type
C:\> cd \myworkThis makes C:\mywork the current directory.
C:\mywork> dirThis displays the directory contents. You should see
HelloWorld.java
among the files.C:\mywork> set path=%path%;C:\Program Files\Java\jdk1.5.0_09\binThis tells the system where to find JDK programs.
C:\mywork> javac HelloWorld.javaThis runs
javac.exe
, the compiler. You should see nothing but the next system prompt...C:\mywork> dirjavac has created the
HelloWorld.class
file. You should see HelloWorld.java
andHelloWorld.class
among the files.C:\mywork> java HelloWorldThis runs the Java interpreter. You should see the program output:
Hello, World!
My java path:
C:\Program Files\Java\jdk1.7.0_02\bin
* The compiler is smart. It can detect the relation of class. So, just javac the .java with main() and then it will compile the related .java
No comments:
Post a Comment