JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Languages on JVM » Jython  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
作者 python+JAVA開發安裝版本jython
chengjack0109





發文: 5
積分: 0
於 2010-09-30 16:52 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
目前小弟利用python+JAVA開發生物資訊方面專題:
安裝測試版本可執行如下(含下載路徑)
jython2.5.1 http://wiki.python.org/jython/InstallationInstructions
python2.7 http://www.python.org/
eclipseVersion: 3.5.0 http://www.eclipse.org/downloads/

測試程式如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import org.python.core.PyObject;
import org.python.util.PythonInterpreter;
public class test {
  /**
   * @param args
   */
  public static void main(String[] args) {
    // TODO Auto-generated method stub
     PythonInterpreter py = new PythonInterpreter();
        System.out.println("Hello, brave new world");
        
        String[] pyCode = {
          "import string",  
            "s='cat'",
            "x=string.upper(s)",
            "print x",
            "y=string.find(s,'a')",
            "print 'use list'",
            "s='spam'",
            "print s[:3]",
            "print s.find('pa')",
            "print s.replace('pa','xyz')",
            "print s.upper()",
            "line='a,bb,ccc,dddd'",
            "print line.split(',')",
 
        };
      
        for(String cmd : pyCode){
          py.exec(cmd);
        }
        
            PyObject x = py.get("x");
            PyObject y = py.get("y");
            System.out.println(x);
            System.out.println(y);
            System.out.println("hello jython,hello world");
 
  }
 
}


koji edited on 2010-09-30 16:56
reply to postreply to post
作者 Re:python+JAVA開發安裝版本jython [Re:chengjack0109]
Duncan

還隱隱作痛

版主

發文: 7816
積分: 39
於 2010-09-30 17:17 user profilesend a private message to usersend email to Duncanreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
chengjack0109 wrote:
目前小弟利用python+JAVA開發生物資訊方面專題:
安裝測試版本可執行如下(含下載路徑)
jython2.5.1 http://wiki.python.org/jython/InstallationInstructions
python2.7 http://www.python.org/
eclipseVersion: 3.5.0 http://www.eclipse.org/downloads/


不曉得你是如何應用 Python + Java?

就你的測試碼來看,你只需要 Jython 就夠了(不需要裝 CPython)。


reply to postreply to post

給我
辣味豆腐 其餘免談
» JWorld@TW »  Languages on JVM » Jython

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8