Running app in IDE stops working - codenameone

Last week I finished development on a test app and ran it successfully in all simulators.
Today I decided to look at publishing the app and used "Sent Android Build". Build status "Successful".
Then tried running jar from command line and got:
peter#PeteSuse:~> java -jar "/home/peter/NetBeansProjects/mobile-apps/pGame/dist/pGame.jar"
java.lang.ArrayIndexOutOfBoundsException: 0
at com.codename1.impl.javase.Executor$1.run(Executor.java:84)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
So tried to run from GUI and got:
run:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel
at com.codename1.impl.ImplementationFactory.createImplementation(ImplementationFactory.java:69)
at com.codename1.ui.Display.init(Display.java:566)
at com.codename1.impl.javase.Executor$1.run(Executor.java:112)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
Java version:
peter#PeteSuse:~> java -version
openjdk version "1.8.0_121"
OpenJDK Runtime Environment (IcedTea 3.3.0) (suse-23.1-x86_64)
OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)
I am using Netbeans (new to this) on Suse Linux 42.1 64b.
Have I lost a library somewhere? or something else?

Thanks guys. I fixed the problem by adding jfxrt.jar to the Libraries in NetBeans.

JFXPanel is in the JavaFX library.
See: JavaFX and OpenJDK for info on why JavaFX is not available by default in your OpenJDK distribution.
If your linux distribution makes an open JavaFX package available (like ubuntu does: Why is JavaFX is not included in OpenJDK 8 on Ubuntu Wily (15.10)?), then you can use that.
Otherwise you can build from source (for the adventurous yak shaver).
Or, easiest, is just to an Oracle Java distribution.
I don't know codenameone or have any idea how it works. Possibly whatever it is, you could ask the creators to package their thing as a self-contained application, so that it ships with a compatible Java runtime, which would (potentially) avoid issues such as you are encountering. Not knowing codenameone, I don't know if that would make sense or not.
I also don't know the cause of your original ArrayIndexOutOfBoundsException as that looks internal to codenameone or your use of it.
With regards to NetBeans, you might need to set the Java platform to one with JavaFX installed (in case you have multiple Java platforms installed on your machine).

You can run a Codename One application in the simulator by pressing the play button in the IDE. It won't work for you from Command Line and shouldn't since the app shouldn't have a main() method.
You can execute the Codename One simulator from Command Line using:
java -jar JavaSE.jar:dist/MyApp.jar
Notice this assumes your project is the working directory.

Related

Set up kenlm for Windows

The official website makes it pretty clear that there is no support for kenlm in Windows. There is a Windows tag at the github repository but it seems to be maintained by few random contributors then and there.
How to set up kenlm for Windows then?
The new DeepSpeech PlayBook also includes instructions for setting up a Docker image and running training from within a Docker container. If you have Docker on Windows, this might be another solution.
The information for building a new Scorer is still in a PR, but may also be useful.
The solution is to use Ubuntu in Windows through Windows Subsystem for Linux
Get WSL for Windows
From your ubuntu bash navigate to the folder where you want to do the setup. You can access the Windows file system from the /mnt/c/ folder, which you can find at the root directory.
From there simply follow the official instructions, that is clone the git repo, and run cmake .. & make -j2 in order to build the project (after first making the necessary installations in your Ubuntu system).
Obviously, you must train the models or scorers using the Linux bash. You can also use these models from Windows using the kenlm python library.
E.g.
The two steps to build a scorer for the deepspeech-model as described here should be executed from your Ubuntu system. But after you have the scorer you should be able to run the command
deepspeech --model deepspeech-0.9.3-models.pbmm --scorer kenlm.scorer --audio audio.wav
from Windows. However, once you have WSL there's no need to do this work from Windows. Things will work nicely #your Ubuntu system.
I've faced the same problem and solved it by building kenlm wheel from Cygwin terminal as home page advices (pip wheel pypi-kenlm).
I've also uploaded wheel to pypi called kenlm-cygwin, but it's only python3.7.

MAVProxy installed by Python can't find required modules

I installed droneapi in the same manner given in the tutorial. However, it's missing all of the important modules that come with MAVProxy, such as console, wx, etc.
Was it supposed to install these modules, or should I move them over from MAVProxy itself instead?
Note: Windows 8 64-bit platform
I apologize that you had to investigate the issue without guidance. Publishing our Windows installer was not well prioritized, and it looks like that choice cost you several hours.
Here is what we will soon to address DroneKit Python installation on Windows:
A dedicated Windows installer generator lives at windows/droneapiWinBuild.bat. This generates a program Output\DroneKitsetup-1.x.x.exe which can be used to install all dependencies.
Yesterday we began testing the installer on Windows on every commit. https://github.com/dronekit/dronekit-python/pull/236
We will now publish the binaries generated by that test and document them in the Windows installation process. https://github.com/dronekit/dronekit-python/issues/164
Thanks for publishing your solution publicly. Hopefully we can address issues like these before they come up in the future.
Tim, DroneKit Engineer
So in a rare spark of intuition I discovered the answer. The modules required by Dronekit Python can be installed in the following ways:
Console- type "pip install console" into the WinPython cmd prompt
WX- http://wiki.wxpython.org/How%20to%20install%20wxPython
OpenCV- Download and install OpenCV version 2.4, then copy/paste the file cv2.pyd from OpenCV\build\python\2.7\x64\ to \python-2.7.6.amd64\Lib\site-packages.
At this point it should load all required modules, although it will throw a few exceptions which aren't important.
As always, 3DR documentation is incomplete. One would think that $800 million dollar profits would mean that they could hire more than 5 programmers for their new platform...

Google App engine Deploy Exception : Cannot get the System Java Compiler. Please use a JDK, not a JRE

Error message :
------------ Deploying frontend ------------
Preparing to deploy:
Created staging directory at: 'C:\Users\JAMESY~1\AppData\Local\Temp\appcfg5730205859174689794.tmp'
Scanning for jsp files.
Compiling jsp files.
java.lang.RuntimeException: Cannot get the System Java Compiler. Please use a JDK, not a JRE.
Debugging information may be found in C:\Users\James Yang\AppData\Local\Temp\appengine-deploy1938777867658475857.log
I have added
-vm
G:\Jdk8\bin\javaw.exe
in eclipse.ini
and My java_home is G:\Jdk8\bin\
Make sure you have the Java Development Kit (JDK) installed in your computer.
Check if you have Java 8 installed, while trying to compile with Java 7, or viceversa. In other words, check if the JDK is set to the wrong version.
Make sure the JDK is FIRST in your Path, by placing %JAVA_HOME%\bin at the beginning of your Path in your System variables.

I upgraded the GAE in Eclipse to 1.7.4

My JSP based application now doesn't deploy. I get the following error:
Cannot get the System Java Compiler. Please use a JDK, not a JRE.
Has anyone found a workaround?
It is likely that you are using some Java code in your JSP as a result of which the JDK is needed to compile that.
Here are some points that you can try:
Check that you are using a JDK and not a JRE. In Eclipse, go to Window --> Preferences and then Java --> Installed JREs. If it is pointing to a JRE and not JDK, I suggest you change that. So install a JDK, remove references to the JRE in the settings here and point it to the JDK only.
If you are still getting the exception above, then I suggest to provide the -vmsetting in eclipse.ini which is found in the same folder as your Eclipse executable.

Fedora Commons starting problems

I've been installing Fedora Commons on a Fedora 17 system. Everything has just gone like a charm and I followed this guide:
http://asingh.com.np/blog/fedora-commons-installation-and-configuration-guide/
However, whatever I do the service "Fedora Commons" won't start. There is nothing showing up in /var/log/messages
Running "service fedora start" ends with an OK, but when I afterwards run "service fedora status" it shows "Fedora Commons service is stopped".
Any ideas?
Fedora Commons can be somewhat picky about having an environment set up correctly. In general I prefer to install a new Tomcat servlet container and then choosing the "existingTomcat" custom install rather than having the Fedora Commons installer create a servlet container for you. By doing this you can more easily separate the servlet container install/config issues (lots of documentation on the web for this) from the Fedora Commons install/config issues (not so much information on this).
Also, when doing a new Fedora install I find it helps to download and deploy a servlet called "psi-probe" into the Tomcat container. It helps debugging environment issues as well as giving you an easy way to view log files for all your servlets from a common web interface.
http://code.google.com/p/psi-probe/
Further update: I forgot to mention one thing that also would prevent Fedora Commons from running and that is Fedora Commons does not seem to work well with the OpenJDK installed by default on many OS distributions. This can cause Fedora Commons to quietly fail with no log information even if the install was successful and correctly configured. Switching the environment variables to point to another version of JDK (other than OpenJDK) will resolve this problem.

Resources