Run java .class/.jar file in Nox (Android Emulator) - java

I've built a simple java console app that prints "Hello World", and I'm trying to make it's .class/.jar bytecode run in an Android emulator (Nox). For that, I've transfered the .jar and .class files from the app to the emulator via Google Drive, and tried to use two java emulating Android apps so far: Java Manager and J2ME Loader.
In Java Manager, I got the following error while trying to run the .class file:
Failed to dexing Class
And in J2ME I got the following error while tring to run the .jar file:
Broken manifest
Does anyone has any idea of how to fix those errors in any of those two java emulators for Android? I'm not finding another app in Play Store.

Android can neither execute Java (J2SE class files) nor J2ME code. It has it's own format which bases on Java, however the compiler infrastructure is different from J2SE. There may be emulators allowing to execute J2SE or J2ME code, however I would not rely on such products as the support is usually incomplete.
Therefore you need the Android SDK (and/or the development IDE "Android Studio") for creating Android Apps.
When you have created an Android App (apk file) you can deploy and run it an and Android device or the emulator you have mentioned.

Related

Is it possible to run a jar file in an android application?

I am a begginer in android and I want to develop an application which show a list of jar files to user and user can choose one of them and run it. Is it possible to run a jar file in an android application? (not as a library)
Nope we cannot run a jar file on android devices, You see we have .apk to install it on our android device. But not .jar, Also Android uses the Dalvik VM, where as you need the Java VM to run a jar-file. So you can run jar on android.

How to compile a whole android project as JAR for using in Delphi application?

I would like to merge our Java (Android) development with the Delphi XE7 mobile (FMX) project, and seems like the best way is to have a JAR which contains a whole Java based mobile application.
Is it possible to compile Android project with it's intents and resources as JAR, and if it is - how to?
Based on this answer:
Android uses the Dalvik VM, whereas you need the Java VM to run a jar-file. So you can't run a jar-file on Android.

Java - PocketSphinx Android doesn't run when exported

I'm using PocketSphinx Android in my app. It runs as expected when i'm debugging using eclipse. However, when i export to apk it using eclipse, the voice recognizer doesn't run. I'm not getting any error though.

NoClassDefFoundError when trying to run Android application

I am using the ADT version 21 plugin for Eclipse, and I am programming for the Android 4.2 platform. I originally wrote a Java client-server application, and I want to use some of the classes that I wrote in it for an Android application that I am writing right now. I tried exporting the Java class files to a JAR file and putting the JAR file in the libs directory in my Android application, but when I tried to run the application on my Nexus 4, a NoClassDefFoundError is thrown. I searched SO for some answers and tried a few suggestions such as including the JAR file in the Order and Export tab in the Properties window (and putting it at the top of the list), but I'm stuck. Eclipse compiles my Android application fine, but I am unable to run my application on my device.
I know this question has been asked before, and several users have experienced this same issue. I welcome all suggestions. (I just started learning about Android application development.) Thanks!
EDIT: I just noticed these lines in the Console output. Any ideas?
[2012-11-24 01:26:26 - HomePage] Dx bad class file magic (cafebabe) or version (0033.0000)
...while parsing org/nihongo/common/db/Commands.class
...while processing org/nihongo/common/db/Commands.class
EDIT: I think it could be the fact that I am using Java 7 instead of Java 6. See here.
NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available during compile time.
This error is also generated when you make an app that uses the Google API (such as Maps) but run it on a device that targets the Android API.
I switched my compiler from Java 7 to Java 6 in the client-server application. I exported the class that I wanted to a JAR file, and I included it in my Android application, and it looks like it works now!
So I guess only Java 6 is supported even on Android 4.2.

How to deploy MIDlet application use eclipse?

I am using EclipseME to write MIDlet application.
I have deployed by right click on Project->J2ME->Create Package.
After that, I copied Jad and Jar files in Deploy folder to My phone.
For BlackBerry: When I run Jad file, it is installed successful. And run ok.
For Android: When I run jar file, it popup message "open file failed".
Please tell me how to deploy MIDlet app by using Eclipse for all cell phone that can run it.
Android phones can't runt J2ME.
Directly you can't run Java ME application on android. But You can use some alternative ways like App runner or J2ab.
For Android you should develop an application using android sdk. Better you read the android documentation. Search android in google. It will help you.

Categories