473,508 Members | 2,079 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to connect python with java?

14 New Member
Hi..

How to connect Python with Java.
This is my Python program. i use jpype to connect Python with Java.
Code: ( text )

1.
from jpype import *
2.
startJVM("d:/Program Files/Java/jdk1.6.0/jre/bin/client/jvm.dll","-ea")
3.
jnavClass = JClass("Semantic")
4.
jnav = jnavClass()
5.
jnavClass.pilih_ayat("i go to school")
6.
shutdownJVM()



and this is my Java program.
Code: ( text )

1.
import java.text.BreakIterator;
2.
class Semantic {
3.
// native C++ method
4.
//public native void printMessage( String message );
5.
public native String printMessage( String message );
6.
// load library JNIPrintMessage into JVM
7.
static {
8.
System.loadLibrary( "JNIPrintMessage" );
9.
}
10.
public static void main(String [] args) {
11.
pilih_ayat();
12.
}
13.
public static String pilih_ayat(String n){
14.
JNIPrintWrapper wrapper = new JNIPrintWrapper();
15.
String ayat_siap = wrapper.printMessage(n);
16.
System.out.println("output >>" + ayat_siap);
17.
return n;
18.
}//end pilih ayat
19.
public Semantic(){
20.
System.out.println("Berjaya");
21.
}
22.
}//end class



How to move ("i go to school") at Python to pilih_ayat at Java. And then return ayat_siap to Python?
Any idea?
Mar 12 '08 #1
1 4331
Subsciber123
87 New Member
You might find it worth looking into Jython, a Python interpreter written in Java.
Mar 21 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

114
9691
by: Maurice LING | last post by:
This may be a dumb thing to ask, but besides the penalty for dynamic typing, is there any other real reasons that Python is slower than Java? maurice
3
17856
by: David | last post by:
Hello all, I have been trying to use the OCI driver to connect to Oracle 9i, but have been getting the following error: java.sql.SQLException: Closed Connection at...
1
10657
by: CM | last post by:
Hi, when i want connect me in my BD with a JSP (with this simple code), this exception is throw. Thank's for ur help Mathieu CODE of my JSP ---------------------
6
4121
by: Jeff Sandler | last post by:
I have a database I created in mySQL. I've been entering data every day into the database using a Java application that I wrote. The database and the Java program are on the same Win 98 SE...
30
2743
by: Stuart Turner | last post by:
Hi Everyone, I'm working hard trying to get Python 'accepted' in the organisation I work for. I'm making some good in-roads. One chap sent me the text below on his views of Python. I wondered...
5
3831
by: Ike | last post by:
Through Java, I am attempting to connect to a MySQL 4.12 server on a remote computer. I can connect fine via php. I cann connect fine via Java, through a servlet, when the servlet is on the same...
0
2599
by: sivasankarmathuraju | last post by:
Hi! I am using: Java 2 SDK 1.4.0 Standard Edition on Windows XP I have one java client application and one gateway that is in C language runing on the same machine. The server creates a...
3
2896
by: arasub | last post by:
ep 20, 2007 11:25:57 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found...
10
3378
rhitam30111985
by: rhitam30111985 | last post by:
hi all .. java/jdbc newbie here ... i cant seem to perform the most basic step for database connectivity using java . here is my code : import java.sql.*; public class connect { ...
0
7226
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7328
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7499
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4709
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1561
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.