Java6 ½Å±¾ÒýÇæ(ÓÃJavaµ÷ÓÃJS½Å±¾)µ÷ÓÃjs
Java6 ½Å±¾ÒýÇæ(ÓÃJavaµ÷ÓÃJS½Å±¾)µ÷ÓÃjs
import java.io.FileNotFoundException;
import java.io.FileReader;
import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
public class JavaScriptEngineTest {
public static void main(String[] args) {
try {
JavaScriptEngineTest test = new JavaScriptEngineTest();
test.testAdd(5, 6);
} catch (Exception se) {
se.printStackTrace();
}
}
public String getPath() {
return this.getClass().getResource("/").getPath();
}
public void testAdd(int a, int b) {
ScriptEngineManager sem = new ScriptEngineManager();
ScriptEngine jsEngine = sem.getEngineByName("js");
try {
jsEngine.eval(new FileReader(getPath() + "JavaScriptEngineTest.js"));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (ScriptException e) {
e.printStackTrace();
&nbs
Ïà¹ØÎĵµ£º
1Ê×ÏÈÌí¼ÓÐÞ¸ÄͼƬ¿í¶ÈºÍ¸ß¶ÈµÄ·½·¨
public static void reduceImg(String imgsrc, int widthdist, int heightdist) {
try {
File srcfile = new File(imgsrc);
if (!srcfile.exists()) {
return;
}
......
ÀûÓÃJNI¼¼Êõ£¬¿ÉÒÔ×öµ½C/C++ÓëJavaÖ®¼äµÄÏ໥µ÷Óá£
1¡¢Javaµ÷ÓÃC/C++½Ó¿Ú
Õâ¸öÊÇJNI×î»ù±¾µÄÓ¦Óã¬JNIÓкܶàÕâ·½ÃæµÄÀý×Ó´úÂë¡£Ò»°ã°ÑC/C++д³É¶¯Ì¬Á´½Ó¿â£»ÔÚJava³ÌÐòÔÚLoadLibrary£¬ÀûÓÃnative½Ó¿Ú£¬¼´¿ÉÍê³Éµ÷Óá£
2¡¢C/C++»Øµ÷Java½Ó¿Ú
ÕâÖÖÓ÷¨£¬JNIµÄÀý×ӱȽÏÉÙ¡£Æäʵ£¬Ò²±È½Ï¼òµ¥£¬JNIÒ²ÌṩÁËÕâÑùµÄ½Ó¿Ú¡ ......
1¡¢¿ª·¢»·¾³£ºÔÚmyeclipse7.0ÖÐÕûºÏflex plup3.0, °²×°flex plup3.0ʱ,Ñ¡myeclipse ÖÐeclipseµÄĿ¼£¬È»
ÕÒµ½flex µÄ°²×°ºÃµÄĿ¼£¬½«pluginsºÍfeatures¶ÔÓ¦µ½¿½µ½myeclipseÀïÃæ eclipseÏàÓ¦µÄĿ¼Ï¡£
2¡¢´´½¨ flexºÍ java (Web)µÄ¹¤³Ì(ͨÐÅ¿ò¼ÜÓÃblazeds.war)£º
&nb ......
Ò»¡¢²»±äģʽ£º
Ò»¸ö×Ö·û´®¶ÔÏó´´½¨ºóËüµÄÖµ²»Äܸı䡣
String str1="hello";//´´½¨Ò»¸ö¶ÔÏóhello£¬²»»á±ä£»
System.out.println(str1);
str1+=" world!";//Á½¸ö×Ö·û´®¶ÔÏóÕ³Õ³£¬ÏµÍ³Æäʵ´´½¨ÁËÒ»¸öеĶÔÏ󣬰ÑStr1µÄÖ¸Ïò¸ÄÁË£¬Ö¸ÏòеĶÔÏó£»hello¾Í & ......