随笔-204  评论-90  文章-8  trackbacks-0
 
来自:http://www.blogjava.net/wiflish/archive/2006/07/07/46411.html

jadclips插件网站:http://jadclipse.sourceforge.net/
一、下载:
 下载插件jadclipse:根据你的eclipse版本选择:(注意eclipse的小版本即M6等,如果你的版本没有对应的,就下一个上个版本的)
  http://sourceforge.net/project/showfiles.php?group_id=40205
  
 下载Jad反编译工具:
   http://www.kpdus.com/jad.html#download,在该页中找到适合自己操作系统平台的jad下载。下载后解压,然后将解压后的jad.exe文件复制到%JAVA_HOME%\BIN目录下面(可以将jad.exe随便放到哪,只要记住路径就好,下面要用到)。
二、安装:
   方法1、直接将jadclipse_3.1.0.jar复制到%ECLIPSE_HOME%\plugins目录下。
   方法2、使用link方式安装,建立E:\eclipse3.1plugins\jadclipse3.1.0\eclipse\plugins的目录结构,将jadclipse_3.1.0.jar放到plugins目录下面(注:其中E:\eclipse3.1plugins为你自己定义的一个专门放置插件的目录)。再在%ECLIPSE_HOME%\links目录下面建立一个jadclipse3.1.0.link文件(该文件名随便取,保证后缀为.link就OK).文件里面内容为:path=E:\\eclipse3.1plugins\\jadclipse3.1.0。
   启动eclipse,打开Window->Preferences->Java->JadClipse,如果没有找到JadClipse,检查插件安装的版本是否与你安装的eclipse版本对应。我安装的eclipse是:eclipse3.1.2
三、设置参数:
   启动eclipse,打开:Window->Preferences->Java->JadClipse。
   1、Path to decompiler,这里设置反编译工具jad的全路径名,比如:%JAVA_HOME%\bin\jad.exe。
   2、Directory for temporary files,这里设置临时文件路径。
   至于Window->Preferences->Java->JadClipse目录下的Debug,Directives,Formatting,Misc目录中的参数设置,就不罗嗦。
四、安装完成后,eclipse自动将JadClipse Class File Viewer设置成class文件的缺省打开方式。如果没有默认,可以在Eclipse的Windows--> Perference-->General->Editors->File Associations中修改“*.class”默认关联的编辑器为“JadClipse Class File Viewer”。设置完成后,双击*.class文件,eclipse将自动反编译。

注: 对于存在源代码的类,它不会强行反编译,也就是说它还是会用eclipse自带的Class File Viewer查看class文件。

posted @ 2006-10-16 13:25 一凡 阅读(2409) | 评论 (6)编辑 收藏
在Spring的配制文件applicationContext.xml文件中添加以下代码:
<property name="hibernateProperties">
            
<props>
     <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory
</prop>
            
</props>
</property>
posted @ 2006-09-30 14:30 一凡 阅读(344) | 评论 (0)编辑 收藏
在Spring的配制文件applicationContext.xml文件中添加以下代码:
<property name="hibernateProperties">
            
<props>
     <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory
</prop>
            
</props>
</property>
posted @ 2006-09-30 14:30 一凡 阅读(364) | 评论 (0)编辑 收藏
java -classpath e:\ProcessImg.jar com.chinacars.processimg.ProcessImg e:\ 4 \ e:\processimg\
posted @ 2006-08-08 17:35 一凡 阅读(709) | 评论 (0)编辑 收藏

1. crontab -l 

10   4  * * * /home/jboss/statistics/daystat.sh
20   4  * * * /home/jboss/statistics/cndaystat.sh
30   4  * * * /home/jboss/statistics/cndaystatforaccount.sh
30   4   1  * * /home/jboss/statistics/monthstat.sh
40   4   1  * * /home/jboss/statistics/cnmonthstat.sh
50   4   1  * * /home/jboss/statistics/cnmonthstatforaccount.sh

2. vi daystat.sh

java -classpath /home/jboss/statistics/daystat.jar:/home/jboss/statistics/daystat/spring.jar:/home/jboss/statistics/daystat/commons-logging.jar:/home/jboss/statistics/daystat/commons-dbcp-1.2.1.jar:/home/jboss/statistics/daystat/commons-collections-3.1.jar:/home/jboss/statistics/daystat/commons-pool-1.2.jar:/home/jboss/statistics/daystat/log4j-1.2.8.jar:/home/jboss/statistics/daystat/ojdbc14.jar:. com.chinacars.wapstatistics.bo.DayStatistics
posted @ 2006-08-08 17:34 一凡 阅读(357) | 评论 (0)编辑 收藏

在oracle中调用java程序
一、helloWord
1 编写JAVA程序

create   or   replace   and  compile java source named hello  as
 
public    class  Hello   {
        static   
public   String Message(String name)   {
           
return    " Hello,  "    +   name;
       } 

 
/  

2 发布JAVA程序

create   or   replace   function  hello (name  VARCHAR2 )   return    VARCHAR2
     
as  language java name
      
'  Hello.Message (java.lang.String) return java.lang.String  '  ;
 
/  

3 使用发面的JAVA程序

select  hello( ' world! ' from  dual;
HELLO(
' world! ' )
-- -------------
Hello world!

    
二、在JAVA程序中使用SQL
1 编写JAVA程序

create   or   replace   and  compile java source named test  as
import java.sql.
* ;
import java.
text .DateFormat;
import java.
text .SimpleDateFormat;
import java.util.
* ;
import java.util.Date;

import com.ccit.wcsmp.comm.vo.daovo.MBTResultVO;
import oracle.sql.ARRAY;
import oracle.sql.ArrayDescriptor;
public  class Test
{
  static 
public  String  message(String name) {
       String sql 
=  " select  sysdate  as  dd  from  dual";
       String tmpStr 
=   null ;
       PreparedStatement pstmt 
=   null ;
       ResultSet rs 
=   null ;
       Connection conn
= null ;
        try
        {
             conn 
=  DriverManager.getConnection("jdbc: default :connection:");
             pstmt 
=  conn.prepareStatement(sql);
             rs 
=  pstmt.executeQuery();
             
             
if (rs. next ())
          tmpStr 
=  rs.getString("dd");
        
else
          tmpStr 
=  name;
         }
        catch(SQLException e)
        {
            System.err.println(e.getMessage());
        }
        finally
        {
            try
            {
                rs.
close ();
                pstmt.
close ();
                
/* if((conn!=null)||!conn.isClosed())
                    conn.close();
*/

            }
            catch(SQLException e)
            {
                System.err.println(e.getMessage());
            }
        }
       
return  tmpStr;
   }
}
/

2 发布JAVA程序

create   or   replace   function  test (name  varchar2 return   varchar2
 
as  language java name
' Test.message(java.lang.String) return java.lang.String ' ;
/

3 使用发面的JAVA程序

  select   test(  '  xx  '  )   from   dual ;

TEST( 
'  XX  '  )
 
--  ------------------------------------------------------------------------------ 
  2006   -   07   -   14     14  :  37  :  40.0  
posted @ 2006-07-14 14:54 一凡 阅读(1241) | 评论 (0)编辑 收藏
     摘要: 代码如下: package com.willpower.parsexml;import java.io.File;import java.io.FileWriter;import java.io.IOException;import java.util.Iterator;import java.util.List;import org.dom4j.Attribute;import org.do...  阅读全文
posted @ 2006-07-10 17:51 一凡 阅读(10951) | 评论 (3)编辑 收藏
1.使用FileInputStream和FileOutputStream,代码如下:sFlieName和tFileName分别为源文件(带路径)和目标文件(带路径)
try {
    
// Save as File
    FileInputStream input = new FileInputStream(new File(
            sFileName));
    FileOutputStream output 
= new FileOutputStream(
            
new File(tFileName));
    
int b;
    
while (true{
        
if (input.available() < 1024{
            
while ((b = input.read()) != -1{
                output.write(b);
            }

            
break;
        }
 else {
            input.read(buffer);
            output.write(buffer);
        }

    }

    input.close();
    output.close();
    
continue;
}
 catch (FileNotFoundException e) {
    e.printStackTrace();
}
 catch (IOException e) {
    e.printStackTrace();
}
2.使用FileChennal,本人认为这种方法在文件移动,不做别的处理时很好用,又好看,哈哈,特别是它的transferTo(),很棒啊,想了解看文档啊,sFileName和tFileName同上
try {
    
// Save as File
    FileInputStream input = new FileInputStream(sFileName);                    
    FileOutputStream output 
= new FileOutputStream(tFileName);
    FileChannel infileChannel 
= input.getChannel();   
    FileChannel outfileChannel 
= output.getChannel();   
    
long size = infileChannel.size();   
    infileChannel.transferTo(
0, size, (WritableByteChannel)outfileChannel);    
    
continue;
}
 catch (FileNotFoundException e) {
    e.printStackTrace();
}
 catch (IOException e) {
    e.printStackTrace();
}

posted @ 2006-07-05 16:21 一凡 阅读(5124) | 评论 (0)编辑 收藏
1用JAVA自带的函数
public static boolean isNumeric(String str){
  
for (int i = 0; i < str.length(); i++){
   System.out.println(str.charAt(i));
   
if (!Character.isDigit(str.charAt(i))){
    
return false;
   }
  }
  
return true;
 }

2用正则表达式
public boolean isNumeric(String str){ 
   Pattern pattern 
= Pattern.compile("[0-9]*"); 
   Matcher isNum 
= pattern.matcher(str);
   
if!isNum.matches() ){
       
return false
   } 
   
return true
posted @ 2006-07-03 15:58 一凡 阅读(1795) | 评论 (0)编辑 收藏
1.在HBM里对应CLOB型的字段为:java.sql.Clob,用MyEclipse DataExplorer生成后手动改一下即可,当然POJO也一样啊,如:
HBM:
<
hibernate-mapping> 
<class name="com.chinacars.filterdata.beans.TblWapNews2" table="TBL_WAP_NEWS2">
        
<id name="id" type="java.lang.Long">
            
<column name="ID" precision="22" scale="0" />
        
</id>
      
<property name="content" type="java.sql.Clob">
            
<column name="CONTENT" />
        
</property>

</class>
</hibernate-mapping>
POJO:
import java.sql.Clob;
public class test {
   
private Clob content;
   
}

2.首先要给Clob里写一个值,如:注意看一下有底色的地方就明白了吧
package com.chinacars.filterdata.modidata;

import java.lang.reflect.InvocationTargetException;
import java.sql.Clob;
import java.sql.SQLException;
import java.util.List;

import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Hibernate;

import com.chinacars.filterdata.beans.TblWapNews1;
import com.chinacars.filterdata.beans.TblWapNews2;
import com.chinacars.filterdata.dao.WapNews1DAO;
import com.chinacars.filterdata.dao.WapNews2DAO;
import com.chinacars.filterdata.util.StringProcess;

public class ModiData2 {
    
private static final Log logger = LogFactory.getLog(ModiData2.class);

    
public static void main(String[] args) {

        WapNews1DAO wapNews1DAO 
= new WapNews1DAO();
        WapNews2DAO wapNews2DAO 
= new WapNews2DAO();

        TblWapNews1 news1 
= new TblWapNews1();
        TblWapNews2 news2 
= new TblWapNews2();

        List list 
= wapNews1DAO.getWapNews();
        Clob contentClob 
= null;
        String cStr 
= "1";
        String title;
        
        
for (int i = 0; i < list.size(); i++{
            logger.info(
"============The number : " + i);
            news1 
= (TblWapNews1) list.get(i);
            contentClob 
= news1.getContent();
            
try {
                PropertyUtils.copyProperties(news2, news1);
            }
 catch (IllegalAccessException e) {
                logger.error(e);
                e.printStackTrace();
            }
 catch (InvocationTargetException e) {
                logger.error(e);
                e.printStackTrace();
            }
 catch (NoSuchMethodException e) {
                logger.error(e);
                e.printStackTrace();
            }

            title 
= news1.getTitle();
            
if(title != null{
                title 
= title.replaceAll("""");
                news2.setTitle(title);
            }

            news2.setContent(Hibernate.createClob(cStr));
            
try {
                wapNews2DAO.saveWapNews(news2, StringProcess
                        .delInvalidChar(contentClob.getSubString(
1,
                                (
int) contentClob.length())));
                
            }
 catch (SQLException e) {
                logger.error(e);
                e.printStackTrace();
            }

        }


    }


}

3.开始写入这内容,最主要的是这里,我在这里卡了好久……
   主是下面红色的部分,其它的有色部分都能搜到:看下面的代码吧:^_^
package com.chinacars.filterdata.dao;

import java.io.Writer;
import java.sql.Clob;

import oracle.sql.CLOB;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.lob.SerializableClob;

import com.chinacars.filterdata.beans.TblWapNews2;

public class WapNews2DAO {
    
    
private static final Log logger = LogFactory.getLog(WapNews2DAO.class);

    
private Session oraSession;

    
private Transaction tx;

    
public boolean saveWapNews(TblWapNews2 news, String content) {
        
try {
            oraSession 
= SessionFactory.currentORASession();
            tx 
= oraSession.beginTransaction();
            oraSession.save(news);
            oraSession.flush();
            oraSession.refresh(news, LockMode.UPGRADE);
            
            
SerializableClob clob 
= (SerializableClob) news.getContent();
            Clob jClob 
= clob.getWrappedClob();
            CLOB oClob 
=
 (CLOB)jClob;
            Writer wt 
=
 oClob.getCharacterOutputStream();            
            
//byte[] bData = content.getBytes();

            wt.write(content);
            wt.close();
            oraSession.flush();
            tx.commit();
            logger.info(
"===================  INSERT OK ");
        }
 catch (Exception e) {
            
if (tx != null)
                tx.rollback();
            logger.info(
"===================  NOT INSERT ");
            logger.info(e);
            e.printStackTrace();
        }
 finally {
            oraSession.close();
        }

        
return true;
    }


}


哈哈,就写到这里了,快没车了……
有不懂的朋友,发e-mail吧!
erdosqiao@163.com
posted @ 2006-05-11 18:40 一凡 阅读(2146) | 评论 (0)编辑 收藏
仅列出标题
共21页: First 上一页 13 14 15 16 17 18 19 20 21 下一页