??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲午夜久久久久妓女影院,久久精品国产亚洲AV高清热,亚洲国产精品综合一区在线http://m.tkk7.com/soft/<center><font color="black" size="3">专注于效? 专注于h?lt;/font><br>&nbsp;<br> <font size="5"><b>书法.JAVA BLOG</b></font></center>zh-cnTue, 13 May 2025 15:58:43 GMTTue, 13 May 2025 15:58:43 GMT60Tomcat5.5数据库连接池的配|?/title><link>http://m.tkk7.com/soft/archive/2006/11/28/83948.html</link><dc:creator>书法</dc:creator><author>书法</author><pubDate>Mon, 27 Nov 2006 19:25:00 GMT</pubDate><guid>http://m.tkk7.com/soft/archive/2006/11/28/83948.html</guid><wfw:comment>http://m.tkk7.com/soft/comments/83948.html</wfw:comment><comments>http://m.tkk7.com/soft/archive/2006/11/28/83948.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/soft/comments/commentRss/83948.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/soft/services/trackbacks/83948.html</trackback:ping><description><![CDATA[刚把5.0的配|搞定,换了5.5版本׃一样了Q试了半天结?.0的配|经验,l于搞定了,q算有成感^_^? W一步:把数据库驱动拯到Tomcat安装目录?common/lib下和你自q站的/WEB-INF/lib下(我用的mysqlQ其他一PQ? W二步:以adminw䆾q入Tomcat理界面配置用户名、密码、连接数?..   之后生成的Server.xml文g如下Q如果不想配|,你也可以直接修改后用) <!-- Example Server Configuration File --> <!-- Note that component elements are nested corresponding to their parent-child relationships with each other --> <!-- A "Server" is a singleton element that represents the entire JVM, which may contain one or more "Service" instances. The Server listens for a shutdown command on the indicated port. Note: A "Server" is not itself a "Container", so you may not define subcomponents such as "Valves" or "Loggers" at this level. --> <Server port="8005" shutdown="SHUTDOWN"> <!-- Comment these entries out to disable JMX MBeans support used for the administration web application --> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/> <!-- Global JNDI resources --> <GlobalNamingResources> <!-- Test entry for demonstration purposes --> <Environment name="simpleValue" type="java.lang.Integer" value="30"/> <!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users --> <Resource name="jdbc/mysql" type="javax.sql.DataSource" password="********" driverClassName="org.gjt.mm.mysql.Driver" maxIdle="2" maxWait="1000" username="root" url="jdbc:mysql://127.0.0.1/test" maxActive="4"/> </GlobalNamingResources> <!-- A "Service" is a collection of one or more "Connectors" that share a single "Container" (and therefore the web applications visible within that Container). Normally, that Container is an "Engine", but this is not required. Note: A "Service" is not itself a "Container", so you may not define subcomponents such as "Valves" or "Loggers" at this level. --> <!-- Define the Tomcat Stand-Alone Service --> <Service name="Catalina"> <!-- A "Connector" represents an endpoint by which requests are received and responses are returned. Each Connector passes requests on to the associated "Container" (normally an Engine) for processing. By default, a non-SSL HTTP/1.1 Connector is established on port 8080. You can also enable an SSL HTTP/1.1 Connector on port 8443 by following the instructions below and uncommenting the second Connector entry. SSL support requires the following steps (see the SSL Config HOWTO in the Tomcat 5 documentation bundle for more detailed instructions): * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or later, and put the JAR files into "$JAVA_HOME/jre/lib/ext". * Execute: %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows) $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix) with a password value of "changeit" for both the certificate and the keystore itself. By default, DNS lookups are enabled when a web application calls request.getRemoteHost(). This can have an adverse impact on performance, so you can disable it by setting the "enableLookups" attribute to "false". When DNS lookups are disabled, request.getRemoteHost() will return the String version of the IP address of the remote client. --> <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 --> <Connector port="8080" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" /> <!-- Note : To disable connection timeouts, set connectionTimeout value to 0 --> <!-- Note : To use gzip compression you could set the following properties : compression="on" compressionMinSize="2048" noCompressionUserAgents="gozilla, traviata" compressableMimeType="text/html,text/xml" --> <!-- Define a SSL HTTP/1.1 Connector on port 8443 --> <!-- <Connector port="8443" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> --> <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" /> <!-- Define a Proxied HTTP/1.1 Connector on port 8082 --> <!-- See proxy documentation for more information about using this. --> <!-- <Connector port="8082" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" acceptCount="100" connectionTimeout="20000" proxyPort="80" disableUploadTimeout="true" /> --> <!-- An Engine represents the entry point (within Catalina) that processes every request. The Engine implementation for Tomcat stand alone analyzes the HTTP headers included with the request, and passes them on to the appropriate Host (virtual host). --> <!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1"> --> <!-- Define the top level container in our container hierarchy --> <Engine name="Catalina" defaultHost="localhost"> <!-- The request dumper valve dumps useful debugging information about the request headers and cookies that were received, and the response headers and cookies that were sent, for all requests received by this instance of Tomcat. If you care only about requests to a particular virtual host, or a particular application, nest this element inside the corresponding <Host> or <Context> entry instead. For a similar mechanism that is portable to all Servlet 2.4 containers, check out the "RequestDumperFilter" Filter in the example application (the source for this filter may be found in "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters"). Request dumping is disabled by default. Uncomment the following element to enable it. --> <!-- <Valve className="org.apache.catalina.valves.RequestDumperValve"/> --> <!-- Because this Realm is here, an instance will be shared globally --> <!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> <!-- Comment out the old realm but leave here for now in case we need to go back quickly --> <!-- <Realm className="org.apache.catalina.realm.MemoryRealm" /> --> <!-- Replace the above Realm with one of the following to get a Realm stored in a database and accessed via JDBC --> <!-- <Realm className="org.apache.catalina.realm.JDBCRealm" driverName="org.gjt.mm.mysql.Driver" connectionURL="jdbc:mysql://localhost/authority" connectionName="test" connectionPassword="test" userTable="users" userNameCol="user_name" userCredCol="user_pass" userRoleTable="user_roles" roleNameCol="role_name" /> --> <!-- <Realm className="org.apache.catalina.realm.JDBCRealm" driverName="oracle.jdbc.driver.OracleDriver" connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL" connectionName="scott" connectionPassword="tiger" userTable="users" userNameCol="user_name" userCredCol="user_pass" userRoleTable="user_roles" roleNameCol="role_name" /> --> <!-- <Realm className="org.apache.catalina.realm.JDBCRealm" driverName="sun.jdbc.odbc.JdbcOdbcDriver" connectionURL="jdbc:odbc:CATALINA" userTable="users" userNameCol="user_name" userCredCol="user_pass" userRoleTable="user_roles" roleNameCol="role_name" /> --> <!-- Define the default virtual host Note: XML Schema validation will not work with Xerces 2.2. --> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <!-- Defines a cluster for this node, By defining this element, means that every manager will be changed. So when running a cluster, only make sure that you have webapps in there that need to be clustered and remove the other ones. A cluster has the following parameters: className = the fully qualified name of the cluster class name = a descriptive name for your cluster, can be anything mcastAddr = the multicast address, has to be the same for all the nodes mcastPort = the multicast port, has to be the same for all the nodes mcastBindAddr = bind the multicast socket to a specific address mcastTTL = the multicast TTL if you want to limit your broadcast mcastSoTimeout = the multicast readtimeout mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes tcpListenAddress = the listen address (bind address) for TCP cluster request on this host, in case of multiple ethernet cards. auto means that address becomes InetAddress.getLocalHost().getHostAddress() tcpListenPort = the tcp listen port tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS has a wakup bug in java.nio. Set to 0 for no timeout printToScreen = true means that managers will also print to std.out expireSessionsOnShutdown = true means that useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called. false means to replicate the session after each request. false means that replication would work for the following piece of code: (only for SimpleTcpReplicationManager) <% HashMap map = (HashMap)session.getAttribute("map"); map.put("key","value"); %> replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'. * Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication. * Synchronous means that the thread that executes the request, is also the thread the replicates the data to the other nodes, and will not return until all nodes have received the information. * Asynchronous means that there is a specific 'sender' thread for each cluster node, so the request thread will queue the replication request into a "smart" queue, and then return to the client. The "smart" queue is a queue where when a session is added to the queue, and the same session already exists in the queue from a previous request, that session will be replaced in the queue instead of replicating two requests. This almost never happens, unless there is a large network delay. --> <!-- When configuring for clustering, you also add in a valve to catch all the requests coming in, at the end of the request, the session may or may not be replicated. A session is replicated if and only if all the conditions are met: 1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND 2. a session exists (has been created) 3. the request is not trapped by the "filter" attribute The filter attribute is to filter out requests that could not modify the session, hence we don't replicate the session after the end of this request. The filter is negative, ie, anything you put in the filter, you mean to filter out, ie, no replication will be done on requests that match one of the filters. The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to. filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI ending with .gif and .js are intercepted. The deployer element can be used to deploy apps cluster wide. Currently the deployment only deploys/undeploys to working members in the cluster so no WARs are copied upons startup of a broken node. The deployer watches a directory (watchDir) for WAR files when watchEnabled="true" When a new war file is added the war gets deployed to the local instance, and then deployed to the other instances in the cluster. When a war file is deleted from the watchDir the war is undeployed locally and cluster wide --> <!-- <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster" managerClassName="org.apache.catalina.cluster.session.DeltaManager" expireSessionsOnShutdown="false" useDirtyFlag="true" notifyListenersOnReplication="true"> <Membership className="org.apache.catalina.cluster.mcast.McastService" mcastAddr="228.0.0.4" mcastPort="45564" mcastFrequency="500" mcastDropTime="3000"/> <Receiver className="org.apache.catalina.cluster.tcp.ReplicationListener" tcpListenAddress="auto" tcpListenPort="4001" tcpSelectorTimeout="100" tcpThreadCount="6"/> <Sender className="org.apache.catalina.cluster.tcp.ReplicationTransmitter" replicationMode="pooled" ackTimeout="15000"/> <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve" filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/> <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer" tempDir="/tmp/war-temp/" deployDir="/tmp/war-deploy/" watchDir="/tmp/war-listen/" watchEnabled="false"/> </Cluster> --> <!-- Normally, users must authenticate themselves to each web app individually. Uncomment the following entry if you would like a user to be authenticated the first time they encounter a resource protected by a security constraint, and then have that user identity maintained across *all* web applications contained in this virtual host. --> <!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> <!-- Access log processes all requests for this virtual host. By default, log files are created in the "logs" directory relative to $CATALINA_HOME. If you wish, you can specify a different directory with the "directory" attribute. Specify either a relative (to $CATALINA_HOME) or absolute path to the desired directory. --> <!-- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/> --> <!-- Access log processes all requests for this virtual host. By default, log files are created in the "logs" directory relative to $CATALINA_HOME. If you wish, you can specify a different directory with the "directory" attribute. Specify either a relative (to $CATALINA_HOME) or absolute path to the desired directory. This access log implementation is optimized for maximum performance, but is hardcoded to support only the "common" and "combined" patterns. --> <!-- <Valve className="org.apache.catalina.valves.FastCommonAccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/> --> <!-- Access log processes all requests for this virtual host. By default, log files are created in the "logs" directory relative to $CATALINA_HOME. If you wish, you can specify a different directory with the "directory" attribute. Specify either a relative (to $CATALINA_HOME) or absolute path to the desired directory. This access log implementation is optimized for maximum performance, but is hardcoded to support only the "common" and "combined" patterns. This valve use NIO direct Byte Buffer to asynchornously store the log. --> <!-- <Valve className="org.apache.catalina.valves.ByteBufferAccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/> --> </Host> </Engine> </Service> </Server> W三步:在Tomcat/conf/Catalina/localhost目录下徏立一个和你网站文件夹名字一LXML文g? 例如Qmyweb.xml。内容如下: <?xml version="1.0" encoding="UTF-8"?> <Context> <Resource name="jdbc/mysql" type="javax.sql.DataSource" password="********" driverClassName="org.gjt.mm.mysql.Driver" maxIdle="2" maxWait="1000" username="root" url="jdbc:mysql://127.0.0.1/test" maxActive="4"/> </Context> 注:q一步非帔R?如果没有q步׃出错,会出现org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'错误? 最后,在你自己|站?WEB-INF/web.xml文g中,d以下代码Q? <resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/mysql</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> OK。配|全部完成。现在你可以写代码测试这个数据库q接池了。如Q? DataSource ds = null; InitialContext ctx=new InitialContext(); ds=(DataSource)ctx.lookup("java:comp/env/jdbc/mysql"); Connection conn = ds.getConnection();   数据库连接对象得C? <img src ="http://m.tkk7.com/soft/aggbug/83948.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/soft/" target="_blank">书法</a> 2006-11-28 03:25 <a href="http://m.tkk7.com/soft/archive/2006/11/28/83948.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>mysql 常用操作命ohttp://m.tkk7.com/soft/archive/2006/11/24/psoft.html书法书法Fri, 24 Nov 2006 09:41:00 GMThttp://m.tkk7.com/soft/archive/2006/11/24/psoft.htmlhttp://m.tkk7.com/soft/comments/83328.htmlhttp://m.tkk7.com/soft/archive/2006/11/24/psoft.html#Feedback1http://m.tkk7.com/soft/comments/commentRss/83328.htmlhttp://m.tkk7.com/soft/services/trackbacks/83328.html 有些时候我们不得不ȝ命o行操作mysql数据?下面是笔者ȝ的常见操作命?

1.q接
  命o:  mysql -hL地址 -u用户?-p密码
  本地:q接   cmdq入mysql/bin之后, 输入mysql -uroot -p然后回R 会提CZ输入密码 接着回R卛_(如果密码为空);
  q程q接:假设q程L的IP为:222.222.212.212Q用户名为root,密码为abcdef。则键入以下命oQ?br />     mysql -h222.222.212.212  -uroot  -pabcdef

2.Ҏ据库和表的操?br />   
   查看用户拥有权限的数据库 :      show databases;(注意分号)
 
   创徏数据库test:  create database testdb;

   切换到testdb数据?       use testdb;

   删除数据库testdb: drop database testdb;

   查看当前数据库中有权限的? show tables;

   创徏表s_position,department,,depart_pos,testtable:
     create table s_position
     (
         id int not null auto_increment,
         name varchar(20) not null default  'l理',          #讑֮默认?br />         description varchar(100),
         primary key PK_positon (id)                            #讑֮主键
     );    
     create table department
     (
         id int not null auto_increment,
         name varchar(20) not null default 'pȝ?,          #讑֮默认?br />         description varchar(100),
         primary key PK_department (id)                        #讑֮主键
     );
     create table depart_pos
     (
         department_id int not null,
         position_id int not null,
         primary key PK_depart_pos (department_id,position_id)  #讑֮复和主键
     );
     create table testtable
     (
         id int not null auto_increment primary key,     #讑֮主键
         name varchar(20) not null default '无名?,  #讑֮默认?br />         department_id int not null,
         position_id int not null,
         unique (department_id,position_id)              #讑֮唯一?br />     );

   查看表testtable的结?   desc testtable;

   删除表testtable:     
        drop table testtable;       

  修改表结?操作数据(????
   .....(同sql语句,?

 3. 备䆾和恢?
   Ҏ据的备䆾和恢复命?在网上有许多U版?l笔者亲w测?下面的命令是可行Ҏ之一:
   
    备䆾数据库testdb:  
    本地:mysqldump -uroot  -pabcdef testdb>e:testdb.sql 
    q程:mysqldump -h222.222.212.212 -uroot  -pabcdef testdb>e:testdb.sql 
   q里假设数据库的用户名和密码分别是root和abcdef, 导出到额盘根目录?得到的testdb.sql是一个sql脚本Q不包括建库的语句,所以你需要手工创建数据库下次才可以导?恢复数据库testdb;
      
     恢复数据库testdb:      首先 需要创Z个空库testdb(原因如上);
     命o:  
     本地:mysql -uroot -pabcdef  testdb<e:testdb.sql    
     q程:mysql -h222.222.212.212  -uroot -pabcdef  testdb<e:testdb.sql    
     后面e:testdb.db代表本地sql文g路径,如果mysql安装在本地可以把sql文g考到mysql/bin的安装目录下,׃用写路径?


?在网上有些朋友说,mysql的安装目录必Mؓ默认目录(即c:/mysql),否则会出问题,W者也验了一下在安装d盘的效果,l果暂时没有发现什么问?,q说明有时候命令执行异常可能和安装目录无关.^_^



书法 2006-11-24 17:41 发表评论
]]>
囄~辑器的实现--ZJAVA技?/title><link>http://m.tkk7.com/soft/archive/2006/11/21/82618.html</link><dc:creator>书法</dc:creator><author>书法</author><pubDate>Tue, 21 Nov 2006 14:08:00 GMT</pubDate><guid>http://m.tkk7.com/soft/archive/2006/11/21/82618.html</guid><wfw:comment>http://m.tkk7.com/soft/comments/82618.html</wfw:comment><comments>http://m.tkk7.com/soft/archive/2006/11/21/82618.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://m.tkk7.com/soft/comments/commentRss/82618.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/soft/services/trackbacks/82618.html</trackback:ping><description><![CDATA[ <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt" align="left"> <font size="2"> <span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'"> <span style="mso-list: Ignore">一?/span> </span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">技术概q?/span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; mso-char-indent-count: 1.0"> <font size="2"> <span lang="EN-US">Java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">完全可以的实现多媒体的编辑与处理Q包括图象的处理技术(</span> <span lang="EN-US">JGraph</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q、动L术(</span> <span lang="EN-US">JFlash</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q、声韌频技术(</span> <span lang="EN-US">JMF</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q等{;</span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; mso-char-indent-count: 1.0"> <font size="2"> <span lang="EN-US">Java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对图象处理进行了很好的支持,通过</span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提供的类Q我们完全可以对图象q行各种常见的操作和变换Q?/span> </font> <font face="宋体"> <font size="2">    </font> <span lang="EN-US"> <br /> <font size="2">      <span style="mso-list: Ignore">1?/span></font> </span> <span lang="EN-US"> <font size="2">java囑Ş图象处理所用到的相关类与接口:</font> </span> </font> <font size="2">   </font> <span lang="EN-US"> <br /> <font size="2">             </font> <font face="宋体"> <font size="2">java.awt.color、java.awt.grahpics、java.awt.image、         ?br />      java.awt.image.bufferedimage?span style="mso-bidi-font-weight: bold">java.awt.image.LookupOp</span>?/font> <font size="2"> <span style="mso-bidi-font-weight: bold">     <br />      java.awt.image.ConvolveOp</span>?span style="mso-bidi-font-weight: bold">java.awt.image.AffineTransformOp</span>?br />      bufferedimageop接口及其实现cȝQ?/font> </font> <br /> </span> <br /> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -18pt; mso-list: l0 level2 lfo1; tab-stops: list 36.0pt"> <font size="2"> <span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'"> <span style="mso-list: Ignore">2?span style="FONT: 7pt 'Times New Roman'">  </span></span> </span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">囑Ş图象处理可以完成的功能:</span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 45pt"> <font size="2"> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">图象文g的打开Q浏览)与保存(支持</span> <span lang="EN-US">jpg</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/span> <span lang="EN-US">jpeg</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/span> <span lang="EN-US">gif</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/span> <span lang="EN-US">png</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">{)、放大镜操作、旋转与镜像操作、反色和其他反色、黑白色阈值处理、亮度调整、羃放显C、边~化、图形的锐化和钝化、其它功能等Q?/span> <span lang="EN-US">.</span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -18pt; mso-list: l0 level2 lfo1; tab-stops: list 36.0pt"> <font size="2"> <span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'"> <span style="mso-list: Ignore">3?span style="FONT: 7pt 'Times New Roman'">  </span></span> </span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">囑Ş图象处理应用范围及限Ӟ</span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 47.25pt; mso-char-indent-count: 4.5"> <font size="2"> <span lang="EN-US">……………?<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?><o:p></o:p></span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US"> <font size="2"> <o:p> </o:p> </font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US"> <font size="2"> <o:p> </o:p> </font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"> <font size="2"> <span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'"> <span style="mso-list: Ignore">二?/span> </span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实例演示介绍</span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <font size="2"> <span lang="EN-US">c/s<span style="mso-spacerun: yes">  </span>Demo<span style="mso-spacerun: yes">  </span></span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q?a href="http://m.tkk7.com/Files/soft/javaDrawer.rar">下蝲</a></span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q?/span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/span> <span lang="EN-US">?</span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US"> <font size="2"> <o:p> </o:p> </font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US"> <font size="2"> <o:p> </o:p> </font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"> <font size="2"> <span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'"> <span style="mso-list: Ignore">三?/span> </span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">关于使用</span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/span> <span lang="EN-US">.net</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">技术实现图片编辑的分析与比?/span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt"> <font size="2"> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">关于</span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/span> <span lang="EN-US">.net</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的争Z来没有停止过?/span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <font size="2"> <span lang="EN-US"> <span style="mso-spacerun: yes">    </span> </span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">开放性是</span> <span lang="EN-US">Java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">生命力的源泉Q它不属于一个单独的公司Q尽?/span> <span lang="EN-US">Sun</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在其中v着关键性的作用。众多世界的公司,例如</span> <span lang="EN-US">IBM</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、甲骨文?/span> <span lang="EN-US">BEA</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">{等Q都?/span> <span lang="EN-US">Java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">都给予完全的支持Q正是这P</span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的存在ƈl箋产生一pd不^凡的影响是无庸置疑的Q?/span> </font> <font size="2"> <span lang="EN-US">    <br />   <span style="mso-spacerun: yes">  </span></span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">微Y?/span> <span lang="EN-US">.NET</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">最大的特点是Ҏ上手。花上两三个月时_你就可以像模像样地当软g工程师了。相比之下,</span> <span lang="EN-US">Java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃那么Ҏ。而且Q从软g技术的深度来看Q?/span> <span lang="EN-US">.NET</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">之中有没有分布式事务处理Q这个问题仍然被许多资深的Y件h员所质疑</span> <span lang="EN-US">?</span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0"> <font size="2"> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">不过Q是同意</span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的开发框架模式及诸多优秀开源组件更有h|q是要更注重</span> <span lang="EN-US">.net</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的开发效率,q要Ҏ企业以及目自n来抉择,如果对于一个有着深厚的开发积累或者打在相当一D|间长期用的目来说Q没有采?/span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">开发^台的是一个不太合理的事情Q因Z长期看来Q新的^台系l的混合使用必然会造成一些品的不同q_的重复开发,而另一斚w因ؓ</span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">独有的设计模式框Ӟ会让一?/span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">E序的后期维护变得相当简单容易,由此看来Q它的开发成本ƈ不一定会比其它语a的开发费用要高?/span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <font size="2"> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">此前Q?/span> <span lang="EN-US">Jupitor</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">公司发布的一个报告显C,</span> <span lang="EN-US">62%</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的中企业已l采用了</span> <span lang="EN-US">.NET</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q?/span> <span lang="EN-US">36%</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的企业则采用Z</span> <span lang="EN-US">Java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/span> <span lang="EN-US">IBM   WebSphere</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">{服务^台。包括微软公司开发业务的负责人约W哥马利也曄表示Q?/span> <span lang="EN-US">Java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">未来会变成底层的编E框Ӟ没有人可以通过它赚钱,它将会变成一个普通商品。”按照他的预,明天?/span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或许q当于今天?/span> <span lang="EN-US">C</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q?/span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <font size="2"> <span lang="EN-US"> <span style="mso-spacerun: yes">    </span> </span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在图形图片的处理领域内,有许多种不同的编E方式,?/span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">技术而言Q可以直接调?/span> <span lang="EN-US">java api</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实现Q同时在</span> <span lang="EN-US">java </span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">开源社Z有不开源的lgQ从效率上考虑Q显然后者是一U更好的选择Qƈ且相信在</span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">领域内以后一定会有更多更优秀的开放性源码出玎ͼq就?/span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的活?/span> <span lang="EN-US">java</span> </font> <font size="2"> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的优势;<br /></span> <span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'"> <span style="mso-list: Ignore">四?/span> </span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">设想</span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -42pt; mso-char-indent-count: -4.0"> <font size="2"> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Ҏ</span> <span lang="EN-US">1</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q?/span> <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /?> <st1:city> <st1:place> <span lang="EN-US">Ajax</span> </st1:place> </st1:city> <span lang="EN-US">+java </span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -10.5pt; mso-char-indent-count: -1.0; mso-para-margin-left: 3.0gd"> <font size="2"> <span lang="EN-US"> <span style="mso-spacerun: yes"> </span> </span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">理由Q充分利?/span> <span lang="EN-US">Ajax</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">胖客L、无h加蝲提交数据及异步通信的特征,构造出</span> <span lang="EN-US">Internet</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">上极速处理图片及照片的体验^収ͼ从而大大减用L待页面刷新的烦恼Q客户在充分n受上|的乐趣的同时对公司的品也留下更ؓ深刻的印象?/span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -10.5pt; mso-char-indent-count: -1.0; mso-para-margin-left: 3.0gd"> <font size="2"> <span lang="EN-US"> <span style="mso-spacerun: yes">  </span> </span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">优点Q?/span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q_产品pȝ无关性、安全性、易l护升、开放性等所有优点;</span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -42pt; mso-char-indent-count: -4.0"> <font size="2"> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Ҏ</span> <span lang="EN-US">2</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q多语言q_开发模?/span> <span lang="EN-US"> <span style="mso-spacerun: yes">  </span> </span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q_实现在线~辑囄的功能而以其它语言q_Q如</span> <span lang="EN-US">.net+GAI</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q实现本地图片处理功?/span> <span lang="EN-US"> <span style="mso-spacerun: yes">  </span> </span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; mso-para-margin-left: 4.0gd"> <font size="2"> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">理由Q语a本n无所谓好不好Q它只是一个工P它们都是Z品服务的Q而品又是ؓ客户服务的,所以采用什么^台来开发品最l是用户说了,</span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的出现本w就是基?/span> <span lang="EN-US">Internet</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的,因此</span> <span lang="EN-US">B/S</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模式下采?/span> <span lang="EN-US">java</span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">技术,而以其它语言开发用h面应用程序,扬长避短Q不但可以有效减风险,而且产品开发周期也会快很多?/span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; mso-para-margin-left: 4.0gd"> <font size="2"> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">优点Q风险小Q效率高?/span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; mso-para-margin-left: 4.0gd"> <span lang="EN-US"> <span style="mso-spacerun: yes"> <font size="2">                                                               </font> </span> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; mso-para-margin-left: 4.0gd"> <span lang="EN-US"> <span style="mso-spacerun: yes"> <font size="2">                                                       </font> </span> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 288.75pt; mso-char-indent-count: 27.5; mso-para-margin-left: 4.0gd"> <font size="2"> <span lang="EN-US"> <span style="mso-spacerun: yes">                                                               copyright@  </span> </span> <span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">彭书?/span> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; mso-para-margin-left: 4.0gd"> <font size="2"> <span lang="EN-US"> <span style="mso-spacerun: yes">                                                                                     </span> </span> </font> <font size="2"> </font> </p> <font face="宋体"> </font> <img src ="http://m.tkk7.com/soft/aggbug/82618.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/soft/" target="_blank">书法</a> 2006-11-21 22:08 <a href="http://m.tkk7.com/soft/archive/2006/11/21/82618.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JNI技术在嵌入式Y件开发中的应用学习笔C?/title><link>http://m.tkk7.com/soft/archive/2006/11/13/80789.html</link><dc:creator>书法</dc:creator><author>书法</author><pubDate>Sun, 12 Nov 2006 20:25:00 GMT</pubDate><guid>http://m.tkk7.com/soft/archive/2006/11/13/80789.html</guid><wfw:comment>http://m.tkk7.com/soft/comments/80789.html</wfw:comment><comments>http://m.tkk7.com/soft/archive/2006/11/13/80789.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://m.tkk7.com/soft/comments/commentRss/80789.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/soft/services/trackbacks/80789.html</trackback:ping><description><![CDATA[ <p> <font size="2">通过前两文章的介绍Q现在给Z个JNI的HelloWrold应用例子Q用于抛砖引玉:<br /><br />步骤Q?br /><font color="#666666" size="3"><font color="#000000">       a.</font><font size="2"><font color="#000000">~写带有native声明的方法的javac?br />  <br />  b.使用javac命o~译所~写的javac?br />  <br />  c.使用javah ?jni javacd生成扩展名ؓh的头文g<br />  <br />  d.使用C/C++实现本地Ҏ<br />  <br />  e.C/C++~写的文件生成动态连接库<br />  <br />  f. q行 ok<br /></font><br /></font></font>详细介绍Q?br /><font color="#000000">      </font><font color="#000000">1) ~写javaE序Q?br />  <br />  q里以HelloWorldZ?br />  <br />  代码1Q?br />  <br />  class HelloWorld {<br />  public native void displayHelloWorld();<br />  <br />  static {<br />  System.loadLibrary("hello");<br />  }<br />  <br />  public static void main(String[] args) {<br />  new HelloWorld().displayHelloWorld();<br />  }<br />  }<br />  <br />  声明nativeҎQ如果你惛_一个方法做Z个本地方法的话,那么你就必须声明Ҏ法ؓnative的,q且不能实现。其中方法的参数和返回值在后面讲述?br />  <br />  Load动态库QSystem.loadLibrary("hello");加蝲动态库Q我们可以这L解:我们的方法displayHelloWorld()没有实现Q但是我们在下面q接用了Q所以必d使用之前对它q行初始化)q里一般是以static块进行加载的。同旉要注意的是System.loadLibrary();的参数“hello”是动态库的名字?br />  <br />  main()Ҏ<br />  <br />  2) ~译没有什么好说的?br />  <br />  javac HelloWorld.java<br />  <br />  3) 生成扩展名ؓh的头文g<br />  <br />  javah ?jni HelloWorld<br />  <br />  头文件的内容Q?br />  /* DO NOT EDIT THIS FILE - it is machine generated */<br />  #include <br />  /* Header for class HelloWorld */<br />  <br />  #ifndef _Included_HelloWorld<br />  #define _Included_HelloWorld<br />  #ifdef __cplusplus<br />  extern "C" {<br />  #endif<br />  /*<br />  * Class:   HelloWorld<br />  * Method:  displayHelloWorld<br />  * Signature: ()V<br />  */<br />  JNIEXPORT void JNICALL Java_HelloWorld_displayHelloWorld<br />  (JNIEnv *, jobject);<br />  <br />  #ifdef __cplusplus<br />  }<br />  #endif<br />  #endif<br />  <br />  Q这里我们可以这L解:q个h文g相当于我们在java里面的接口,q里声明了一个Java_HelloWorld_displayHelloWorld (JNIEnv *, jobject);ҎQ然后在我们的本地方法里面实现这个方法,也就是说我们在编写C/C++E序的时候所使用的方法名必须和这里的一_?br />  <br />  4) ~写本地Ҏ<br />  <br />  实现和由javah命o生成的头文g里面声明的方法名相同的方法?br />  <br />  代码2Q?br />  <br />  1 #include <br />  2 #include "HelloWorld.h"<br />  3 #include <br />  4 JNIEXPORT void JNICALL Java_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj)<br />  {<br />  printf("Hello world!\n");<br />  return;<br />  }<br />  <br />  注意代码2中的W?行,需要将jni.hQ该文g可以?JAVA_HOME%/include文g夹下面找刎ͼ文g引入Q因为在E序中的JNIEnv、jobject{类型都是在该头文g中定义的Q另外在W?行需要将HelloWorld.h头文件引入(我是q么理解的:相当于我们在~写javaE序的时候,实现一个接口的话需要声明才可以Q这里就是将HelloWorld.h头文仉面声明的Ҏ加以实现。当然不一定是q样Q。然后保存ؓHelloWorldImpl.cok了?br />  <br />  5) 生成动态库<br />  <br />  q里以在Windows中ؓ例,需要生成dll文g。在保存HelloWorldImpl.c文g夹下面,使用VC的编译器cl成?br />  <br />  cl -I%java_home%\include -I%java_home%\include\win32 -LD HelloWorldImp.c -Fehello.dll<br />  <br />  注意Q生成的dll文g名在选项-Fe后面配置Q这里是helloQ因为在HelloWorld.java文g中我们loadLibary的时候用的名字是hello。当然这里修改之后那里也需要修攏V另外需要将-I%java_home%\include -I%java_home%\include\win32参数加上Q因为在W四步里面编写本地方法的时候引入了jni.h文g?br />  <br />  6) q行E序<br />  <br />  java HelloWorldok了?br /></font><br />        如有问题Q欢q讨Z。^_^<br /><br /></font> </p> <img src ="http://m.tkk7.com/soft/aggbug/80789.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/soft/" target="_blank">书法</a> 2006-11-13 04:25 <a href="http://m.tkk7.com/soft/archive/2006/11/13/80789.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JNI技术在嵌入式Y件开发中的应用学习笔C?/title><link>http://m.tkk7.com/soft/archive/2006/11/13/80788.html</link><dc:creator>书法</dc:creator><author>书法</author><pubDate>Sun, 12 Nov 2006 20:16:00 GMT</pubDate><guid>http://m.tkk7.com/soft/archive/2006/11/13/80788.html</guid><wfw:comment>http://m.tkk7.com/soft/comments/80788.html</wfw:comment><comments>http://m.tkk7.com/soft/archive/2006/11/13/80788.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/soft/comments/commentRss/80788.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/soft/services/trackbacks/80788.html</trackback:ping><description><![CDATA[ <font size="2">接上Q?br />(1)~写JavacM?br />    其中Q需要JNI实现的方法应当用native关键字声明。在该类中,用SystemQ?oadLibrary()Ҏ加蝲需要的动态链接库。关键代码如下:<br />    Q/Compute.java<br />    public class Compute{<br />    public native double comp (double params);<br />    static{<br />    Q/调用动态链接库<br />    SystemQloadLibrary(“mathlib?Q?br />    }<br />    <br />(2)~译成字节代?br />    在这个过E中Q由于采用了native关键字声明,Java~译器会忽视没有代码体的JNIҎ部分?br />   <br /> (3)生成相关JNIҎ的头文g<br />    q个q程的实C般是通过利用jlavah-jni * class生成的,也可以手工生成该文gQ但是由?/font> <font size="2">Java</font> <font size="2">虚拟机是Ҏ一定的命名规范完成对JNIҎ的调用,所以手工编写头文g需要特别小心?br />    上述文g产生的头文g部分代码如下Q?br />    Q/Compute.h<br />    ;<br />    extern“C”{<br />    JNIEXPORT jdoubleJNICALL Java_Compute_comp(JNI-Env *, jobject, jdoubleArray)Q?br />    ;<br />    JNI函数名称分ؓ三部分:首先是Java关键字,供Java虚拟别;然后是调用者类名称(全限定的cdQ其中用下划U代替名U分隔符)Q最后是对应的方法名Uͼ各段名称之间用下划线分割?br />    JNI函数的参C׃部分l成Q首先是JNIEnv *,是一个指向JNIq行环境的指针;W二个参数随本地Ҏ是静态还是非静态而有所不同一一非静态本地方法的W二个参数是对对象的引用Q而静态本地方法的W二个参数是对其Javacȝ引用Q其余的参数对应通常JavaҎ的参敎ͼ参数cd需要根据一定规则进行映?/font> <p> <br /> <font size="2">    (4)~写相应Ҏ的实C?br />    在编码过E中Q需要注意变量的长度问题Q例如Java的整型变量长度ؓ32位,而C语言?6位,所以要仔细核对变量cd映射表,防止在传DE中出现问题?/font> </p> <p> <br /> <font size="2">    (5)JNI实现代码~译成动态链接库<br />    ~译q程是利用CQC++~译器实现的Q当要用生成的动态链接库Ӟ调用者类中需要显式调用该链接库?br />    l过上述处理Q基本上完成了一个包含本地化Ҏ的Javacȝ开发?/font> </p> <p align="left"> <font size="2">     3 ZJNI的嵌入式手机软g开发实?br />    下面通过一个实例来描述q用</font> <font size="2">JNI技?/font> <font size="2">在手Z操纵摄像_捕捉视频q存储图片的q程?br />    (1)zdQ状态图<br />    ?为捕捉视频ƈ存储囄的活动/状态图</font> <img style="WIDTH: 479px; HEIGHT: 603px" height="603" src="http://m.tkk7.com/images/blogjava_net/soft/17148/o_s1.jpg" width="646" /> <br /> <br />                                                                                <a title="图二" href="/images/blogjava_net/soft/17148/r_s0.jpg" target="_blank"><font color="#ff0000">点击查看原图</font></a><br /><font size="2">Ҏ?的活动/状态,具体的对应步骤如下:<br />    ①发赯程?br />    ②发hE后Q徏立文件用于存储图片?br />    ③用指针获得分配的缓冲器Q用于存储获得的帧?br />    ④将指针压栈(序列化缓冲器)。由于手机的内存较小Qؓ了防止内存泄漏,Symbian操作pȝ有一个Cleanup stack的要求,卛_使用指针Ӟ用PushL把指针压入栈中,使用完后再用Pop弹出栈.如果在中间调用导致崩溃的函数时果真出C问题Q那么Clean up stack可以通过调用该指针的析构函数回收占用的空间?br />    ⑤操U|像头Q捕捉视频,q将囑փ从摄像头端传到~冲器?br />    ⑥将摄像头内的图像流存入~冲器内Qƈ缓冲器内的{化ؓ文g,存ؓjpg格式的文Ӟ指向缓冲器的指针弹栈?br />    ⑦在q程⑥中Q如果用完了序列化的缓冲器Q则要重新序列化~冲器,以备后面使用?br />    ⑧当接收到停止视频捕捉的信号后,关闭文g?br />    ⑨流E结束?br /> <br />     (2)q用JNI</font><font size="2">技?/font><font size="2">的视频捕?br />    子功能捕捉视频的实现是由操纵摄像头、视频播?解码器准?以及建立摄像头和手机之间的连接会话三个活动组成的。其中操U|像头是通过调用底层讑֤的驱动来实现的,需要利用JNI来实玎ͼ完成的方法包括准备、徏立、删除、销毁摄像头{。视频播攄一pdq程也是通过c++代码来实现的Q除了准备、徏立、删除、销毁解码器外,q有开始、暂停、停止解码等。徏立摄像头和手Z间的q接cM建立客户端和服务器连接,视频从摄像头传到手机界面是通过多媒体会话来完成的。多媒体<br />会话的徏立、关闭、摧毁以及会话徏立后的发送、取消、读取数据等也是JNI的应用范畴?br /></font><font size="2"><br />     l语<br />    d采用UJava的h们通常反对本地化代码的使用Q认为JNI技术会影响</font><font size="2">E序</font><font size="2">的可UL性和安全性。还有一些h认ؓQ在JavaE序执行的过E中调用cQc++E序只是对过L؜合编E技术的单扩展,其实际目的是Z充分利用大量原有的cE序库?br /></font><br /><font size="2">     其实Q不必拘泥于严格的^台独立性限Ӟ因ؓ采用JNI技术只是针对一些严重媄响Java性能的代码段。该部分可能只占源程序的极少部分Q所以几乎可以不考虑该部分代码在Lq_之间UL的工作量。同Ӟ也不必过分担心类型匹配问题,完全可以控制代码不出现这U错误。此外,也不必担心安全控刉题,因ؓJava安全模型已扩展ؓ允许非系l类加蝲和调用本地方法,卛_果在JavaE序中直接调用cQc++语言产生的机器码Q该部分代码的安全性就由Java虚拟机控制?br /></font><br /><br /></p> <img src ="http://m.tkk7.com/soft/aggbug/80788.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/soft/" target="_blank">书法</a> 2006-11-13 04:16 <a href="http://m.tkk7.com/soft/archive/2006/11/13/80788.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JNI技术在嵌入式Y件开发中的应用学习笔C一http://m.tkk7.com/soft/archive/2006/11/13/posoft.html书法书法Sun, 12 Nov 2006 19:46:00 GMThttp://m.tkk7.com/soft/archive/2006/11/13/posoft.htmlhttp://m.tkk7.com/soft/comments/80787.htmlhttp://m.tkk7.com/soft/archive/2006/11/13/posoft.html#Feedback0http://m.tkk7.com/soft/comments/commentRss/80787.htmlhttp://m.tkk7.com/soft/services/trackbacks/80787.html 嵌入式系l是以应用ؓ中心、以计算机技?/font> 为基、Y件硬件可裁剪、适应应用pȝ对功能、可靠性、成本、体U、功耗严D求的专用计算机系l。嵌入式软g 的基本体pȝ构包括嵌入式实时操作pȝRTOS(RealTime operating Systerrl)、嵌入式讑֤驱动E序 、嵌入式应用E序~程接口(中间?和嵌入式应用E序?/font>


    现阶D,计算机应用的普及、互联网技术的实用以及U米微电子技术的H破Q正有力推动着21世纪的工业生产、商业活动、科学实验和家庭生活{领域自动化和信息化q程。全q程自动化品制造、大范围电子商务zd、高度协同科学实验以及现代化家居生活Qؓ嵌入式品造就了崭新而巨大的商机。除了沟通信息高速公路的交换机、\由器和调制解调器Q构机集成刉系l?CIMS)所需的数据传输系lDCS(Data Communication System)和机器h以及规模较大的家用汽车电子系l,最有量效益和时代特征的嵌入式产品应数因特|上的信息家?information appliancesQ,如网l可视电话、网l游戏机、电子商务、商务?PDA)、移动电话以及多媒体产品(如电视机盒、DVD播放机、电子阅L)?/font>


    众所周知Q“一ơ编E,到处使用”的 Java 软g概念原本是针对|上嵌入式小讑֤提出的,几经周折Q目前SUN公司已推ZJ2ME(Java 2 P1atform Micro Edition)针对信息家电的Java版本Q其技术日成熟,开始投入用。SUN公司Java虚拟?JVM)技术的有序开放,使得Java软g真正实现跨^台运行,即Java应用程序能够在带有JVM的Q何硬软gpȝ上执行。加上Java语言本n所h的安全性、可靠性和可移植性等特点Q对实现瘦n上网的信息家늭|络讑֤十分有利Q同时对嵌入式设备特别是上网讑֤软g~程技术生了很大的媄响?

   1 Java的性能问题及几U解x?br />    JavaE序也有其本w的~陷Q那是其效率问题。由于Java是一U介于解释型和编译型之间的语aQ其对内存的理是通过JVM虚拟机来实现的,同样的程序,如果用编译型语言C来实玎ͼ其运行速度一般要比Java快得多。因此,提高Java的性能显得十分重要?/font>


    q今为止Qh们ؓ提高Java的运行速度而做出的许多努力Q主要集中在E序设计的方法和模式选择斚w。但是由于算法和设计模式的优化是通用的,对Java有效的优化算法和设计模式Q对其他~译语言也基本适用Q因此不能从Ҏ上改变JavaE序与编译型语言在执行效率方面的差异?/font>


    另外QJIT(Just In TimeQ及时编?技术也是一个比较好的思想。它的基本原理是Q首先,通过Java~译器把Java源代码编译成与^台无关的二进制字节码。然后,在JavaE序真正执行之前Q系l通过JIT~译器把Java的字节码~译为本地化机器码。最后,pȝ执行本地化机器码Q不用对字节码进行解释。这样做的优ҎQ大大提高了JavaE序的性能Q羃短了加蝲E序的时_同时Q由于编译的l果q不在程序运行期间保存,因此也节U了存储I间。缺ҎQ由于JIT~译器对所有的代码都想优化Q因此同样也占用了很多时间?/font>


    动态优化技术即提前~译为机器码的技?dynamicopttmizationQahead of time technology)是提高Java性能的另一个尝试。动态优化技术充分利用了Java源码~译、字节码~译、动态编译和静态编译的技术。其输入是Java的源码或字节码。而输出是l过高度优化的可执行代码和动态库(WindoW中是Qdil文gQUNIX中是׃n?a.so文g)。其优点是能大大提高E序的性能Q缺Ҏ破坏了Java的可UL性,也对Java的安全带来了一定的隐患?/font>

     2 JNI技?/font>
    实际上,有一U通常被忽视的技术可以在很大E度上解册个难题,那就是JNI(Java Native InterfaceQJava本地化方?。图l是JNI技术实现的一般步骤?br />




点击查看原图
                    

                                                                                                                                                             



书法 2006-11-13 03:46 发表评论
]]>
վ֩ģ壺 ŮƵվ| Ѹþ| ֻ߹ۿƵ| ҳַѹۿ| 츾avһ| 16Ůڵ| ֻˬִַ̼| ŷ У԰| õ߳| һa| Ʒ˿һ| ޾Ʒ| **˹ëƬ| һѹ߹ۿ| Ǻϳͼۺ| ۺ| 100018ѷ˸| AVӰ˵| AVһAV| 99reþþƷƷ| Ƶֻ߹ۿַ| ɫվWWWĻ| þۺͼۺͼ| ִӲëƬ| 97Ƶ| aëƬ| 99޾Ʒ242| ߹ۿ˳վ| ɫ͵͵ݺۺ| ëƬ߿Ƭ˿Ƶ| þƵ99| ˿wwwƵ| ޶ۺϾþ| ޾Ʒɫ߷| ޾þþþþ| Ʒ| ޾ƷѹۿƵ| 777777| ѵĻɫվ| ŮƵѿһ| йŮר|