Commit 489aae14 authored by Tommy Chan's avatar Tommy Chan

java checking(not done)

parent 5a45a528
......@@ -29,14 +29,31 @@ function generateExe() {
const dialog = require('dialog'); // For some reason dialog was not defined...
// TODO Verify if Java is installed and in path
var javaenabled = navigator.javaEnabled();
//var test = deployJava.getJREs();
if (!javaenabled) {
alert(window.lang.javaenabled);
return;
// Verify if Java is installed and in path
function javaversion(callback) {
var spawn = require('child_process').spawn('java', ['-version']);
spawn.on('error', function(err){
return callback(err, null);
})
spawn.stderr.on('data', function(data) {
data = data.toString().split('\n')[0];
var javaVersion = new RegExp('java version').test(data) ? data.split(' ')[2].replace(/"/g, '') : false;
if (javaVersion != false) {
// TODO: We have Java installed
return callback(null, javaVersion);
} else {
// TODO: No Java installed
dialog.err(window.lang.java_error, window.lang.error);
return;
}
});
}
javaversion(function(err,version){
console.log("Version is " + version);
})
let xmlData;
......
......@@ -40,5 +40,6 @@
"compress_swf_error":"未能成功壓縮swf檔案。",
"replace_xml":"未能成功從swf檔案取代xml檔案。",
"writexml_error":"未能成功寫入xml檔案。",
"javaenabled":"此瀏覽器不支援java."
"javaenabled":"此瀏覽器不支援java.",
"java_error":"你的裝置沒有java."
}
......@@ -40,5 +40,5 @@
"compress_swf_error":"Failed to Compress swf file.",
"replace_xml":"Failed to replace xml file in swf.",
"writexml_error":"Failed to write to xml file.",
"javaenabled":"Java is not enabled in this browser."
"java_error":"There is no java installed in your computer."
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment