20165235 Java first Week learning summary
- Installation and use of Git under Ubuntu
- First Ubuntu under the installation of Git, use to
sudo apt-get install git
download Ubuntu, after the download is complete can be viewed with instructions git
.
- After installing Git, enter
git config --global user.name "名字"
git config --global user.email "你的邮箱地址"
. After the configuration is complete, you need to create a public key for verification, which is detailed in the installation and use of Git under Ubuntu.
- Then create the 20165235/20165235csapp2e/file directory on Ubuntu, enter the code,
mkdir 20165235
cd 20165235
mkdir 20165235CSAPP2E
where 20165235csapp2e can choose not to build. Create the bin and src folders under the 20165235CSAPP2E directory.
- Then use VIM or atom to write code on the building material. Vim Download the command
sudo apt get install vim
or download atom, enter sudo add-apt-respository ppa:webupd8team/atom
, sudo apt-get update
and sudo apt-get install atom
complete the download atom. Vim usage is detailed in Linux under the Vim command. Use Vim, enter vim 文件名.java
, and enter the code. Then press :wq!
save and eject. It is then entered in the SRC directory javac Hello.java
, Java Hello
compiled and run, and then can be seen in SRC and then by javac -d bin src/Hello.java
putting Hello.class in the bin directory, then, cd bin
java Hello
cd ..
to run Hello.class and ensure that the working directory is the project root directory as follows:. Then return to the 20165235CSAPP2E directory, first use the git init
instructions to initialize a git repository, then enter git add .
the Add file, input git commit -m "注释"
submitted to the warehouse. Input git remote add origin https://gitee.com/用户名/项目名
, and then git push origin master
push to finish. Error may not succeed, then you can use the force push git push -f origin master
to enter the code cloud account name and password, complete
- Compile and run we can
vim run.sh
simplify by writing a script, such as open vim on the action, enter the code
#!/bin/shjavac -d bin src/Hello.javacd binjava Hellocd ..
Then you chmod +x run.sh
add the Execute permission to the script and enter it last ./run.sh
. You can then write a script to vim statistics.sh
enter the following code
#!/bin/shclearecho "//==========today=====================================" echo "Code summary infomation:" Find. -name "*.java"-mtime 0 | Xargs Cat | Grep-v ^$ | Wc-l echo "Documents summary infomation:" Find. -name "*.md"-mtime 0 | Xargs Cat | Grep-v ^$ | Wc-l echo "echo"//==========this week================================= "echo" Code summary infomation: "Find. -name "*.java"-mtime-7| Xargs Cat | Grep-v ^$ | Wc-l echo "Documents summary infomation:" Find. -name "*.md"-mtime-7| Xargs Cat | Grep-v ^$ | wc-l git log--pretty=format: "%h-%an,%ci:%s" | grep ' Date +%f--date= '-0 days ' git log--pretty=format: '%h-%an,%ci:%s ' | grep ' Date +%f--date= '-1 days ' git log--pretty=format: '%h-%an,%ci:%s ' | grep ' Date +%f--date= '-2 days ' git log--pretty=format: '%h-%an,%ci:%s ' | grep ' Date +%f--date= '-3 days ' git log--pretty=format: '%h-%an,%ci:%s ' | grep ' Date +%f--date= '-4 days ' git log--pretty=format: '%h-%an,%ci:%s ' | grep ' Date +%f--date= '-5 DAys "' Git log--pretty=format:"%h-%an,%ci:%s "| grep ' Date +%f--date= '-6 days "echo" "echo" "echo"//==========all================================= "echo" Code summary Infomation: "Find." -name "*.java" | Xargs Cat | Grep-v ^$ | Wc-l echo "Documents summary infomation:" Find. -name "*.md" | Xargs Cat | Grep-v ^$ | Wc-l echo "Commit history:" Git log--pretty=format: "%h-%an,%ci:%s"
Run as:.
You can then repeat the above push steps and view them in the code cloud.
- The above is the process that I learned this week to download the unbuntu using git and write Java code and compile the code. Problems encountered 1. You cannot use Git to push code
git push origin master
. WORKAROUND: Force push, git push -f originmaster
. Problem 2: Compile times error on file. Workaround: Change the suffix. txt to. java.
- Textbook Summary: The Java language is platform agnostic and can be cross-platform. The Java Development application has the following steps 1. Writing the source file. 2. Compiling 3. Run this chapter is mainly the installation and use of JDK1.8 in WinDOS environment, and debugging environment variables.
- The following articles are for reference
- Use the Code cloud and blog Park to learn a simple tutorial
- Code-driven programming learning which has Git's installation tutorials and git usage.
- Ubuntu/linux Mint Installation Editor Atom tutorial has an installation tutorial for atom.
20165235 Java first Week learning summary