½«Java´úÂë´ò°üΪexeÎļþ
ÔÎÄÀ´×Ô£ºhttp://gocom.primeton.com/modules/newbb/item44444_44444.htm
1 »ù±¾ÐÅÏ¢
ͻ񻣼
ÏÖÔÚÓкܶàµÄ¹¤¾ß½«Java´úÂë´ò°üΪexeÎļþ£¬Ö´ÐÐʱ²»ÐèÒªÔÙ±àдÅú´¦ÀíÎļþ£¬»òÕßÔÚÃüÁîÐÐÊäÈ볤³¤µÄclasspathÐÅÏ¢£¬ÎªÓû§Ê¹ÓÃÌṩÁ˺ܴóµÄ·½±ã¡£ÕâÒ²ÊǺܶàÉÌÒµÈí¼þ³£³£Ê¹Óõķ½·¨¡£
×÷ÕߣºêÌì³
2 ½«Java´úÂë´ò°üΪexeÎļþ
ÏÖÔÚÓкܶàµÄ¹¤¾ß½«Java´úÂë´ò°üΪexeÎļþ£¬Ö´ÐÐʱ²»ÐèÒªÔÙ±àдÅú´¦ÀíÎļþ£¬»òÕßÔÚÃüÁîÐÐÊäÈ볤³¤µÄclasspathÐÅÏ¢£¬ÎªÓû§Ê¹ÓÃÌṩÁ˺ܴóµÄ·½±ã¡£ÕâÒ²ÊǺܶàÉÌÒµÈí¼þ³£³£Ê¹Óõķ½·¨¡£
½«Java´úÂë´ò°üΪexeÎļþ£¬Ò»°ãÐèÒªÁ½¸ö²½Ö裺
1. ±àд±¾µØ´úÂ룬´´½¨ÐéÄâ»ú£¬¼ÓÔز¢Ö´ÐÐMain Class¡£
2. ½«Java´úÂë´ò°üΪjarÎļþ£¬²¢Óë±¾µØ´úÂëexeÎļþºÏ²¢¡£
ÏÂÃæµÄ´úÂ룬»á¼ÓÔØjvm.dll£¬²¢µ÷ÓÃJNI_CreateJavaVMµ¼³öº¯Êý´´½¨JavaÐéÄâ»ú£¬µÃµ½JNIEnvÖ¸Õ룬Ȼºóµ÷ÓÃFindClass²éÕÒMain Class£¬Ö®ºóµ÷ÓÃGetStaticMethodID·½·¨µÃµ½main·½·¨£¬²¢Ö´ÐÐmain·½·¨¡£´úÂëÈçÏ£º
#include <windows.h>
#include <jni.h>
//#pragma comment( linker, "/subsystem:"console" /entry:"mainCRTStartup"" )
#pragma comment( linker, "/subsystem:"windows" /entry:"WinMainCRTStartup"" )
typedef jint (JNICALL *JNICREATEPROC)(JavaVM **, void **, void *);
bool setStream(JNIEnv *env, const char* pszFileName, const char* pszMethod);
//Æô¶¯javaÐéÄâ»ú·½·¨
//bool main(int argc,char *argv[])
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInstance,PSTR szCmdLine, int iCmdShow)
...{
//jvm¶¯Ì¬¿âµÄ·¾¶
const char szJvmPath[] = "d:\jdk1.5.0_07\jre\bin\server\jvm.dll";
Ïà¹ØÎĵµ£º
Ò»£º×¼±¸ www.savarese.org download
1. rocksaw-1.0.0-src.tar.gz
2. vserv-tcpip-0.9.2-src.tar.gz
¶þ£º±àÒëÔ´ÎļþµÃµ½jar°ü ʹÓÃAnt
1. build vserv-tcpip-0.9.2-src
ÔÚvserv-tcpip-0.9.2Ŀ¼ÏÂÃ潨һ¸ötestsĿ¼£¬È»ºóÔÚcmd´°¿ÚϽøÈë ......
ÀàµÄ³õʼ»¯ºÍ¶ÔÏó³õʼ»¯ÊÇ JVM ¹ÜÀíµÄÀàÐÍÉúÃüÖÜÆÚÖзdz£ÖØÒªµÄÁ½¸ö»·½Ú£¬Google ÁËÒ»±éÍøÂ磬ÓйØÀà×°ÔØ»úÖƵÄÎÄÕµ¹ÊDz»ÉÙ£¬È»¶øÀà³õʼ»¯ºÍ¶ÔÏó³õʼ»¯µÄÎÄÕ²¢²»¶à£¬ÌرðÊÇ´Ó×Ö½ÚÂëºÍ JVM ²ã´ÎÀ´·ÖÎöµÄÎÄÕ¸üÊÇÏÊÓÐËù¼û¡£
±¾ÎÄÖ÷Òª¶ÔÀàºÍ¶ÔÏó³õʼ»¯È«¹ý³Ì½øÐзÖÎö£¬Í¨¹ýÒ»¸öʵ¼ÊÎÊÌâÒýÈ룬½«Ô´´úÂëת»»³É JVM ×Ö½ÚÂëºó£¬ ......
Java ÓïÑÔµÄCalendar(ÈÕÀú),Date(ÈÕÆÚ), ºÍDateFormat(ÈÕÆÚ¸ñʽ)×é³ÉÁËJava±ê×¼µÄÒ»¸ö»ù±¾µ«ÊǷdz£ÖØÒªµÄ²¿·Ö. ÈÕÆÚÊÇÉÌÒµÂß¼¼ÆËãÒ»¸ö¹Ø¼üµÄ²¿·Ö. ËùÓеĿª·¢Õ߶¼Ó¦¸ÃÄܹ»¼ÆËãδÀ´µÄÈÕÆÚ, ¶¨ÖÆÈÕÆÚµÄÏÔʾ¸ñʽ, ²¢½«Îı¾Êý¾Ý½âÎö³ÉÈÕÆÚ¶ÔÏó. ÎÒÃÇдÁËÁ½ÆªÎÄÕÂ, ÕâÊǵÚһƪ, Î ......
public class FilePath {
public void Print() {
String a = this.getClass().getClassLoader().getResource(".").getPath();
String b = this.getClass().getResource("").getPath();
String c = this.getClass().getResource(" ").getPath();
&n ......