Java»·¾³µÄ´î½¨
Ê×ÏÈÎÒÃÇÓ¦¸Ã¶Ô JDK,JRE,JVM ÓÐËùÈÏÖª£¬ÏÂÃæÕâ¸öͼ¾Í¿ÉÒÔÇåÎúµÄ±íÊöËûÃǵĹØϵ£º JDK,JRE,JVM µÄ¹Øϵ Ò»¸ö¸ü¸´ÔÓµÄͼ£ºÕâÊÇ J2SE 1.5 ¾ßÌ幦ÄÜͼ±í£¬ÔÚͼµÄ×ó±ß£¬ÎÒÃÇ¿ÉÒÔÇåÎúµÄ¿´³öÄÄЩÊÇJVMµÄ·¶³ë£¬ÄÄЩÊÇJREµÄ·¶³ë£¬ÄÄЩÊÇJDKµÄ·¶³ë¡£ Java³ÌÐòµÄÖ´ÐÐÂß¼ ÏÂÃæͼÑÝʾµÄÊÇÈçºÎ´òÔìÒ»¸ö¸öÐÔ»¯µÄJavaÆô¶¯Æ÷£¬Õâ¶ÔÎÒÃÇÀí½âJavaÖ´ÐеÄÂß¼ºÜÓаïÖú¡£ÏÂͼÊÇÒÔWindow»·¾³´òÔì¸öÐÔ»¯µÄJavaÆô¶¯Æ÷µÄÀý×Ó¡£ Õâ·ùͼÀ´×Ô£º ´òÔì¸öÐÔ»¯JavaÆô¶¯Æ÷
×î³£¼ûµÄÆô¶¯Æ÷ÊÇSunÔÚJava Runtime EnvironmentµÄ/binĿ¼ÖÐÌṩµÄÆô¶¯Æ÷£¬¾ÍWindowsƽ̨¶øÑÔ£¬ËüÃÇÊÇjava.exeºÍjavaw.exe¡£Ç°ÕßÔËÐÐʱ´ò¿ªÁ½¸ö´°¿Ú£ºÒ»¸öÊǽÓÊÕSystem.out/errºÍÆô¶¯Æ÷Êä³öµÄ¿ØÖÆ̨´°¿Ú£¬ÁíÒ»¸öÊÇJava³ÌÐò±¾ÉíµÄ´°¿Ú£»javawÔËÐÐʱ²»´ò¿ª¿ØÖÆ̨´°¿Ú¡£ ÔÚJ2SE/EEƽ̨ÖУ¬ÐéÄâ»úÒÔ¶¯Ì¬¿âµÄÐÎʽʵÏÖ£¬Ò²·ÅÔÚ/binĿ¼Ï¡£¶¯Ì¬¿âµÄÃû×ÖÔÚWindowsÖÐÊÇjava.dll£¬ÔÚUnixÖÐÊÇjava.so¡£Ëùν¡°×°ÈëÐéÄâ»ú¡±£¬¾ÍÊÇָװÈëÕâ¸ö¶¯Ì¬¿â¡£ ÕÒÕâ¸ö¶¯Ì¬¿âµÄÂß¼ÊÇÒÀ´Î°´ÕÕÏÂÃæËÑË÷ÏȺó˳ÐòȥѰÕÒ£º ÏÈÕÒµ±Ç°Ä¿Â¼ÏÂÓÐûÓÐJRE ÔÙÕÒ¸¸Ä¿Â¼ÏÂÓÐûÓÐJRE ½Ó×ÅÔÚPATH·¾¶ÖÐÕÒJRE ×¢²á±íHKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\ ²é¿´CurrentVersionµÄ¼üÖµÖ¸ÏòÄĸöJRE£¨Õ⵱ȻÊÇwindowsÏÂÌØÓеġ££© Õâ²»Ïñ .Net £¬.Net ÒýÈëÁËÈ«¾ÖÓ¦Óûº´æ£¨GAC£©£¬Ò»Ì¨»ú×Ó£¬Ò»¸ö°æ±¾µÄ .Net Framework ¾ÍÖ»ÓÐÒ»Ì×£¬¾ÍÔÚGACÖУ¬²»Óÿ¼ÂÇÕâ¸öÑ°ÕÒÂß¼¡£ JRE Àà¿âµÄÑ°ÕÒ JRE×Ô´øµÄ»ù´¡Àà¿âÖ÷ÒªÊÇJRE\lib\rt.jarÕâ¸öÎļþ£¬°üÀ¨ÁËJava2ƽ̨±ê×¼°æµÄËùÓÐÀà¿â¡£ºÍJREµÄ°æ±¾Ò»Ö¡£ JREÖÐÓÉClassLoader¸ºÔð²éÕҺͼÓÔسÌÐòÒýÓõ½µÄÀà¿â£¬»ù´¡Àà¿âClassLoader»áµ½rt.jarÖÐ×Ô¶¯¼ÓÔØ£¬ÆäËüµÄÀà¿â£¬ClassLoaderÔÚ»·¾³±äÁ¿CLASSPATHÖ¸¶¨µÄ·¾¶ÖÐËÑË÷£¬°´ÕÕÏÈÀ´Ïȵ½µÄÔÔò£¬·ÅÔÚCLASSPATHÇ°ÃæµÄÀà¿âÏȱ»Ëѵ½. Java³ÌÐòÆô¶¯Ö®Ç°½¨ÒéÏÈ°ÑPATHºÍCLASSPATH»·¾³±äÁ¿ÉèºÃ¡£OSͨ¹ýPATHÀ´ÕÒJRE£¬È·¶¨»ù´¡Àà¿ârt.jarµÄλÖá£JREµÄClassLoaderͨ¹ýCLASSPATHÕÒÆäËüÀà¿â¡£ JDK µÄ°²×° È¥ http://java.sun.com/javase/downloads/index.jsp ÏÂÔØ×îа汾 JDK¡£ ÏÂÔغó°²×°¡£
Windows Ï°²×°Íê±ÏºóÐèÒªÉèÖÃÈý¸ö»·¾³±äÁ¿ JAVA_HOME Ö¸Ã÷JDK°²×°Â·¾¶£¬¾ÍÊǸղŰ²×°Ê±µÄ·¾¶C:\Program Files\Java\jdk1.6.0_19£¬´Ë·¾¶Ï°üÀ
Ïà¹ØÎĵµ£º
/**
* »ñÈ¡·þÎñÆ÷µÄwebµØÖ·
* @return
*/
private String getWebPath(){
String _tempStr = Thread.currentThread().getContextClassLoader().getResource("").toString();
_tempStr=_tempStr.substring ......
package com.test.util;
import java.sql.*;
public class ConnectDB {
private Connection conn=null;
private PreparedStatement pt=null;
private ResultSet rs=null;
private String uname="sa";
private String upwd="sa";
private String url="jdbc:microsoft:sqlserv ......
/*===================MXML´úÂë==================*/
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Button label="²âÊÔArray" click="bk()"/>
<mx:Script>
<!--[CDATA[
import mx.collection ......