Sunday, May 17, 2015

Installing Java SE8, Comilling Without Setting the Path Environmental Variable in Windows 8, May 17, 2015


Email: mark.c.stansberry@gmail.com
Cell/Text: (707)235-4095


APCOMPUTER SCIENCE  ONLINE LEARNING : JAVA

Computer Science: Java, Tutoring, Online, Lesson 1 Notes, Installing Java JDK. Setting the Environmental Path Variable in the Command Prompt

MAY 17, 2015 INSTALLATION NOTES

APA Citation

Mark Stansberry, (2015 May 15), Installing Java SE8, Compiling Without Setting the Path Environment Variable in Windows


Step 1: Installing Java on Windows requires that you download the JDK for JAVASE.

On May 17, 2015 I did just that. I went to Oracles Java SE Development Kit Page at

http://www.oracle.com/technetwork/java/javase/downloads/index.html

and selected the "JDK DOWNLOAD" button on the right hand side of the page.

A new page appeared at

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

and from that page I selected from Java SE Development Kit 8u45 options the link

Windows x64 180.44 MB   jdk-8u45-windows-x64.exe


I accepted the download click. The file is a big file, 180 MB and took several minutes to download on my 64-bit Windows 8 machine

Once downloaded, I ran the install exe which took several minutes (a simple wizard) leads you through the buttons to click.


Locating the Java Compiler

You will need to access the Java  Compiler in order to run any program you write on your computer. In order to access the Java Compiler you can either

1) Set the environmental path variable within Microsoft control panel

Or

2) Access it directly from the cmd prompt.

If you do not want to set the environmental variable (or make sure the environmental path variable you set is correct), you need the file location of the Java compiler on your computer. The java installation program stored the Java compiler on my computer at  the directory location


C:\Program Files\Java\jdk1.8.0_20\bin

This is the default file location for the Java installation process.

For running my first program, hello.java, because I didn't set the environmental path variable, I used the following command to compile the simple hello.java program I wrote.

C:\Users\Mark>"C:\Program Files\Java\jdk1.8.0_20\bin\javac" hello.java


The program compiled successfully and created the associated class file.

The Environmental Path Variable

Although you could uses the above command to compile every time, if you set the environmental path variable, you will have to include the path name of the compiler (javac) every time.  Setting the path variable in your windows configuration file allows you to compile a java program without including the java compiler path name every time you need to compile. Allowing you to type in the cmd line, for example

javac hello.java

About BookMarkTutoring.com


BookMarkTutoring.com offers online  tutoring and lessons in computer science for languages such as Java and C++ as well as web programming development languages such as HTML5, Javascript, PHP and MySQL.  Our clients include students in AP Computer Science, Computer Science Associate Degree Programs, Bachelor Degree Programs, Masters Degree Programs as well as students studying for computer science certificates. Our tutoring lessons are geared to programs taught at major universities and junior college programs.

No comments:

Post a Comment