Hi all I love stackoverflow so helpful.

Afaik IOS has some security measures that dont let other apps (such as jvm) execute code from your app. Not sure how much this is true.

But anyway, I heard that there are some problems when you try to run java application targeted for Windows on android phone.

Is that because some libraries (or most) are not cross platform? Or maybe even standard library is not cross platform (at least not completely)?

So basically if I wanted to code app for both windows,linux,mac,etc AND android, would I have to create functions like:

  IF unix THEN unixfunction()
  IF android THEN androidfunction()

or I wouldnt have to worry about it?

What should I know if I want to target both android phones AND computers (windows,linux,etc)? Is the above approach okay or I need to know something else? Is this even possible?

Sorry for a lot of questions, But portability was why I got interested in Java.

3 Answers 3


Java applications are run on a java virtual machine, which is what allows them to work on multiple platforms. However, android sdks have quite a few additional libraries and features pertaining exclusively to an android-compatible application that would make direct porting to windows impossible without adaptation.

That said, there are libraries which when used will allow an application for android to work on windows, with the exception to features of the android phone which obviously absent when run on windows. My guess is these libraries would provide a means to distinguish, but ideally you would want to distinguish as little as feasibly possible.

So in short no, not without some adaptations. If you're considering creating a program which will work on both, I would recommend you first find one such library, as it will be far more difficult to change later.

  • 2
    To add to this, it should be possible to develop the core of your application in platform-agnostic Java. The Android SDK should (hopefully) only be necessary for things like the presentation layer (think UIs) and possibly device storage I/O. Aug 29, 2018 at 14:27

I would recommend React Native

This is a framework written by Facebook that allows you to write mobile applications that work on both platforms using javascript. If you wish to learn about React Native I would recommend using the website Udemy and searching for React Native. The courses are cheap and they are packed with information.


Yes, prior to Android Lollipop, You can run JVM application with some efforts. After Android Lollipop, there were some changes in Android Core system like it now uses ART(Android RunTime) instead of Dalvik. So, this divided the apps which can safely run JVM programs on Android into two parts, one which supported Android versions prior to Lollipop and others which supported versions past that. If you are using Android lollipop or later, you can try: Java-N-Ide. But it supports only upto Java 1.7

See this: https://stackoverflow.com/questions/26979701/is-the-terminal-ide-app-for-android-compatible-with-lollipop There are better suggestions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.