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

///Java Tutorial – Compiling and Running Java Programs using Command Prompt and Unix Terminal

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

FavoriteLoadingAdd to favorites

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

Java468x60

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.

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 FilesJavajdk1.7.0_25bin

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:

Background Music:
The XX – Intro

—– References —–

source

By |2021-04-21T13:33:42+00:00April 21st, 2021|Java Video Tutorials|19 Comments

19 Comments

  1. DANISH AMIN April 21, 2021 at 1:33 pm - Reply

    thanks for such a nice video : )

  2. Pierre Bodereau April 21, 2021 at 1:33 pm - Reply

    thanks saved me!!!

  3. blue heart April 21, 2021 at 1:33 pm - Reply

    Thanks

  4. Emilio O. April 21, 2021 at 1:33 pm - Reply

    FUCK WINDOES IT IS A PIECE OF SHIT FOR PROGRAMMERS.

  5. Burak Erkan April 21, 2021 at 1:33 pm - Reply

    Thanks
    Little addition, According to oracle, path souldnt finish like /bin
    https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/

  6. ericgorder1 April 21, 2021 at 1:33 pm - Reply

    Thanks alot this is really helpful, really appreciate it.

  7. Rajeev Ranjan April 21, 2021 at 1:33 pm - Reply

    Thanks it Helps!

  8. Zhao QingSong April 21, 2021 at 1:33 pm - Reply

    Please help me, i cant be able to open java on my macbook pro.

  9. soupawacha April 21, 2021 at 1:33 pm - Reply

    Thank you so much!

  10. alex April 21, 2021 at 1:33 pm - Reply

    Well done video!

  11. Ethan April 21, 2021 at 1:33 pm - Reply

    Thanks.

  12. M SAIFUL ISLAM April 21, 2021 at 1:33 pm - Reply

     @The Lego Guy Exorus  Hey bro this installer file of java has gone from download folder and not installed in my ubuntu system. Now what can i do please help me. How way i can recover it or install it,tell me as soon as possible

  13. renan yorpo April 21, 2021 at 1:33 pm - Reply

    Wow !! bro the way you talked it is clear ,nice voice and most, people are frequently understand of what you are taking ..:D 

  14. AGray Gray April 21, 2021 at 1:33 pm - Reply

    Nice intro ha!

  15. Jennifer Ma April 21, 2021 at 1:33 pm - Reply

    Thanks! very clear.

  16. Hadhemi Laouini April 21, 2021 at 1:33 pm - Reply

    Thank you for this

  17. Yiğit Özkavcı April 21, 2021 at 1:33 pm - Reply

    thanks, but i am curious about something . . how do you know so much codes for terminal ? those are all so complicated dude, anyway, thanks for that

  18. Memo Pony April 21, 2021 at 1:33 pm - Reply

    Keep up the good work!

  19. Memo Pony April 21, 2021 at 1:33 pm - Reply

    Thanks for the instructions dude. /) : D

Leave A Comment

*