Professional Documents
Culture Documents
How To Compile Different Languages Source Code Files - DeV Community ? - ?? - ?
How To Compile Different Languages Source Code Files - DeV Community ? - ?? - ?
How To Compile Different Languages Source Code Files - DeV Community ? - ?? - ?
Rakesh Potnuru
Posted on 18. Okt. 2021 • Updated on 8. Apr. 2022
The biggest mistake beginners do while started learning to program is using fancy IDEs
(Integrated Development Environment). You should use the terminal at least to know
how a specific language code is being executed and what's going on behind the
scenes. So in this blog, I am going to tell you how to execute source code for a few
languages.
Requirements
1. Using notepad create the source code file for all the languages mentioned in this
blog.
2. Make sure you have respected compilers installed on your computer and add to
path in environment variables in order use that compiler from anywhere.
For example: If all of my source code files are in the Programming folder in Desktop.
https://dev.to/itsrakesh/how-to-compile-different-languages-source-code-files-a7g 1/6
14.01.23, 07:22 How to compile different languages source code files? - DEV Community 👩💻👨💻
c:\> cd Desktop\Programming
Output: c:\Desktop\Programming>
1. C
Type this command in the prompt. Replace hello with your file name. (Hoping you have
gcc compiler installed)
The above command will create an executable file with the extension ".exe". Now type
the file name to execute the program.
c:\Desktop\Programming> hello
2. C++
C++ has also same procedure. Type this command in the prompt. Replace hello with
your file name. (Hoping you have gcc compiler)
The above command will create an executable file with the extension ".exe". Now type
the file name to execute the program.
c:\Desktop\Programming> hello
3. Java
To compile, run this command.
After that hello.class file will be generated, to run the code type java <filename>
https://dev.to/itsrakesh/how-to-compile-different-languages-source-code-files-a7g 2/6
14.01.23, 07:22 How to compile different languages source code files? - DEV Community 👩💻👨💻
4. C#
Compile with this command
This will generate a executable file hello.exe . You can simple double click it to open or
type file name.
c:\Desktop\Programming> hello
5. JavaScript
JavaScript is browser side language, you can console in developer tools of your
browser or use NodeJs.
NodeJs is JavaScript run time, so you can execute JavaScript files using NodeJs. Here's
how-
6. Go
go run hello.go
7. R
You can use Rscript to run R programs.
https://dev.to/itsrakesh/how-to-compile-different-languages-source-code-files-a7g 3/6
14.01.23, 07:22 How to compile different languages source code files? - DEV Community 👩💻👨💻
8. Swift
c:\Desktop\Programming> swift hello.swift
9. Ruby
c:\Desktop\Programming> ruby hello.rb
10. PHP
c:\Desktop\Programming> php hello.php
https://dev.to/itsrakesh/how-to-compile-different-languages-source-code-files-a7g 4/6
14.01.23, 07:22 How to compile different languages source code files? - DEV Community 👩💻👨💻
Rakesh Potnuru
LOCATION
India
EDUCATION
Lovely Professional University
WORK
Student
JOINED
27. Aug. 2021
https://dev.to/itsrakesh/how-to-compile-different-languages-source-code-files-a7g 5/6
14.01.23, 07:22 How to compile different languages source code files? - DEV Community 👩💻👨💻
https://dev.to/itsrakesh/how-to-compile-different-languages-source-code-files-a7g 6/6