java ѹËõÓë½âѹ
½üÀ´ÔÚ×öJAVAʱÓõ½ÎļþµÄѹËõÓë½âѹ,ÆäÖÐÅöµ½Á˸öÎÊÌâ:ÏÈÓÃJAVA´úÂë´ò°üºÃµÄJARÎļþ¾¹ýC#µÄzlib´¦Àíºó,¾¹È»²»ÄÜÐÞ¸Ä!
ÍøÉÏÕÒÁ˺ÃЩ´úÂ붼²»¿ÉÐÐ,JAVA´´½¨µÄJAR°üÔÚÐ޸ĵÄʱºò¿ÉÒÔ·¢ÏÖ¿ªÊ¼Óиö·¾¶·û'/'»ò'\',ËäÈ»ÔÚ´Ë¿ÉÒÔÐÞ¸ÄJARÎļþ,µ«ÊÇ×ܾõµÃÒþ»¼³öÔÚÕâ,ºóÀ´µÄÊÂʵҲ֤Ã÷ÁËÕâµã.²»¹ý»¹ºÃ,ºóÀ´ÕÒµ½Á˸ö²»´íµÄ´úÂë,±ÜÃâÁË´ËÏÖÏóµÄ·¢Éú.ÌùÉÏ´úÂë.
import java.io.*;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.*;
public class Zip {
/**
* ѹËõÎļþ¼Ð
* @param baseDir ´ýѹËõĿ¼
* @param output ѹËõÎļþÃû
*/
public static void CreateZip(String baseDir, String output) {
ZipOutputStream zos = null;
try {
List fileList = getSubFiles(new File(baseDir));
zos = new ZipOutputStream(new FileOutputStream(output));
ZipEntry ze = null;
byte[] buf = new byte[1024];
int readLen = 0;
for (int i = 0; i < fileList.size(); i++) {
File f = (File) fileList.get(i);
//´´½¨Ò»¸öZipEntry£¬²¢ÉèÖÃNameºÍÆäËüµÄһЩÊôÐÔ
ze = new ZipEntry(getAbsFileName(baseDir, f));
ze.setSize(f.length());
ze.setTime(f.lastModified());
//½«ZipEntry¼Óµ½zosÖУ¬ÔÙдÈëʵ¼ÊµÄÎļþÄÚÈÝ
zos.putNextEntry(ze);
InputStream is = new BufferedInputStream(new FileInputStream(f));
while ((readLen = is.read(buf, 0, 1024)) != -1) {
zos.write(buf, 0, readLen);
}
is.close();
}
zos.close();
} catch (Exception ex) {
Logger.getLogger(Zip.class.getName()).log(Level.SEVERE, null, ex);
} finally {
try {
zos.close();
} catch (IOException ex) {
Logger.getLogger(Zip.class.getName()).log(Level.SEVERE, null, ex);
}
Ïà¹ØÎĵµ£º
public class FindPrime {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int num = 100;
String s = "100ÒÔÄÚµÄËØÊý£º";
for (int i = 1; i <= num; i++) {
int count = 0;
for (int j = 1; j <= (int) Math.s ......
/**
* this¹Ø¼ü×ÖÓ÷¨
*/
public class Flower {
int petalCount = 0;
String s = "initial value";
Flower(int petals){
petalCount = petals;
System.out.println("Constructor with one int arg");
}
Flower(String ss){
System.out.println("Constr ......
JAVA¿ÉÒÔͨ¹ýJNI½Ó¿Ú·ÃÎʱ¾µØµÄ¶¯Ì¬Á¬½Ó¿â£¬´Ó¶øÀ©Õ¹JAVAµÄ¹¦ÄÜ¡£Ê¹ÓÃJAVA JNI½Ó¿ÚÖ÷Òª°üÀ¨ÒÔϲ½Ö裺
(1)±àдJAVA´úÂ룬עÃ÷Òª·ÃÎʵı¾µØ¶¯Ì¬Á¬½Ó¿âºÍ±¾µØ·½·¨£»
(2)±àÒëJAVA´úÂëµÃµ½.classÎļþ£»
(3)ʹÓÃjavah -jni Éú³É¸ÃÀà¶ÔÓ¦µÄCÓïÑÔ.hÎļþ£»
(4)ʹÓÃC/C++ʵÏÖ£¨3£©Éú³ÉµÄ.hÎļþÖÐÉùÃ÷µÄ¸÷º¯Êý£»
(5)±àÒëC/ ......
synchronizedµÄÒ»¸ö¼òµ¥Àý×Ó
public class TextThread
{
/**
* @param args
*/
public static void main(String[] args)
{
// TODO ×Ô¶¯Éú³É·½·¨´æ¸ù
TxtThread tt = new TxtThread();
  ......
תÔØ×Ôhttp://blog.csdn.net/yuekun1172006/archive/2007/06/02/1634878.aspx
Àà×°ÈëÆ÷ÊÇ JVM ÓÃÀ´×°ÈëÀàµÄÀ࣬Ëü¶ÔÓÚ Java ±à³ÌÊǷdz£ÖØÒªµÄÒ»¸ö¸ÅÄî¡£Ò»°ãÇé¿öÏ£¬³ÌÐòÔ±ÔÚ±àд³ÌÐòµÄʱºò¶¼¿ÉÒÔºöÂÔÀà×°ÈëÆ÷µÄ´æÔÚÐÔ¡£µ«ÊǶÔÓÚ·þÎñÆ÷¶Ë±à³Ì»òÕßÊÇһЩÌØÊâÇé¿öÏÂʱºò£¬ÉîÈëÁ˽âÀà×°ÈëÆ÷µÄ»úÖÆÒÔ¼°ÆäÔÚ²»Í¬Çé¿öϵ ......