Let's say I want to write a poker app for Android.
It is fine to use APIs in Java. But when it comes to heavy usage of arrays, sets, combinations etc Java becomes a huge pain for me. It's much easier to code poker AI in Ruby/Python IMHO.
So the question: is there a way to use either Ruby or Python functions in Java Android Application? It should be packed in .apk of course.
UPDATE: Regarding Ruboto: As I understand from this link https://play.google.com/store/apps/details?id=org.ruboto.core&feature=more_from_developer#?t=W251bGwsMSwxLDEwMiwib3JnLnJ1Ym90by5jb3JlIl0. ruboto-core needs to be installed on device to run ruboto apps =( It's no good if I'm going to share my app on Google Play.
How about JRuby? It's an open-source implementation of Ruby on top of Java that lets you use the JDK libraries. You could embed a JRuby instance into your app and run your logic using that.
Also see Jython
Have you tried Ruboto?
It claims to run Ruby scripts in Android devices!
There's this that might help you though, scripting Layer for Android SL4A found here, Though am not sure exactly how you'd integrate it with Android SDK :)
Actually, on reading the wiki, in the FAQ and quote:
Can I use SL4A to write a real Android application or embed SL4A
scripts in my application? Yes! You can embed your script in a
(mostly) stand alone APK.
Here is python-for-android, which let you include a python distribution in your android application, the distribution could include module you want to use.
Related
I was looking for a way to possibly use a java library of my own inside of my Flutter App.
I did some research but was only able to find information about how to integrate flutter with native Java libraries on Android exclusively.
Is there a way to call on java code also from Flutter Web and/or Flutter Desktop?
I am sorry I can't provide further information to this question as I was not able to find any "lead" if not starflut (https://pub.dev/packages/starflut) - which to the 'beginner' programmer I am in Flutter might seem an overkill approach to this problem - and I'm not even sure it supports Flutter Web/Desktop as of yet.
Any help, comments or ideas would be highly appreciated
EDIT 1
As implementing Java on Flutter Web seems close to impossible (or not worth the hassle), would calling C++ libraries from Flutter Web be a possibility?
EDIT 2
To better describe my problem/situation, I'll add some context.
I need to write a library that can be accessed by multiple flutter apps (both Web and possibly Mobile, but PWA would also be ok), but also by multiple programs which don't use the flutter framework.
I considered a couple of options, but I am still quite inexperienced and I am not sure which way to go forward with:
C++ as the core of the library, and making language bindings to Dart
It seems C++ code can work on mobile, but I haven't found a way it can be run on Web as well as within Flutter
JavaScript as the core of the library, and
either accessing the library directly from Flutter Web (seems to be possible https://medium.com/flutter-community/using-javascript-code-in-flutter-web-903de54a2000 )
Though I am not sure if this solution would work also on Mobile Flutter
Using Dart itself as the core of the library
this would be the quickest option when rolling out the Flutter App(s), but it would also have the drawback that I'll need to rewrite the library in another language later on
Calling c++ from flutter web is not possible. You can, however implement whatever functionality you want in the server-side using whatever language you want and expose the functionality to flutter using whatever web API you desire. You can follow the same approach with Java, and it doesn't have to be just web. The requirement though is that whatever you're implementing has to reside on the "server" which the system can run freely. Your flutter app just "connects" to it and sends and receives messages
I am trying to develop a HTML5 plugin using NPAPI and firebreath framework. The code which needs to be used, is written in java but I need to convert it into C++. The only way i know is via JNI where i need to convert each .java file into .cpp file. However there are over 200 files in my project. Is there a better way to achieve this??
Any "simple" way would be more of a c++ question than a plugin or firebreath question. My guess is that you'd be far better off just making it an applet rather than a plugin if you want it mainly in java. There is nothing that I'm aware of that will make it easy for you to do what you want to do using FireBreath or NPAPI directly.
JNI doesn't convert Java to C++, it is a technology for calling native code (such as C or C++) from Java code. It doesn't seem relevant to your problem: Either you (manually or robotically) convert all your Java to C++ (which you can then call from Firebreath), or you keep your code in Java and run an applet (with no C/C++ code involved.)
If an applet as suggested by #taxilian isn't a good choice, why not turn your Java project into an application, and have your Firebreath plugin launch that and communicate with it? Your plugin could even download and install the Java app, for example in a temp folder. One limitation: The Java code won't have any direct access to internal browser API's, the Firebreath plugin would have to make any such calls on behalf of the Java app. How hard this all is would mainly depend on the complexity and bandwidth of communication needed between the web page and the Java code.
I currently work for a company which gave me an application implemented by a former student. They completely wrapped (even the main) an existing C++ application with SWIG.
The application was first designed to work on a desktop and now they want to make it work on an android phone.
My questions are:
Is that possible for the application to work knowing they didn't succeed to wrap all
the libraries?
Is there another way to do this?
Is it necessary to write the main in Java and call the C++ libraries?
Any idea will be welcome!
I have doubts about there is a automatic utility like SWIG will work to convert PC -> Android - Android OS have significantly different architecture.
Look at Android NDK - it is a development kit supporting the features called JNI in usual Java applications.
You can include C++ libraries in your Android applications with Android NDK. So it is the way to develop cross-platform applications.
I've done my research and narrowed this down. OK, so I am deciding on the language and and tool to use for backend (server side) of developing cloud based android applications.. I've decided on Google App Engine as my framework. As I am going to be developing on my android tablet I want a cloud based IDE. (I am going to use a native android IDE app for client side).
App Engine supports the Go Programming Language, Java and Python. As there doesn't appear to be a stable cloud IDE that supports Go, I am left with Java & Python. I've narrowed my vast list of IDEs down to:
Coderbuddy - (Designed for App Engine but Python only)
exo Cloud - (Java & Python supported)
Cloud 9 - (Java & Python supported)
I know neither language. I have to learn Java in any case for Android client side development. I understand that Python is faster to code in and so that's definately a factor but I absolutely don't want to sacrifice performance or scalability. I will be doing lots of SQL database stuff.
Finally if you think I am way off and should look in another direction please let me know. Thanks!
Edit: My background language is Delphi (Object Pascal)
My guess is that using Java you will have lots of frameworks to find solutions and I really don't think Python will offer you that.
About IDE, I don't think you should worry about it with Python, you can use SublimeText 2 or Eclipse(have to install python editor). Both work great and Python is easy to deploy.
With Java I use Eclipse but a friend is using NetBeans and it has some "shortcuts" to create things like services, for instance.
Also with Java, you'll be more familiarized because of Android so I think it is a plus, makes more sense.
You need to at least start so you can have a better idea of what is best for you.
And get ready, it will be a LOT different from Delphi ;)
I have a java project which I'm hoping to package and sell. How can I create a .msi file which will install my program on other windows computers?
If there are any tutorials, please direct me to them. I'm also using Eclipse if that has any bearing on how to create the .msi file.
Thanks
I've been using WiX extensively for creating MSI packages. It has quite a steep learning curve, but once you know what you're doing, it is very powerful. You said earlier that it needs Visual Studio installed, but I think it's just .NET 3.0, not the whole IDE.
I used this WiX tutorial when I got started, and it's got pretty much everything you need in there if you want to go down this route.
If you're after something simple, search for a tool called WixEdit on SourceForge. This has a GUI for building MSIs - it's not perfect, but pretty easy to use and produces professional results.
I'll repeat, WiX has a very steep learning curve, and if you're just after a simple way to package your application, NSIS might be easier; or, you could use the standard IExpress.exe tool built into Windows to create a self-extracting .exe (but they don't "feel" as good as an MSI).
There's nothing special about Java apps when it comes to creating MSI's other then you have to make sure you have a JVM/JRE installed just like you have to make sure the .NET framework is installed for .NET applications.
Your question is too broad to be able to answer. Implicit in your question is "What tool should I use?" and once that's decided "How do I make an MSI using this tool?"
For the first question, check out:
Windows Installer Authoring Tools for Developers
Use NSIS: http://nsis.sourceforge.net/Main_Page . It creates executable file that will do the same thing, and it is free.
If you specifically want to create an MSI package, and assuming you don't want to pay for something like InstallShield, look at Wix. http://wix.sourceforge.net/
I believe you want to look at Native Packaging, which according to this link was first introduced with JavaFX 2.2
https://netbeans.org/kb/docs/java/native_pkg.html
Since it seems to be official Netbeans docs, I imagine it is sanctioned by Oracle. Here is the counterpart for Mac for interested readers.
http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html