Java»·¾³ÅäÖÆ
JAVA_HOME:
C:\Java\jdk1.6.0_17
Path:
%JAVA_HOME%\bin
ClassPath:
.;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar
ÎÒÃÇÐèÒªÉèÖÃÈý¸ö»·¾³±äÁ¿£ºJAVA_HOME¡¢PATH ºÍ CLASSPATH¡£
JAVA_HOME£º¸Ã»·¾³±äÁ¿µÄÖµ¾ÍÊÇ Java ËùÔÚµÄĿ¼£¬Ò»Ð© Java °æµÄÈí¼þºÍÒ»
Щ Java µÄ¹¤¾ßÐèÒªÓõ½¸Ã±äÁ¿£¬ÉèÖà PATH ºÍ CLASSPATH µÄʱºò£¬Ò²¿ÉÒÔʹ
ÓøñäÁ¿ÒÔ·½±ãÉèÖá£
PATH£ºÖ¸¶¨Ò»¸ö·¾¶ÁÐ±í£¬ÓÃÓÚËÑË÷¿ÉÖ´ÐÐÎļþµÄ¡£Ö´ÐÐÒ»¸ö¿ÉÖ´ÐÐÎļþʱ£¬Èç
¹û¸ÃÎļþ²»ÄÜÔÚµ±Ç°Â·¾¶ÏÂÕÒµ½£¬ÔòÒÀ´ÎÑ°ÕÒ PATH ÖеÄÿһ¸ö·¾¶£¬Ö±ÖÁÕÒµ½
¡£»òÕßÕÒÍê PATH ÖеÄ·¾¶Ò²²»ÄÜÕÒµ½£¬Ôò±¨´í¡£Java µÄ±àÒëÃüÁî (javac)£¬
Ö´ÐÐÃüÁî (java) ºÍһЩ¹¤¾ßÃüÁî (javadoc, jdb µÈ) ¶¼ÔÚÆ䰲װ·¾¶ÏµÄ
bin Ŀ¼ÖС£Òò´ËÎÒÃÇÓ¦¸Ã½«¸Ã·¾¶Ìí¼Óµ½ PATH ±äÁ¿ÖС£
CLASSPATH£ºÒ²Ö¸¶¨Ò»¸ö·¾¶ÁÐ±í£¬ÊÇÓÃÓÚËÑË÷ Java ±àÒë»òÕßÔËÐÐʱÐèÒªÓõ½
µÄÀà¡£ÔÚ CLASSPATH ÁбíÖгýÁË¿ÉÒÔ°üº¬Â·¾¶Í⣬»¹¿ÉÒÔ°üº¬ .jar Îļþ¡£
Java ²éÕÒÀàʱ»á°ÑÕâ¸ö .jar Îļþµ±×÷Ò»¸öĿ¼À´½øÐвéÕÒ¡£Í¨³££¬ÎÒÃÇÐèÒª
°Ñ JDK °²×°Â·¾¶Ï嵀 jre\lib\rt.jar (Linux: jre/lib/rt.jar) °üº¬ÔÚ
CLASSPATH ÖС£
PATH ºÍ CLASSPATH ¶¼Ö¸¶¨Â·¾¶ÁÐ±í£¬ÁбíÖеĸ÷Ïî (¼´¸÷¸ö·¾¶) Ö®¼äʹÓ÷Ö
¸ô·û·Ö¸ô¡£ÔÚ Windows Ï£¬·Ö¸ô·ûÊǷֺŠ(;)£¬¶øÔÚ Linux Ï£¬·Ö¸ô·ûÊÇðºÅ
(:)¡£
Ïà¹ØÎĵµ£º
import java.util.Date;
class Dog{
private String name;
private Date birthday;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getBirthday() {
return b ......
JDBC¶ÁÈ¡Êý¾Ý¿âÔªÊý¾Ý,Éú³ÉJAVAʵÌåÀà
package com.nffish.util;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import com.nffish.c ......
1.Java ¼¯ºÏ¿ò¼Üͼ
¡¡¡¡-¼¯ºÏ½Ó¿Ú£º6¸ö½Ó¿Ú£¨¶ÌÐéÏß±íʾ£©£¬±íʾ²»Í¬¼¯ºÏÀàÐÍ£¬ÊǼ¯ºÏ¿ò¼ÜµÄ»ù´¡¡£
¡¡¡¡-³éÏóÀࣺ5¸ö³éÏóÀࣨ³¤ÐéÏß±íʾ£©£¬¶Ô¼¯ºÏ½Ó¿ÚµÄ²¿·ÖʵÏÖ¡£¿ÉÀ©Õ¹Îª×Ô¶¨Ò弯ºÏÀà¡£
¡¡¡¡-ʵÏÖÀࣺ8¸öʵÏÖÀࣨʵÏß±íʾ£©£¬¶Ô½Ó¿ÚµÄ¾ßÌåʵÏÖ¡£
¡¡¡¡2.JavaÈÝÆ÷Àà½éÉÜ
¡¡¡¡¢Ù JavaÈÝÆ÷À඼¿ÉÒÔ×Ô¶¯µØµ÷Õû×Ô¼ºµÄ³ß´ ......
ͨ¹ýjava.awt.RobotµÄcreateScreenCapture½ØÆÁ¡£
public static void captureScreen(String fileName) throws Exception {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Rectangle screenRectangle = new Rectangle(screenSize);
& ......