[Original] Some tips for Java development under Linux
1 How to configure environment variables: It is recommended to use non-root to log in, modify $ home / .bash_profile. Modified as follows: java_home = $ home / jre / j5sdk1.4.2_04 path = $ java_home / bin: $ PATH: $ homen / bin classpath = .: $ Java_home / lib modified, exit the terminal and re-enter. $ HOME / JRE / J2SDK1.4.2_04 is the directory of my SDK installation. $ Home is / home / login username
2 How to write compiled batch file A: If there is a file structure as follows: $ home / tree | --- src | | | - COM | | | --- OpenSource | --- Classes in src In the directory, write a build.sh file, the content is as follows: # c c screen clear
# start compile javac -d "$ home / tree / classes" COM / OPENSOURCE / *. java # end compile
3 How to set the VI to 4 spaces, and the display line number: Newly build a .vimrc file under $ h, the content is as follows SET AI SM NU TS = 4 SW = 4 Syntax ON
4 How to customize a Java template: Write a file called template.java in $ HOME, what you think. My template content is as follows: / ** * @ (#) * * Copyright 2004 OpenSource Develop Team. All rights reserved. * /// package // Imports / ** * @Author: * @version: * @see: * @since: * /
Write a CreateJavafile batch in $ home / bin, the content is as follows: #! / Bin / sh # name: CreateJavafail
CAT $ HOME / SRC / TEMPLATE.JAVA> For $ 1, enter CreateJavafile Test.java
5 How to generate a project answer: Write a file called MkProdir in $ home / bin, the content is as follows: #! / Bin / sh # name: mkprodu
CD $ HOME / SRC MKDIR $ 1 Echo "Project File Folder Created." CD $ 1 MKDIR SRC MKDIR CLASSES
Echo "Successful!" EXIT 0 is executed when you enter MkProdir Test. A TEST folder will be created under the $ home / src, there are two directorys of src and classes.