Not supported In Simulator for jar file (CodeName One) - java

I created an application that uses MediaRecorder, it creates a file in my application directory and records into it, it worked fine.
But later i decided to make a desktop version of it without sending it to the build server by following the instructions i found here
My app is working fine, but i don't think it does the recording, infacts it throws a null pointer exception and the file path it shows when i try to show it with a dialog is something like this file://homeaudioSample1410359700375. Which makes me know that it seems to behaving like it is running in simulator. So i decided to run the jar from the command prompt and what i got was an error: not supported in simulator. What is the solution to this as i want the app to also run on non-mobile platform, or is there no other way around this except sending it to the build server.

Media recorder isn't supported in the JavaSE port of Codename One.
You can use a native interface implementation for JavaSE support. Media is just really problematic for desktop Java...

Related

applet alternative - Launch from browser

Recently I found an interesting Java applet which works pretty fine for electronic signature, but due to the recent NPAPI stuff with Chrome browser, I've considered it would be a good thing to migrate this applet to a Java application. HTML5/javascript/etc is not a possibility.
The special requisite is that the application should be launched from a browser, despite not being an applet.
The best approach I have found is as follows:
Create an installer which would create a java executable file in the local user's PC.
Create a javascript function to detect whether the application is installed in the computer (just as iTunes does/used to do).
In order to launch the application, create a custom URI Schema handler which would launch the application when found, sending the required parameters to the application (just like the applet does).
Everything sounds pretty smooth, but it's got certain drawbacks:
It's meant to work on different PC's. That means the URI Schema handler and the application MUST be installed/set up in every single computer I want to use the application in.
Migrating the applet code to a java application. It is an old application which i did not write, and it's got a single class with over four thousand lines.
With that in mind, I could not think of a better option. Is this viable? Any recommendation?
Thanks in advance.

Message Passing from NetBeans Plugin to C# WinForms Application

The short version of this question is, how can I send a message (a file path, for example) from a Java application (NetBeans plugin, to be specific) to an already-running C# WinForms executable application?
Some details.
I currently have a Windows application that I built (it's like a parser/editor for script files to help automate the process of script building using simple GUI tools for our test team). In the application, you can load a file using the app's "Load" button, hotkey, drag/drop, etc. You can also open the application from the command line with one or more file paths as parameters, and the app will launch with the given files already loaded.
On request, I cobbled together a NetBeans plugin (Java) that grabs the file path of the file that is currently in focus in NetBeans, and then executes my application with the focused file's path as parameter. This allows me to launch my app directly from NetBeans and open the file being edited in NetBeans in my app.
So what my app can do:
Launch with file loaded from CLI parameter
Load file from internal load command on-the-fly
What it can't do (what I want to add):
Load file in running instance from external message parameter on-the-fly
Load file in running instance from CLI message parameter on-the-fly
MSMQ is a solution I can't use. Saw it suggested in a lot of other threads. Things to note are that the NetBeans plugin and my app will always be on the same system, but I can't get MSMQ on all target machines.
Two suggestions:
(1) If you can figure out a way to publish an event from a Java process into the windows event log, you can definitely set up your .net app to watch for specific event types
(2) If you can arrange for the .net app to watch for files being created in a particular directory using FileSystemWatcher (maybe in %TEMP%), you can have your Java process write a file that contains whatever info you wish to pass.

Android java app installation under the hood

I am trying to understand what exactly is going on when you install an application (APK) on an Android device. I guess that files are are extracted from the package and copied somewhere on the device.
Are there other steps going on? For example, is the package name of the application written somewhere in the OS like in somekind of registry?
Is the application version number written as well somewhere or the OS reads the xml manifest of the application to know its installed version?
This is related to another question where I suspect that some data was not erased correctly during the uninstallation of a debug app and I am trying to find what that might be.
There will be files/dirs created in various locations, not necessary in all possible locations for every app though, it depends on how the app is configured.
This list is not necessarily complete.
Files/dirs:
/data/data
/data/app
/data/app-asec
/data/app-lib
/data/dalvik-cache
/data/local/tmp
/mnt/asec
/mnt/obb
/mnt/sdcard/Android/obb
/mnt/sdcard/Android/data
Your app will also get an entry in these files:
/data/system/packages.list
/data/system/packages.xml
/data/system/appops.xml

How to install a Java ME app on Samsung phone?

My phone is supposed to be able to run: JavaTM: MIDP 2.0, CLDC 1.1 based apps. However, no matter which app I try to install on it, I get the error: Downloaded JAR are invalid
I've tried to build Java ME projects on Netbeans, using MIDP 2.0 and CLDC 1.1 as specified. The apps are simple, using the auto generated code that comes with Netbeans, to display a hello world message. It works in the emulator however when I transfer the .JAR to the mobile, I get the above error.
This is the model and specifications of the phone.
Does anyone who developed any Java ME apps for this or any similar Samsung phones, have any idea of what I need to do?
Edit: Contents of jad file:
MIDlet-1: Midlet, , hello.Midlet
MIDlet-Jar-Size: 1565
MIDlet-Jar-URL: MobileApplication1.jar
MIDlet-Name: MobileApplication1
MIDlet-Vendor: Vendor
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0
Although many phones allow additional methods of installing MIDlets, the only standard way that they are all supposed to support according to the JavaME specifications is:
put the jad and the jar on a web server somewhere anybody can access them. choose a server that your mobile network operator doesn't block.
open the phone web browser. make it go to the jad file URL.
the web browser should download the jad file, realize what it is, make the phone install the application.
the internet connection of the phone should be using the cellular network at the time of install (no wi-fi...)
Maybe your filename is too big. "MobileApplication1" has 18 characters. Try to reduce both names (jad and jar) to equal or below 13, for example: MobileApp.jad and MobileApp.jar
Place both files at SD Card and open Jad file.

how to run java applications on mobile?

hi
what do i need to do in order to make my java app executable on a mobile (let's say Nokia Symbian for example) . Do all jar files run on mobiles???
is there a certain way of programmings am supposed to use ?? are there specific classes am supposed to use???
Do all jar files run on mobiles???
No
is there a certain way of programmings am supposed to use ??
Yes , you need to use j2me for specific MIDP CLDC platrofm . have a look here
are there specific classes am supposed to use???
You can use the classes available over the platform , alternatively you can also add the external library
Easy, seems like your about to have a stroke. Start reading some articles about getting started on J2ME, try these ones out:
Link 1
microjava.com
forum.nokia.com
You have to know, that depends on the your orientation of you application, not all applications runs in all cell phones, is like in computers, a Windows application won't work on Linux, unles you use a Virtualizer. My point is, start reading all the documentation you you cant, and take it slow.
Some OS's like Symbian Can run java package file i.e. .jar files.
And Android lacks that capability.
Phones with MDIP runs .jad files that is a Java app made using the J2ME API.
Android generate Dalvik Bytecode and run .apk packages on the phone.

Categories