Java µ÷Óà Windows API ¿ÉÄÜÐÔµÄʵÏÖ
ÔÚ Google ÊäÈë java call win32api µÄµÚÒ»¸ö½á¹û
http://www.jinvoke.com/calling-the-win32-api-from-java
¾ÍÊÇÎÒÐèÒªµÄ´ð°¸¡£ºÇºÇ
¿´¿´Õâ¸ö°É
java°æÈÎÎñ¹ÜÀíÆ÷
java°æ×¢²á±í±à¼Æ÷
Calling the Win32 API from Java
Ê×ÏÈ´Ó http://www.jinvoke.com/calling-the-win32-api-from-java ½« jinvokeÏÂÔØ»ØÀ´
½« jinvoke.jar ½âѹµ½ ´ÅÅÌÈÎÒâĿ¼£¬ÅäÖû·¾³±äÁ¿
Èç¹ûµ±Ç°Óû§ÖÐûÓÐ classpath »·¾³±äÁ¿ Çëн¨Ö®
ÎÒÕâÀï java °²×°Â·¾¶ÊÇ C:\Program Files\Java\jdk1.5.0_09
ÎÒÓ¦¸ÃÉèÖÃµÄµÄ classpath ÖµÊÇ
.;C:\Program Files\Java\jdk1.5.0_09\lib\tools.jar;C:\Program Files\Java\jdk1.5.0_09\lib\dt.jar
ÆäÖÐ .; ´ú±íµ±Ç°Ä¿Â¼
Æä´Î²é¿´ ϵͳȫ¾Ö±äÁ¿“ϵͳ±äÁ¿”
ÕÒµ½path
ÔÚpathÍ·´¦Ìí¼Ó .;
β²¿Ìí¼Ó;C:\Program Files\Java\jdk1.5.0_09\bin;
ÅäÖúúóһ·“È·¶¨”ºó±àдjavaÎļþ
import com.jinvoke.JInvoke;
import com.jinvoke.NativeImport;
public class HelloWindows
{
@NativeImport(library="User32")
public static native int MessageBox(int hwnd,
String text,
String caption,
int type); //windows Api MessageBoxº¯ÊýÔÐÍ
public static void main(String[]argc)
{
JInvoke.initialize();
MessageBox(0,"Thisi MessageBox is a native Win32 MessageBox",
"Hellow World",0);
}
}
½« jinvoke.jar ·Åµ½ HelloWindows.java ͬ¼¶Ä¿Â¼
ͳ¼ÆĿ¼±àдÅú´¦ÀíÎļþ compile.bat
@echo off
color 0f
javac -classpath %~dp1jinvoke.jar; %1
if %errorlevel%==0 (
echo ±àÒë³É¹¦
cd %~dp1
java -classpath %~dp1jinvoke.jar; %~n1>nul 2>nul
)
pause
°Ñ HelloWindows.java Íù complie.bat Í϶¯
Èç¹ûÄãµÄjavaÈí¼þ°üûÎÊÌâ¾Í»á³öÏÖÕâ¸ö»Ãæ
ÖÁÓÚwindows apiÄÜ×öʲô£¬ÎҾͲ»ËµÁË¡£
csdn ʾÀýÏÂÔصØÖ·
http://download.csdn.net/source/1623746
Ïà¹ØÎĵµ£º
Ò» ²åÈëÅÅÐò·¨:
˵Ã÷: ÿ´Î½«Ò»¸ö´ýÅÅÐòµÄ¼Ç¼£¬°´Æä¹Ø¼ü×Ö´óС²åÈ뵽ǰÃæÒѾÅźÃÐòµÄ×ÓÎļþÖеÄÊʵ±Î»Öã¬Ö±µ½È«²¿¼Ç¼²åÈëÍê³ÉΪֹ¡£ Java´úÂë public class InsertSorter extends Sorter { /** * from ÆðʼλÖà ......
JDK 5.0 ÖÐÔö¼ÓµÄ·ºÐÍÀàÐÍ£¬ÊÇ Java ÓïÑÔÖÐÀàÐÍ°²È«µÄÒ»´ÎÖØÒª¸Ä½ø¡£µ«ÊÇ£¬¶ÔÓÚ³õ´ÎʹÓ÷ºÐÍÀàÐ͵ÄÓû§À´Ëµ£¬·ºÐ͵ÄijЩ·½Ãæ¿´ÆðÀ´¿ÉÄܲ»ÈÝÒ×Ã÷°×£¬ÉõÖÁ·Ç³£Ææ¹Ö¡£ÔÚ±¾ÔµēJava ÀíÂÛºÍʵ¼ù”ÖУ¬Brian Goetz ·ÖÎöÁËÊø¸¿µÚÒ»´ÎʹÓ÷ºÐ͵ÄÓû§µÄ³£¼ûÏÝÚå¡£Äú¿ÉÒÔͨ¹ýÌÖÂÛÂÛ̳Óë×÷ÕߺÍÆäËû¶ÁÕß·ÖÏíÄú¶Ô±¾ÎĵĿ´·¨¡ ......
Õâ¸öѧÆÚµÄÐÅÏ¢¼ìË÷¿ÎÒª×öÒ»¸ö´óµÄ×÷Òµ£¬Æäʵ¾ÍÊÇÏ൱ÓÚÒ»¸öËÑË÷ÒýÇ棬µ«ÊÇÊÇ»ùÓÚ±¾µØÎı¾ÎļþµÄ¼ìË÷£¬²»ÐèÒª°ÇÍøÒ³£¬Ò²²»ÄÜʹÓÃLucence»òLemurµÈÇ¿´óµÄµÚÈý·½¿ªÔ´Èí¼þ£¬ÒªÈ«²¿×Ô¼ºÍê³É¡£
Ҫ˵Ë÷Òýµ¹ÊÇÊ®·Ö¼òµ¥£¬¾ÍÊǵ¹ÅŶøÒÑ£¬²¢Ã»ÓÐʲô¸´ÔÓ£¬¶øÇÒµÚÒ»°æµÄ×÷ÒµÒªÇóÖ»ÒªÒÔ×ÖΪË÷Òý¼´¿É£¬¶øÇÒ²»ÐèÒª¶Ô½á¹û½øÐÐÅÅÐòºÍ¸ßÁÁÏÔ ......
Ò»µÀÌ⣬±æJavaʵÁ¦
ÕâÀïÓÐÒ»µÀ¹ØÓÚJavaµÄ»ù´¡µÄ²»ÄÜÔÙ»ù´¡µÄÌ⣬¸÷λѧJavaµÄ¿´¿Í¿ÉÒÔ×ÁÄ¥×ÁÄ¥£¬¿´Êä³öʲô£¬ÎªÊ²Ã´¡£
Èç¹û¿´¿ÍÄÜÕýÈ·»Ø´ð¸ÃÎÊÌ⣬²¢¸ø³öÀíÓÉ£¬ËµÃ÷¿´¹Ù¶ÔJavaµÄÀí½âÒ²ÒÑ´ïµ½Ò»¶ ......
public static void getSysProp(){
Properties props = System.getProperties();
Set<Entry<Object,Object>> res = props.entrySet();
Iterator it = res.iterator();
while (it.hasNext())
{
Map.Entry e = (Map.Entry)it.next();
......