Java³ÌÐò´ò°ü»ã×Ü
¹ØÓÚ½«java³ÌÐò×ö³ÉexeÎļþµÄ¼¸ÖÖ×ö·¨£¨ZT£©
¿ÉÒÔ°ÑÆÕͨµÄJava³ÌÐò×ö³ÉÕæÕýµÄexe,Ò²¾ÍÊǵ¥Ò»¸öexe¾Í¿ÉÒÔÔÚûÓа²×°JVMµÄ»úÆ÷ÉÏÔËÐС£ÕâÑùµÄ¹¤¾ß³£¼ûµÄÓÐJETºÍgcj.ǰÕßÊÇÊշѵ쬶øÇÒ×ö³öÀ´µÄexe»¹ÊÇÐèÒªÒ»¶Ñdll¡£ÍƼöʹÓÃgcj.ËûÓÐwindowsºÍLinux°æ£¬Ö±½ÓÏÂÔØzip°ü£¬²»ÐèÒª°²×°£¬ÀïÃæÓв»ÉÙÀý×Ó£¬Ò»Ð©buildµÄÅú´¦ÀíÎļþ¡£´ÓÔÀíÀ´Ëµgcj×Ô¼ºÊµÏÖÁËJVM¹æ·¶£¬Ò²¾ÍÊÇÄã±àдһ¸öHelloWorld.java,ÆäÖеÄmain·½·¨ÎªSystem.out.println("foo");
µ±Ê¹ÓÃgcj°ÑËü×ö³Éexe(´óÔ¼2M)£¬ÔËÐÐÕâ¸öexeʱ£¬»áÆô¶¯ÀïÃæµÄÒ»¸öСÐÍjvm,ÔÚÕâÉÏÃæÅÜHelloWorld¡£
Æäʵ£¬°ÑJava×ö³É´¿exeʵÔÚÊdzÔÁ¦²»Ìֺã¬ÓкܶàÏÞÖÆ£¬ÎļþÓÖ´ó¡£
ÎұȽÏÇãÏòÁí¼¸ÖÖ×ö·¨£º
. ʹÓÃInstallAnywhereµÈ¹¤¾ß£¬ÖÆ×÷Ò»¸öexeµÄ°²×°°ü
Óû§¿ÉÒÔÑ¡ÔñʹÓÃËû»úÆ÷ÉϵÄJRE»òÊÇÕâ¸ö°²×°°üÄÚµÄJREÀ´ÔËÐгÌÐò
ÕâÊǺܳ£¼ûµÄÒ»ÖÖ×ö·¨£¬ÈçJBuilder¾ÍÊÇÕâô×öµÄ¡£
ÕâÑùµÄºÃ´¦ÊDz»ÒªÇó¶Ô·½»úÆ÷ÉÏ×°ÓÐJRE£¬¶øÇÒÄãÔÀ´µÄ³ÌÐò²»ÐèÒªÈκθ͝¡£
InstallAnywhereÖÐÒ»¸öѹËõµÄJRE´ó¸ÅÊÇ8M¡£
. ÖÆ×÷³É¿ÉÖ´ÐеÄjar,Ò²¾ÍÊÇÔÚMETA-INFµÄMANIFESTÎļþÖÆ¶¨Main-Class
¿ÉÒÔͨ¹ýÃüÁîÐÐjava -jar jarfile.jarÀ´Ö´ÐУ¬windowsĬÈϵİÑ*.jarʹÓÃjavaw -jar´ò¿ª£¬ËùÒÔÓÐЩ»úÆ÷ÉÏ¿ÉÒÔÖ±½ÓË«»÷jarÔËÐС£
. ÖÆ×÷αexe,ÆäʵºÍÉÏÒ»ÖÖ×ö·¨ÊÇÒ»ÑùµÄ£¬Ö»²»¹ý×ö³Éexe,µ÷ÓÃϵͳµÄjava.exeÀ´ÔËÐÐËü£¬ÕâÑùµÄ¹¤¾ßÓÐnativeJ,exe4jµÈ
ÆäʵJava²»ÏñVB,DelphiÖ»ÊÇÒ»¸öÓïÑÔ£¬¶øÊÇÒ»¸öƽ̨¡£
jarÊÇ×î³£ÓõIJ¿Êðµ¥Ôª£¬×ö³ÉexeûʲôÒâ˼¡£
Ò»¡¢exe4j¡£
˵Ã÷£ºexe4j¿ÉÒÔ½«JarÎļþÖÆ×÷³ÉexeÎļþ£¬µ«ÐèjreÖ§³Ö£¬Ò²¿É½«JarÎļþ·ÅÔÚÍâÃæ¡£
Èí¼þÐÔÖÊ£º¹²ÏíÈí¼þ
ÏÂÔØµØÖ·£ºhttp://www.ej-technologies.com/products/exe4j/overview.html
¶þ¡¢JBuilder¡£
˵Ã÷£ºÐ°汾µÄJBuilder¿ÉÒÔÖ±½Ó°Ñ¹¤³ÌÖÆ×÷³É¸÷ϵͳµÄ¿ÉÖ´ÐÐÎļþ£¬°üÀ¨Windowsϵͳ¡£
Èí¼þÐÔÖÊ£ºÉÌÒµÈí¼þ
ÏÂÔØµØÖ·£ºÂÔ¡£ÎÒÊÇ´ÓeMuleÏÂÔØµÄ¡£
Èý¡¢NativeJ¡£
˵Ã÷£ºÓëexe4j¹¦ÄÜÀàËÆ¡£
Èí¼þÐÔÖÊ£º¹²ÏíÈí¼þ
ÏÂÔØµØÖ·£ºhttp://www.dobysoft.com/products/nativej/download.html
ËÄ¡¢Excelsior JET¡£
˵Ã÷£º¿ÉÒÔÖ±½Ó½«JavaÀàÎļþÖÆ×÷³ÉexeÎļþ£¬³ýAWTºÍSwing¼°µÚÈý·½Í¼ÐνӿÚÍâ¿É²»Ðèj
Ïà¹ØÎĵµ£º
ʱ¼ä¶¯Ì¬ÏÔʾ
1.·½·¨Ò» ÓÃTimerTask
ÀûÓÃjava.util.TimerºÍjava.util.TimerTaskÀ´×ö¶¯Ì¬¸üУ¬±Ï¾¹Ã¿´Î¸üпÉÒÔ¿´×÷ÊǼÆÊ±1Ãë·¢ÉúÒ»´Î¡£
´úÂëÈçÏ£º
import java.awt.Dimension;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Timer;
import java.util ......
¶ÔÓÚѧϰstaticÎÒÃÇÏÈÀ´¿´Á½¸öÀý×Ó£º
//Example 1 Tst.java£¬no main() method
package com.blogchina.qb2049;
public class Tst
{
static { System.out.println("111111"); }
}
ÔËÐнá¹ûΪ: 111111
Exception in thread "main" java.lang.NoSuchMethodError: main
ͬÑùµÄµÀÀí¿´µÚ¶þ ......
ÕâÊÇÒ»¸öÓÃJAVA W3C DOM ½øÐÐXML²Ù×÷µÄÀý×Ó£¬°üº¬Á˲éѯ¡¢Ôö¼Ó¡¢Ð޸ġ¢É¾³ý¡¢±£´æµÄ»ù±¾²Ù×÷¡£½ÏÍêÕûµÄÃèÊöÁËÒ»¸öXMLµÄÕû¸ö²Ù×÷Á÷³Ì¡£ÊʺϸÕÈëÃÅJAVA XML²Ù×÷µÄÅóÓѲο¼ºÍѧϰ¡£
¼ÙÉèÓÐXMLÎļþ£ºtest1.xml
<?xml version="1.0" encoding="UTF-8"?>
<books>
<book>
< ......
Java±à³ÌÄÇЩʶù52—·½·¨ÉùÃ÷
µÚÆßÕÂ ·½·¨
·½·¨µÄÀ´Ô´
·½·¨µÄ¸ÅÄîÀ´Ô´ÓÚÊýѧÉϵĺ¯Êý£¬ÔÚÊýѧÖУ¬µ±Êý¾Ý¾ßÓÐÒ»¶¨µÄ¹æÂÉʱ£¬¾ÍÊÇÓÃÒ»¸öº¯ÊýÀ´´úÂë¸ÃÊý×ֵĹæÂÉ£¬ÀýÈçf£¨n£©=nÔò´ú±í1¡¢2¡¢3¡¢……ÕâÑùµÄÒ»¸öÊýÁС£ÔÚÊýѧÉÏnÊDzÎÊý£¬¶ÔÓÚÈ·¶¨µÄnÖµÖ»ÓÐÒ»¸öf£¨n£©µÄÖµºÍËü¶ÔÓ¦
·½·¨ÊÇÒ»×éΪÁËʵÏÖÌØ¶¨¹¦Ä ......
package org.bupt.test;
import java.util.ArrayList;
class MyResource {
ArrayList<Integer> arrList= new ArrayList<Integer>();
public MyResource(ArrayList<Integer> arrList) {
this.arrList = arrList;
&nbs ......