Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I am trying to call python method from my java file.
mypython.py
def ab():
print "i am calling"
myjava.class
public void call()
{
ab() // just want to call python method
}
I don't have any idea to do this.
When I search on google for this all info will say about jython.
and I am not using jython.
if it is possible to do without jython.
or what is the best way to call my python code in java.
You could use Thrift for example. You'd write a Python server and use a Java client to access it. Here's an example Java server & client and an example Python server & client. There's also a consistent example on the front page, which uses a C++ server and a Python client.
The basic idea is that you define the interfaces using the Thrift IDL, and it then generates language specific code for you. Thrift will deal with the remote procedure call for you.
It is not possible to call Python method in java code. You can do it only with C or C++.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have two applications running concurrently: one in Perl, and one in Java. The Perl app relies on using nfreeze to store objects in the database. If my Java app has access to that database, how can I "thaw" that object inside of the Java application?
I don't need to be able to write to that object, just read it and use it in the Java app.
Storable is specifically designed for Perl data structures. It hasn't been ported to other languages.
Instead of (or in addition to) using Storable, use XML, JSON or YAML (in no particular order).
It's that's not possible, your Java program is going to have to call a Perl script to translate the data into something more convenient.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am currently a relatively new in the field of programming, and I am helping with a friend of mine on building a social network. It is already live picxter.com. However we are looking on implementing a chat feature for our users and the owner told me I should use a Java applet as it would be best suited for our needs. However is this possible? We are not trying to make a chat site type of chat. We are trying to build a chat like Facebook.
Don't use Java for these sorts of applications! Using Java in your browser is not a very good idea in general. You could try to do it in JavaScript using AJAX (which is syntactically very similar to Java and by far not as slow, doesn't require a runtime environment and isn't as risky [you can argue about that, to be honest] in terms of security).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
I am writing one web page in which I am putting one html input type="textarea" in which user will write their java code and on submit it will return output of that java code. Can I do this using jsp? if not then what are the other ways.
I would think very carefully before allowing people to do that.
At the very least, to read and run the user's input, you will need a JDK to compile it, and a JVM to run it. Since you're talking about over the web, presumably the user's machine will not have those (otherwise they'd just use theirs), so you'd have to use the ones on your server - that is, take the user's text, upload it as a .java file to your server, compile and run it (for an anonymous user on your server!), and send the result back to the browser session.
As you can see, there are a couple of pretty big, bad security problems here. Not recommended !
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am doing my uni project to develop an android application. I have decided to develop an application that tells the user the daily times to pray for Muslims. But as I am new to android(and also programming in general) I don't know how to implement this. I have done some research myself and found that some web services provide JSON or XML files to fetch the data or there supposed to be Java Tools/Libs to use. Is there anyone who has developed or has experience in these topics.
please give some advices.
thank you
The Xhanch API returns the data to you in JSON/XML format.
If you want XML,
http://api.xhanch.com/islamic-get-prayer-time.php?lng=30&lat=30&yy=2013&mm=9&gmt=4
If you want JSON,
http://api.xhanch.com/islamic-get-prayer-time.php?lng=30&lat=30&yy=2013&mm=9&gmt=4&m=json
Check the documentation for the significance of each of the request parameters.
You can make a call to the API using KSOAP 2 library.
This is how the JSON response looks like
{"1":{"fajr":"05:16","sunrise":"06:36","zuhr":"13:00","asr":"16:34","maghrib":"19:23","isha":"20:40"},"2":{"fajr":"05:16","sunrise":"06:37","zuhr":"13:00","asr":"16:34","maghrib":"19:22","isha":"20:39"},"3":{"fajr":"05:17","sunrise":"06:38","zuhr":"13:00","asr":"16:33","maghrib":"19:21","isha":"20:38"},....
}
Once you get the data in JSON format, all you need to do is parse the information and display it in your application.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Without having to write a low-level Windows driver, but still using either Java or some C-based API, is it possible to read/write from/to a raw, unpartitioned drive... one that has got no file-system on it?
A short sample program would help. If not, at least knowing what standard Windows/Java (or, 3rd Party) API I could use in userspace (without having to write a device driver) would help.
It is possible to access a raw disk using the CreateFile() function by passing
"\\.\PhysicalDriveX"
as name.
Where X is a 0-based index counting the drives.