20165231 2017-2018-2 "Java Programming" 1th Week study Summary

Source: Internet
Author: User
Tags hosting

This week's study is some simple basic compilation of Java, anti-compilation and interpreter. Then learn to use git the upload to [email protected] for code hosting, git is a beginner, need to build a library and then remote upload code, if the establishment of failure or for various reasons can not upload a code file dragged to the code cloud upload, But inefficient. Still have to learn git , can save a lot of time.

Registration Code Cloud

Open the + + code Cloud website + +, join[email protected]


Register your account

New Project

Then install on Windows and Linuxgit

git for Windows

gitafter win+R the installation, press ENTER to start the cmd command line, enter git or click on the installation of the shortcut git bash can be run

Linux version See the following article

Writing and running Hello.java

Enter the mkdir 20XXXXXX create personal Jobs folder in the Linux terminal
20XXXXXXcreate src and two folders under Folders to bin store source code and programs. srcCreate a Java file under a folder sudo vim Hello.java , note that here without sudo, you may be prompted not to Modify permissions , then enter write code, after the completion of press ESC key after input :wq! save exit.

Then go back to the previous level folder and use the command javac -d bin src/Hello.java to place the Java source file into the folder after compiling the .class file bin

Finally java Hello run Java, run Java without the file suffix name .

git uploads[email protected]

First, verify that your system has git installed, can be viewed via git instructions, and if not, install it by typing the sudo apt-get install git command in command line mode.

Borrow from Luchomin seniors git for Linux and use

After the installation is complete git configuration, enter the instruction git config --global user.name "xxx" and git config --global user.eamil " your email address ".

After the configuration is complete, you need to create the public key for authentication, because git accesses the repository through SSH, so you need to create a validation file locally. Using the command ssh-keygen-c ' you email [email protected]'-t RSA (Note that there is no space between SSH and-keygen), the corresponding key file is established under the user directory ~/.ssh/.

After you create the public key, you need to upload it. Use the command CD ~/.SSH to enter the ~/.ssh folder, enter Gedit id_rsa.pub to open the Id_rsa.pub file, and copy all of the contents. Then visit the Http://git.oschina.net/profile Web page, click the SSH public key, the title bar can be entered at will, the public key bar to the content you just copied into the OK.

Install and configure Git to start building a. Git library, go to the command line to upload the folder, enter the git init initialization library, and then enter the git add . add all the files, and sometimes may prompt the need for permission, then add to the command before sudo .
And then entergit commit -m "(注释)"

This way we have added all the files in the project directory to the Git local repository, and this time the code hosting is only half done, because it is just the equivalent of sending the courier you want to send the package, but it has not been sent out, so we should continue to enter the following instructions

git remote add origin http://git.oschina.net/你的用户名/你的项目名.gitNote that the address after Origin is to be copied to the code cloud own project

--the picture borrowed from Hudonghui seniors

The last use git push origin master can be uploaded! If there are fetch-first and non-first-forward two kinds of errors, at present my solution, of course, is also the method of seniors pointing

git pull origin master
git push origin master

If you can't, try forcing the upload.git push -f origin master

After each upload want to add something new upload remember need to re git add git commit git push -ability, otherwise will prompt everything-to-update .

Finally wait for a while to go to the code cloud Refresh can see the uploaded things.

Summarize

Java is a more magical program language, the operation of the feeling is not as rigid as C language, the operation has not said the pleasure. Since I am not using a virtual machine, but the new version of WINDOWS10 under the sub-system installed Ubuntu, the management of the source file is very convenient even without the command to delete the files and folders under Linux. Although do not know what the drawbacks but still vigorously advocate subsystem, public computer resources do not need to allocate to make the computer smooth a lot, and do not want to be so fragile virtual machine, and then crash.

Additional: WINDOWS10 version 1709 installs Ubuntu subsystem

First open Control Panel > Programs > Program features > Turn Windows features on or off

Without a tick, and then let the reboot

Then go to Microsoft Store and the search ubuntu will have a download interface


After installation will let you enter the user name password, etc., set as usual. The interface then runs the command like a terminal in the virtual machine Ubuntu.

Due to the use of foreign sources, the update download is very slow or even unable to connect, so you have to change the source.

SOURCE Tutorial 1. Back up the original data source configuration file

Cp/etc/apt/sources.list/etc/apt/sources.list_backup

2. Edit the data source configuration file

Vi/etc/apt/sources.list

Here vi before add sudo , otherwise there is no permission to modify the source file

From + + Simple book + +

I am using the source of Tsinghua University:

# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricteddeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricteddeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricteddeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiversedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiversedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiversedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricteddeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse

Finally save the file, enter sudo apt-get update the update on the line.

20165231 2017-2018-2 "Java Programming" 1th Week study Summary

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.