Java Tutorial - Compiling and Running Java Programs using Command Prompt and Unix Terminal

Pubblicato il: 13 luglio 2013
sul canale di: Jin Ming Koh
46,070
143

Watch in 1080p HD for optimal clarity! All commands used are listed below for your convenience.

In this video I demonstrate through the use of screen captures and narration how to compile and run Java programs using the Windows Command Prompt and the Ubuntu Unix Terminal. No IDE is required for the compilation and execution process - compilation and execution can be performed via the Command Prompt and the Terminal.

I'll also demonstrate how to install and set up the Oracle Java Development Kit (JDK) on Windows and Ubuntu systems, as well explain briefly what a JDK is. To compile and run Java programs, we require the Java Compiler, the Java Virtual Machine and the Java Standard Library, all of which are included in the JDK, hence the JDK is absolutely essential for our purposes.

I hope you learn something new from this video tutorial, and if you like it, please like, comment and subscribe!


---- Download Link for JDK ----
Download x64 installer if your system is 64-bit, and download x86 installer if your system is 32-bit.

http://www.oracle.com/technetwork/jav...

Check Operating System for Windows:
Control Panel - System and Security - System

Check Operating System for Ubuntu:
Settings - System Details


---- Commands for Windows ----

Updating PATH Variable - Append to End of Value:
;C:\Program Files\Java\jdk1.7.0_25\bin

Moving to Directory Containing Source File - Type into CMD:
cd [Path of Directory Containing Source File]

Compiling Program - Type into CMD:
javac [source file name].java

Running Program - Type into CMD:
java [source file name]


---- Commands for Ubuntu ----

Delete OpenJDK - Type into Terminal:
sudo apt-get purge openjdk-\*

Move to Downloads Folder - Type into Terminal:
cd ~/Downloads

Create New Directory for JDK Installation - Type into Terminal:
sudo mkdir -p /usr/local/java

Move Installer into New Directory - Type into Terminal:
sudo mv [installer file name].tar.gz /usr/local/java

Move to New Directory - Type into Terminal:
cd /usr/local/java

Extract Installer - Type into Terminal:
sudo tar xvzf [installer file name].tar.gz

Open Profile File - Type into Terminal:
sudo gedit /etc/profile

Update PATH Variable - Append to End of File:
JAVA_HOME=/usr/local/java/jdk1.7.0_25
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH

Inform System of New JDK - Type into Terminal:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.7.0_25/jre/bin/java" 1

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.7.0_25/bin/javac" 1

udo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.7.0_25/jre/bin/javaws" 1

Set JDK as Default - Type into Terminal:
sudo update-alternatives --set java /usr/local/java/jdk1.7.0_25/jre/bin/java

sudo update-alternatives --set javac /usr/local/java/jdk1.7.0_25/bin/javac

sudo update-alternatives --set javaws /usr/local/java/jdk1.7.0_25/jre/bin/javaws

Reload PATH Variable - Type into Terminal:
. /etc/profile

Move to Directory Containing Source File - Type into Terminal:
cd [Location of Directory]

Compile Java Program - Type into Terminal:
javac [File Name of Source File].java

Run Program - Type into Terminal:
java [File Name of Source File]


---- Programs Used for Production ----
Camtasia Studio 8 (Screen Capture)
Sony Vegas Pro 12.0 (Video Editing)
Audacity (Noise Removal)
Microsoft PowerPoint (Slideshow)


---- Credits ----
Intro Template Obtained From:
http://www.ravenprodesign.com/

Background Music:
The XX - Intro


---- References ----
http://docs.oracle.com/javase/7/docs/...

http://docs.oracle.com/javase/7/docs/...

http://www.skylit.com/javamethods/faq...

http://www.wikihow.com/Install-Oracle...


In questa pagina del sito puoi guardare il video online Java Tutorial - Compiling and Running Java Programs using Command Prompt and Unix Terminal della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Jin Ming Koh 13 luglio 2013, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 46,070 volte e gli è piaciuto 143 spettatori. Buona visione!