Install Cygwin on Windows 7
One way to play linux on Windows machine
This is the HP laptop I am using:
Choose Start > Control Panel > System
Windows 7 Professional SP1 64-bit
Go to https://www.cygwin.com and click the link setup-x86_64.exe.
Follow the instructions on screen.
I simply choose a mirror site of University of Waterloo.
Double click Cygwin icon to launch it.
To change the font size right click the top bar and select Options…
Choose Text > Select…
I like Segoe UI Mono with size 16.
Let’s create a simple Java program to showcase working under Cygwin.
Create subdirectories.
An Sheng@An-HPLaptop ~
$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)An Sheng@An-HPLaptop ~
$ pwd
/home/An ShengAn Sheng@An-HPLaptop ~
$ ls -l
total 0An Sheng@An-HPLaptop ~
$ mkdir developerAn Sheng@An-HPLaptop ~
$ ls -l
total 0
drwxr-xr-x+ 1 An Sheng None 0 Jan 11 00:42 developer
An Sheng@An-HPLaptop ~/developer
$ mkdir javaAn Sheng@An-HPLaptop ~/developer
$ cd java/
Create Java source file CChess.java:
An Sheng@An-HPLaptop ~/developer/java
$ vi CChess.java
Here is the code of CChess.java:
class CChess {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Compile and run CChess.java:
An Sheng@An-HPLaptop ~/developer/java
$ javac CChess.javaAn Sheng@An-HPLaptop ~/developer/java
$ ls -l
total 2
-rwxr-xr-x 1 An Sheng None 419 Jan 11 11:53 CChess.class
-rw-r--r-- 1 An Sheng None 107 Jan 11 00:47 CChess.javaAn Sheng@An-HPLaptop ~/developer/java
$ java CChess
Hello, World!An Sheng@An-HPLaptop ~/developer/java
$
Try some other linux commands like date, cal, cat and wc -l.
$ date
Sun, Jan 12, 2020 5:16:01 PMAn Sheng@An-HPLaptop ~
$ cal
January 2020
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31An Sheng@An-HPLaptop ~
$ cat developer/java/CChess.java
class CChess {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}An Sheng@An-HPLaptop ~
$ wc -l developer/java/CChess.java
6 developer/java/CChess.javaAn Sheng@An-HPLaptop ~
$