Open jsfan3 opened 5 years ago
The same exception is thrown by "File", "Edit Global Build Hint".
In the blog, you wrote "JAVA_HOME must point at a valid JDK for Codename One and ant must by in the system PATH variable. Otherwise this won’t work." This should be ok for me, in fact:
$ echo $JAVA_HOME
/usr/lib/jvm/java-8-oracle
$ which ant
/usr/bin/ant
Unfortunately this is a limitation of JavaSE on Linux. The app uses the Desktop
API in Java to launch file associations but this isn't implemented in Linux platforms. I doubt this is fixable but I'm assigning it to @shannah just to make sure.
I've had to work around this before using Runtime.exec(). I'll try to dig up the code that I used and apply it here.
Note to self.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ca.weblite.lamprunner;
import java.awt.Desktop;
import java.net.URI;
/**
*
* @author shannah
*/
public class DesktopUtil {
public static void browse(String url) {
try {
Desktop.getDesktop().browse(new URI(url));
} catch (Exception ex) {
try {
Runtime.getRuntime().exec(new String[]{"xdg-open", url});
} catch (Exception ex2) {
System.err.println("Failed to open "+url);
ex2.printStackTrace();
}
}
}
}
I guess that the use of xdg-open
is your workaround on Linux... :)
I've read this article: https://www.codenameone.com/blog/sheets-samples.html
After tapping on "View Source" on the first item (JavascriptCapturePhotoExample) I get an
java.lang.UnsupportedOperationException: The EDIT action is not supported on the current platform!
. I have Oracle Java "1.8.0_212" on Linux Mint 19, with Netbeans 10.This is the full log: