How is to run applications on Android? - java

First I'm sorry because my English language is poor.
But is my question.
How is to compile and run application written in c/c++ and under NDK on Android OS??
Does it application compiling and running in Dalvik or ART?
Or independent is that VM??
In the case of programs written in other languages, how is it?
For example (C# in Xamarin) or (Delphi in Firemonkey) or (Basic) or (Python)? Thanks a lot for my question answers.

Please, do a research.
Basically yes, almost all non native solutions use some kind of VMs. For example Xamarin use MonoVM for Android platform. The C# code is compiled into CIL, which is executed by the Mono execution environment. This execution environment is run side by side with the Java Virtual Machine, which means the applications are not executed the same as native application, however they are executed in a equivalent way. This means that the performance is tied to MonoVMs implementation.
MonoVM is packaged with the application, which means that Xamarin Platform applications can be installed in the same way as a native application, without any additional installs.

Related

How do you implement a programming environment in a workplace?

There are currently no development tools in the environment I work in. I am the only developer in the working environment. What are guidelines in implementing a programming/development working environment? (Example, what do I need to do, in order for me to create internal java applications, which may include tools, licenses, etc.)
As you are the only developer in your environment, there are a few things that are fortunate. You tagged this question with Java, so I will assume you want to work with this language.
Java itself, if not already installed. You can find Java at their website, and download the latest version on it on your machine. This will allow you to launch your Java applications outside the IDE (next point). To check if you have installed it, it is usually under your Program Files folder, most often: C:/Program Files/Java.
An IDE (Integrated development environment). There are a lot of them, but the most famous might be Eclipse. It often comes with an embedded Java version with it.
And that's it. Only the IDE would work pretty well. In pure theory, you could even do it with Java only and its compiler, but pretty much every Java developer uses an IDE. Licencing is an internal thing that you will need to implement.
By the way, I will let you read this, and flag it in five minutes. It should not be there. You should try Programmers' Stack platform for this kind of topic, which is not related to pure programming.

Lazarus Pascal on Android - performance

Although a long-time developer, I've never seriously used an Android device - let alone programming one. So I'm new to this platform.
I'm looking at Lazarus for Android and found this link that has the following lines:
LCL-CustomDrawn-Android utilizes a minimal Java application which
communicates with our Pascal library and sends all events to it and
also obeys commands from it.
This raises a bunch of question for me.
In other words, is Lazarus running on the Android like a Windows app running on Wine (for Linux)?
If Java has to get in the way, wouldn't it be faster to directly run Java code without creating Lazarus/Pascal code?
Thanks!
In other words, is Lazarus running on the Android like a Windows app
running on Wine (for Linux)?
No. While there is a light preference for Java, native is quite common on Android, and they all need to connect to OS services via a Java skeletal application.
If Java has to get in the way, wouldn't it be faster to directly
run Java code without creating Lazarus/Pascal code?
No. The code that runs is native, only GUI events trigger some minimal java overhead.
The ARM CPUs on phones can execute Java bytecode natively, it's built into their instruction set. So it doesn't need to run through an interpreter like on Windows or Linux. Java doesn't provide such a speed penalty there as everywhere else. That's not true of x86 Android but ARMs were built partly to run Java. https://en.m.wikipedia.org/wiki/Qualcomm_Snapdragon
Is Lazarus running on the Android like a Windows app running on Wine (for Linux)?
Actually, it sounds more like a Java (Swing) application running in Windows. Swing is known for drawing its own controls, rather than using the controls provided by the host operating system (OS). The only connection between Swing and the host OS (Windows, etc) is the window chrome around the application and how the host OS controls this window chrome.
If Java has to get in the way, wouldn't it be faster to directly run Java code without creating Lazarus/Pascal code?
It would be faster, as Android is natively based on Java. In fact, if you can write Android apps in Java, I recommend you to pick that as your first choice. Start here to learn the basics.
I believe the purpose of this Lazarus/Pascal library is to help run Pascal apps on Android, or otherwise help Pascal programmers write apps for Android. It may also help write apps where any limitations of Java would require the use of Pascal.
To take the analogy further, C++ and C# apps generally run faster on Windows as the OS is natively based on these languages. However, many applications are still written in Java using Swing interface for various advantages such as programmer familiarity or cross-platform availability of the app.

Java Projects on Django?

ok, So i searched net for the possible implementation but all that I managed to find is Django projects implementation on Java platform through Jython. But I want to do the reverse, i.e. implement/integrate java project ( which in my case is SAIKU server ) on Django platform.
The question being, is it possible, and if yes, then kindly point me to the solution.
Thanking in advance =)
For your specific requirement, I would suggest using RESTFul API to access the Saiku Server.
However if you need to run Java Classes from Python.
Here are the options available for you:
JCC -- a C++ code generator for calling Java from C++/Python. It produces producing Python extensions which communicate via JNI with a Java virtual machine. As it implies, this would require compilations of every possible call. However this project is backbone of PyLucene project.
CodeMesh. C++ code generator for Java.
Py4J Python programs running in a Python interpreter to dynamically access Java objects in a Java Virtual Machine.
JPype allow python programs full access to java class libraries. It is done through interfacing at the native level in both Virtual Machines. However there are no recent development in this front.
In general, having an loosly coupled integration through REST or RCP would be easy to maintain than tightly coupled JNI based implementation.
There's no way to run Java within the Python runtime (which is what it sounds like you want). There are Java to Python "translators" available, but they're terrible. Honestly, if you need a Java server and Django to sit inside the same process for some reason, Jython is the way to go.
There are lots of options outside of that though, off the top of my head:
Implement Python bindings for your server (See PyLucene for an example)
Implement a socket server within your Java server that Python can talk to directly

Is there a legitimate, automated, method for deploying Java applications on iOS4?

I'm wondering if there is a standard method for deploying applications originally written in Java, to iOS4 devices.
I assume that the application in original format cannot be deployed - is there perhaps an emulation layer that I can use, or a stable compiler that compiles Java to ObjectiveC?
Option 1:
Use one of several cross compilers, compiling Java to ObjectiveC:
http://www.xmlvm.org/overview/
http://www.flexycore.com/ispectrum-overview.html
Option 2:
Package custom JVM with java application, with restrictions that meet the latest agreement (including no byte-code download capability and no JIT compilation). No JVM specifically designed for the iPhone is currently (Oct 2010) available, though the IKVM might run on top of Monotouch, and Oracle may build a version of the Java SE for the iPhone eventually.
Option 3:
Cross compile Java to one of the existing interpreters that are already accepted on the iPhone (eg, cross compile Java to C# and run the app on monotouch)
With the new current iOS SDK agreement and App store rules, it may be possible for you to embed a Java applet with your own JVM interpreter and runtime engine (but no byte-code download capability and no JIT compilation allowed).
Another seldom mentioned possibility for deploying any non media or graphic intensive networked app, such as many typical Java applets, is to run a customized RDP or VNC viewer on the iPhone and and view a Java app that is being hosted and run remotely.
Mechanically translating some of your code will likely work pending finding a cross compiler / translator. Trying to run a Java based GUI on iPhone is just plain stupid in my opinion. So the smart thing would be to port the GUI by hand.
The problem of course is if the app is mostly GUI you might as well write the whole thing over. Likewise if the app uses APIs that there is not a simple translation for you again might as well rewrite the entire app.
In a nut shell I think Steve J. Was right here, the route you are comtemplating just leads to poor user experiences. It actually makes me wonder why you would even think that a Java based app would be successful on iPhone.

A beginner's question in Scala

Can a scala program be running on a browser with disabled java plugin (as scala is compiled to a jvm bytecode)? In other words: is the jvm disabled provided the java browser plugin is disabled?
Or does Scala run server-side and I am confused?
If I estimate it correctly, you can have both: Server-side and Client-side.
In case you want to use it on the server, it's called a Servlet and compiled to a JSP-application.
In case you want to use it on the client, it's an Applet and runs in the JVM. And that's what the user disables in his browser-settings.
As far as I know it, java and scala compiles to the same type of bytecode which is executed by the JVM.
Therefore, you cannot use neither Scala nor Java if the user has the plugin disabled. The browser cannot distinguish between these two.
The only java program which "runs in a browser" is an applet; any class extending java.applet.Applet will serve this purpose. As a scala class can extend a java one, it is therefore perfectly possible to write an applet in scala.
However, this cannot run if java is disabled in the browser as scala runs on the Java Virtual Machine. (In fact, there's no difference between a compiled scala program and a compiled Java program - they are both bytecode, which is run on a JVM)
Applets are not particularly common however, and most scala code will be server-side in practice. When you see people talking about scala and the web, they are most probably talking about Lift, which is a (server-side) web-framework for Scala.
Scala is almost always run on the server or as a normal desktop "java" application.
I suppose it would work perfectly well as an applet, if it doesn't add any confusion to the security model, but if applets are disabled I presume you can't run any JVM code at all.
Regarding Lift, the server side runs Scala, but the client side runs automatically generated Javascript, which does not need the jvm.

Categories