| View previous topic :: View next topic |
| Author |
Message |
bellwethr
Joined: 05 Nov 2007 Posts: 25
Digg It |
Posted: Thu Nov 22, 2007 10:16 pm Post subject: |
|
|
| It's not just the use of Java per se that would make that difficult, but the fact that there also seems to be a desire to keep this platform agnostic... |
|
| Back to top |
|
 |
SwedishFrog Site Admin

Joined: 25 Jan 2007 Posts: 273 Location: New York
Digg It |
Posted: Fri Nov 23, 2007 1:03 am Post subject: |
|
|
You're right about that. However I think that if someone wants to write a script that makes API calls from some OS, we should let them do it so that the language is flexable.
The API call would make that particular script platform dependent. but I guess that's a choice the script writer should make for themselves. |
|
| Back to top |
|
 |
bellwethr
Joined: 05 Nov 2007 Posts: 25
Digg It |
Posted: Fri Nov 23, 2007 6:01 am Post subject: |
|
|
How do you actually envision implementing that?
Calls to native functionality need to be wrapped with a JNI stub. To support any arbitrary external call, you'd effectively have to generate your JNI stub automatically and compile it--all while inside a running JVM--and then dynamically load the class into your JVM.
This should be a feature that is added on later... |
|
| Back to top |
|
 |
SwedishFrog Site Admin

Joined: 25 Jan 2007 Posts: 273 Location: New York
Digg It |
Posted: Fri Nov 23, 2007 7:45 am Post subject: |
|
|
| Yeah dude. I was only talking hypothetically. I've never implemented win32 on java and didn't really know what that entails until your post. Either way it's not very high on my priority list. |
|
| Back to top |
|
 |
Cha0s Site Admin
Joined: 17 Jan 2007 Posts: 522
Digg It |
Posted: Fri Nov 23, 2007 9:17 pm Post subject: |
|
|
bellwethr: not true. There's a much easier way to deal with this. Runtime.exec. We can just provide a sort of open access to Runtime.exec. The only issue with that is that it could create security problems. Alternatively, we could provide OS-specific access to particular functions via Runtime.exec. This would require more effort, however. In any case, it's a discussion for the future. At the moment, we need to build up the basics. _________________ Cha0s |
|
| Back to top |
|
 |
bellwethr
Joined: 05 Nov 2007 Posts: 25
Digg It |
Posted: Sat Nov 24, 2007 5:30 pm Post subject: |
|
|
Runtime.exec() is effectively a system call. You can execute an arbitrary process--this isn't the same as calling an external native API--for example, you couldn't call Win32 functions as the OP wanted. You'd have to write and compile a program around those functions, and then execute your program through the exec() call....
Additionally, you're limited to string-based parameters, and to get return values, you'd have to perform string parsing on standard output. I've done this before when I was working on developing a java wrapper around linux network utilities, but it can get pretty nasty.
Anyway, I agree that this should be something that is considered much later.
SwedishFrog: I wasn't trying to be combative, just pointing out that this was non-trivial to do right. Certainly, just offering a system call utility ala Runtime.exec would be easy, but making it useful might be difficult. I didn't mean to be rude! |
|
| Back to top |
|
 |
|