軟件是對質量的不懈追求

          2010年8月5日 #

          linux du 查看文件夾占用空間


          du -sh *

          posted @ 2011-04-15 08:39 BlakeSu 閱讀(286) | 評論 (0)編輯 收藏

          Building Standalone Application with Maven2

          If you are building standalone application in Java, Maven is your friend when packing your application,
          There are two way to let Maven package your application, either as a single jar with all your dependencies jar.


           <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
             <descriptorRefs>
              <descriptorRef>jar-with-dependencies</descriptorRef>
             </descriptorRefs>
            </configuration>
           </plugin>



          One advantage if you choose to do this way is if you need to sign your application jar.
          This is needed if you are building a Java Web Start client and you need more access than connecting back to the server.
          To read more about have Maven signing your jar read http://maven.apache.org/plugins/maven-jar-plugin/usage.html.
          But if you choose to go this way, make sure that all license agreement are shipped with your one single jar.

          Another way is to let Maven package your source code only and then referring the dependent jar file from the MANIFEST file.


           <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
             <archive>
              <manifest>
               <addClasspath>true</addClasspath>
               <mainClass>se.msc.adapter.Main</mainClass>
               <classpathPrefix>lib/</classpathPrefix>
              </manifest>
             </archive>
            </configuration>
           </plugin>

          posted @ 2011-02-24 13:03 BlakeSu 閱讀(335) | 評論 (0)編輯 收藏

          eclipse 終于有了列編輯功能

          eclipse 3.5之后終于有了列編輯,快捷鍵是alt+shift+a,再次按此快捷鍵返回常規編輯狀態。


          posted @ 2010-10-15 11:33 BlakeSu 閱讀(1491) | 評論 (0)編輯 收藏

          LineNumberReader 指定文件編碼


          import java.io.FileInputStream;
          import java.io.IOException;
          import java.io.InputStreamReader;
          import java.io.LineNumberReader;


          public class Main {
              
              
          public static void main(String[] args) throws IOException {

                  InputStreamReader isr 
          = new InputStreamReader(new FileInputStream("15370720.pdf4"), "utf-16");
                  LineNumberReader lnr
          =new LineNumberReader(isr);
                  String line 
          = null;
                  
          while((line=lnr.readLine())!=null){  
                     System.out.println(lnr.getLineNumber()
          +"\t"+line);
                  }
             }
          }

          posted @ 2010-08-05 09:13 BlakeSu 閱讀(1062) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 叶城县| 开江县| 武隆县| 阳城县| 鄯善县| 广州市| 汉阴县| 北宁市| 万安县| 镇雄县| 庄浪县| 大厂| 伊宁县| 博客| 和静县| 宜宾市| 长岛县| 长治市| 苗栗县| 万州区| 灵璧县| 宣威市| 华宁县| 逊克县| 西乡县| 开原市| 宁河县| 溆浦县| 磴口县| 滕州市| 石景山区| 岫岩| 合肥市| 子洲县| 博客| 布尔津县| 华安县| 伊川县| 鄱阳县| 赣榆县| 宜宾县|