Use .exe file in android application [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
There is a way to put a computer program with .exe extensions in the Android program and then run them through the program.
I have read about ndk and win, but I do not know exactly how to use them
Please describe with an example or give full reference

You are trying to run a binary application (intel x86 .exe for windows) on a different architecture and platform (android running on ARM or Arch64).
I can think of three options:
Option 1: Emulation
The traditional approach to running binaries for different architectures is emulation, for example using Qemu.
However, that still leaves the different platform. If your exe file uses a GUI and a filesystem, for example, you suddenly also need to emulate parts of the operating system it expects, or ship a copy of some Windows variant with your application, which would have all kinds of copyright constraints.
Finally, keep in mind that Android devices have completely different input mechanism than a traditional Windows PC, so you would have to link the Android virtual keyboard (and touch events) to a keyboard and mouse for the emulated Windows PC.
This is not impossible, but will require a tremendous amount of supporting code.
If you choose to go this route, I suggest you first buy a desktop-like ARM device like a Raspberry Pi and get it working there.
Option 2: Decompilation and porting to Android
You can find decompilers that turn the .exe file back into a set of compilable C or C++ files. This would allow you to carefully extract the functionality you need and wrap it in Android native code. This was how OpenRCT2 and Diablo were ported to other platforms like Linux and macOS, years later.
You should not expect the decompiled source code to resemble anything you would write yourself, but with enough time you can end up with something Android-native (or linux, or macOS, or even iOS).
Option 3: Host the application elsewhere
Finally, you could opt to NOT port the application to Android at all, but rather host it on a Windows machine you can run 24/7, and make it accessible on your phone. Depending on the application, this could take the form of a web service that runs the .exe with input from the web, or a full-blown remote desktop/VNC session where you can interact with the application using your phone's input methods.

Related

Reading from USB port [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I'm trying to write a java application that accesses the usb ports to read from and write to a device connected through usb. The problem I face is that I don't know what exactly to use in java to do such a thing. I searched online and found something called JUSB but all the posts seem fairly old.
Currently I'm using the RXTX libraries but I sometimes run into some sync error. When I use C# to do the equivalent it requires far less code and I don't face any of the same sync error.
My question is, is there anything built into the latest version of the JRE I can use to access the usb ports (that is just as easy as the equivalent C# code)?
Been using usb4java for a year on cross platfom (Linux and Windows) and it works great.
See:
http://usb4java.org/
They are very active and have a very good javax USB front.
There is nothing equivalent to C#'s USB support in Java. Both jUSB and Java-USB are severely out-of-date and likely unusable for any serious application development.
If you want to implement a cross-platform USB application, really your best bet is to write an abstract JNI interface that talks to Linux, Mac and Windows native libraries that you'll have to write yourself. I'd look at LibUSB to handle Mac and Linux. Windows, as you've seen, is pretty straightforward. I just came off a year-long project that did just this, and unfortunately this is the only serious cross-platform solution. If you don't have to implement on Windows and your needs are limited, you may get by with one of the older Java libs (jUSB or Java-USB). Anything that needs to deploy on Win32/Win64 will need a native component.
You might want to have a look at usb4java - http://usb4java.org/index.html it appears to support Windows, Linux and Mac OS's and appears to be reasonably current at the time of posting. Is unfortunately under the LGPL so may not be suitable for commercial development.
See the jUSB or usb4java libraries.
The Java Communications API. This should provide similar functionality to the C# System.IO.Ports namespace.
If you're on a mac, USB's can be accessed with the /Volumes/ directory.
Example:
You want to write to a file in "Drive", so the filepath would be:
/Volumes/Drive/file.whatever
Not sure how it's accomplished on other platforms, but this is the simplest way I've found on a mac

What is the best way to test C++ android apps written using visual studio. Without upgrading to windows pro [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
This is the scenario, I am writing C++ applications, and would like them to be multi platform; therefore, I am using visual studio (2017 RC). Due to the fact I don't want to upgrade my PC to windows 10 pro I can't use the emulator that Microsoft provides, so I need to come up with a solution, which is:
1) write the c++ application using visual studio
2) copy that code into android studio then compile and run to test the code
This method works because once the code is in Android studio it is easy to compile and run on the android emulator; unfortunately, it is a tedious process. What I would like to know is would it be best to write a shell script, java program, C++ program, or other program to automate this process. If you think a shell script would be best please provide an example, because I suck at using shells (Note the platform is windows). Please describe why your method is best, and I'll mark correct the answer that appears to be the best solution. Lastly you should know the process will be done many times (every time I make a change to the code worthy of testing).
If you need more information ask in the comments and I will provide it if I can. Also note if you have a better solution than copying the code into Android studio those answers will be acceptable to.
You can try using Nvidia Nsight Tegra, as long as you are willing to test on actual hardware, and not an emulator.
Develop, build, debug and deploy native applications for Android, the world's most popular operating system, using Microsoft Visual Studio, the world’s most popular integrated development environment.
The workflow is quite similar in Nvidia Nsight Tegra as it is for native Windows development, except for the extra toolbar to determine the target hardware.

Why Android support java but not other languages? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I see the statement below on Google in one form or another
Most of the Android development is Java based because Android supports
a large number of Java libraries
I am coming from Java based web application background. I have never heard the statement "Windows supports one specific language but Linux does not". Then why in context of mobile OS we say android supports Java. The role of any OS is to execute the commands and not to support the specific language, right?
I know I am missing something basic here, but what's that?
Then why in context of mobile OS we say android support java.
I do not know who "we" is. Experienced computer programmers would not say that, and even your made-up quote does not say that.
Role of any OS is to execute the commands not to support the specific language right ?
Correct. And, given a rooted Android device, you are welcome to try porting any language you like to Android, and in a custom ROM mod, you are welcome to arrange to allow the user to run any program they want in any of those supported languages.
However, most people do not have rooted Android devices.
On a normal Android device, the Android frameworks put some limitations on what you easily can use for programming.
For example, you can divide the world of Java-capable servers into two main categories:
Those where you have complete control over the server, which is roughly equivalent to running a rooted Android device
Those where all you can do is upload a WAR and related files (e.g., static assets), which are run on a Java-powered server managed by somebody else
In that latter scenario, you are not going to have complete flexibility in programming. Presumably, you could integrate JVM-based scripting languages, but you may have difficulty in using C++. That is not an issue with the OS — the server itself is probably perfectly capable of running a C++ program. It is an issue of the framework in which your code is running (whatever people use for WARs nowadays, as it has been a long time since I worked in server-side Java development).
The primary framework for Android development is based on Java. Courtesy of WebView, this also opens up hooks for hybrid development (HTML/CSS/JS). NativeActivity makes it possible to write full Android apps in C/C++. Various toolchains allow you to write in other languages (e.g., Kotlin) that compile into something that works with Android's frameworks, and you can embed scripting languages. But you still need to stick to the frameworks, which puts some limits on what you can do and how you can do it. This is not the fault of the Android OS, but rather the frameworks.
Yes, Android is based on Java. But recently the grandpa Delphi acquired fire monkey, which is supposed to transform Delphi code in to native Android code. That way it supposedly run just like a native application.

How to Play and loop all videos in folder by JavaFX Media Player? [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
In Android, we can use the mediaplayer to play songs on the device, and cursors to get the track information (which the OS keeps track of). My question is, what are the Java equivalents of these?
Note: I have seen people mentioning JavaFX, however this does not seem to be installed with the JVM by default and thus my program would no longer be cross-platform.
Any suggestions?
Note: These will all be local files, though they may be of any audio filetype.
I'll provide information on a JavaFX related solution for a Java music player as I think it is a good technology to use for this task.
Supported Platforms and Formats
they may be of any audio filetype.
Supported audio types for JavaFX are documented in the javafx.scene.media javadoc. Supported formats for JavaFX 2.2 are MP3, AAC and PCM in various containers such as mp3, mp4 and wav files. Other formats such as Ogg Theora are not supported - so if you need such formats you will need a different solution than JavaFX 2.2.
I have seen people mentioning JavaFX, however this does not seem to be installed with the JVM by default and thus my program would no longer be cross-platform
JavaFX is installed with the Oracle Java runtime by default since Java 7 update 6 and JavaFX 2.2 runs on OS X, Windows and Linux. There are currently no widely available solutions for running JavaFX on mobile platforms (though that may change in the future).
Further information on using JavaFX with Java 7 is in my answer to Compiling and running with JavaFX 2.1 as well as the JavaFX Deployment Guide.
get the track information (which the OS keeps track of)
Most track information is actually encoded in media files rather than in an OS database. You can retrieve metadata from media files played by JavaFX. Parsing of a limited amount of metadata from media files is supported as defined in the media documentation. Note that not all media contains all metadata. I tested a free mp3 file from amazon and was able to extract plenty of metadata from it successfully. Metadata from a test aac encoded m4a file from iTunes was mostly empty. So results depend on the media file being used.
Sample Player
I created a sample music player in JavaFX which plays audio files from a directory, displaying metadata for each song.
java2s also host source for a media player created by the authors of the Pro JavaFX 2 book. That might be a better reference than my code, as mine was a quick hack, whereas the pro source is from a professionally published book.
Additional Questions
Any suggestions for those of us on linux not using Oracle's JRE?
Oracle JRE is available on Linux, but if you don't want to use that, you can build openjfx for openjdk and use that, or you could develop your app using Oracle JRE and use the JavaFX packaging tools to distribute it as a self-contained application so it has no external JRE dependency.

Java Music Player: Song information and playing [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
In Android, we can use the mediaplayer to play songs on the device, and cursors to get the track information (which the OS keeps track of). My question is, what are the Java equivalents of these?
Note: I have seen people mentioning JavaFX, however this does not seem to be installed with the JVM by default and thus my program would no longer be cross-platform.
Any suggestions?
Note: These will all be local files, though they may be of any audio filetype.
I'll provide information on a JavaFX related solution for a Java music player as I think it is a good technology to use for this task.
Supported Platforms and Formats
they may be of any audio filetype.
Supported audio types for JavaFX are documented in the javafx.scene.media javadoc. Supported formats for JavaFX 2.2 are MP3, AAC and PCM in various containers such as mp3, mp4 and wav files. Other formats such as Ogg Theora are not supported - so if you need such formats you will need a different solution than JavaFX 2.2.
I have seen people mentioning JavaFX, however this does not seem to be installed with the JVM by default and thus my program would no longer be cross-platform
JavaFX is installed with the Oracle Java runtime by default since Java 7 update 6 and JavaFX 2.2 runs on OS X, Windows and Linux. There are currently no widely available solutions for running JavaFX on mobile platforms (though that may change in the future).
Further information on using JavaFX with Java 7 is in my answer to Compiling and running with JavaFX 2.1 as well as the JavaFX Deployment Guide.
get the track information (which the OS keeps track of)
Most track information is actually encoded in media files rather than in an OS database. You can retrieve metadata from media files played by JavaFX. Parsing of a limited amount of metadata from media files is supported as defined in the media documentation. Note that not all media contains all metadata. I tested a free mp3 file from amazon and was able to extract plenty of metadata from it successfully. Metadata from a test aac encoded m4a file from iTunes was mostly empty. So results depend on the media file being used.
Sample Player
I created a sample music player in JavaFX which plays audio files from a directory, displaying metadata for each song.
java2s also host source for a media player created by the authors of the Pro JavaFX 2 book. That might be a better reference than my code, as mine was a quick hack, whereas the pro source is from a professionally published book.
Additional Questions
Any suggestions for those of us on linux not using Oracle's JRE?
Oracle JRE is available on Linux, but if you don't want to use that, you can build openjfx for openjdk and use that, or you could develop your app using Oracle JRE and use the JavaFX packaging tools to distribute it as a self-contained application so it has no external JRE dependency.

Categories

Resources