[Jsxe-cvs] SF.net SVN: jsxe: [1141] tags/05pre3/jsxe
Status: Inactive
Brought to you by:
ian_lewis
From: <ian...@us...> - 2006-08-12 16:50:34
|
Revision: 1141 Author: ian_lewis Date: 2006-08-12 09:50:27 -0700 (Sat, 12 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1141&view=rev Log Message: ----------- Fixed the installer for unix/linux Modified Paths: -------------- tags/05pre3/jsxe/Changelog tags/05pre3/jsxe/build.xml tags/05pre3/jsxe/installer/src/installer/OperatingSystem.java Modified: tags/05pre3/jsxe/Changelog =================================================================== --- tags/05pre3/jsxe/Changelog 2006-08-12 05:54:18 UTC (rev 1140) +++ tags/05pre3/jsxe/Changelog 2006-08-12 16:50:27 UTC (rev 1141) @@ -1,3 +1,9 @@ +08/12/2006 Ian Lewis <Ian...@me...> + + * Added support for running jsXe in a wrapped exe using launch4j. + * Added an installer for jsXe. The installer can be packaged in an exe for + easy use by windows users. + 08/09/2006 Ian Lewis <Ian...@me...> * Added a new option to the Global Options dialog for the number of undo Modified: tags/05pre3/jsxe/build.xml =================================================================== --- tags/05pre3/jsxe/build.xml 2006-08-12 05:54:18 UTC (rev 1140) +++ tags/05pre3/jsxe/build.xml 2006-08-12 16:50:27 UTC (rev 1141) @@ -569,6 +569,9 @@ <entry key="app.license.title" value="${app.license.title}"/> <entry key="app.license" value="${app.license}"/> <entry key="ostask.unix-script.label" value="${ostask.unix-script.label}"/> + + <entry key="extra.vm.args" value="-Djava.endorsed.dirs=lib"/> + <!--<entry key="ostask.unix-man.label" value="${ostask.unix-man.label}"/>--> <entry key="comp.count" value="${comp.count}"/> <entry key="comp.0.name" value="${comp.0.name}"/> Modified: tags/05pre3/jsxe/installer/src/installer/OperatingSystem.java =================================================================== --- tags/05pre3/jsxe/installer/src/installer/OperatingSystem.java 2006-08-12 05:54:18 UTC (rev 1140) +++ tags/05pre3/jsxe/installer/src/installer/OperatingSystem.java 2006-08-12 16:50:27 UTC (rev 1141) @@ -22,321 +22,326 @@ */ public abstract class OperatingSystem { - public abstract String getInstallDirectory(String name, String version); + public abstract String getInstallDirectory(String name, String version); - public abstract static class OSTask - { - protected Install installer; - protected String name; - protected String label; - protected String directory; - protected boolean enabled; + public abstract static class OSTask + { + protected Install installer; + protected String name; + protected String label; + protected String directory; + protected boolean enabled; - public OSTask(Install installer, String name) - { - this.installer = installer; - this.name = name; - this.label = installer.getProperty("ostask." + name + ".label"); - this.directory = getDefaultDirectory(installer); + public OSTask(Install installer, String name) + { + this.installer = installer; + this.name = name; + this.label = installer.getProperty("ostask." + name + ".label"); + this.directory = getDefaultDirectory(installer); - // on by default - enabled = true; - } + // on by default + enabled = true; + } - public String getName() - { - return name; - } + public String getName() + { + return name; + } - public String getLabel() - { - return label; - } + public String getLabel() + { + return label; + } - public String getDefaultDirectory(Install installer) - { - return null; - } + public String getDefaultDirectory(Install installer) + { + return null; + } - public String getDirectory() - { - return directory; - } + public String getDirectory() + { + return directory; + } - public boolean isEnabled() - { - return enabled; - } + public boolean isEnabled() + { + return enabled; + } - public void setEnabled(boolean enabled) - { - this.enabled = enabled; - } + public void setEnabled(boolean enabled) + { + this.enabled = enabled; + } - public void setDirectory(String directory) - { - this.directory = directory; - } + public void setDirectory(String directory) + { + this.directory = directory; + } - public abstract void perform(String installDir, - Vector filesets) throws IOException; - } + public abstract void perform(String installDir, + Vector filesets) throws IOException; + } - public OSTask[] getOSTasks(Install installer) - { - return new OSTask[0]; - } + public OSTask[] getOSTasks(Install installer) + { + return new OSTask[0]; + } - public void mkdirs(String directory) throws IOException - { - File file = new File(directory); - if(!file.exists()) - file.mkdirs(); - } + public void mkdirs(String directory) throws IOException + { + File file = new File(directory); + if(!file.exists()) + file.mkdirs(); + } - public static OperatingSystem getOperatingSystem() - { - if(os != null) - return os; + public static OperatingSystem getOperatingSystem() + { + if(os != null) + return os; - if(System.getProperty("mrj.version") != null) - os = new MacOS(); - else - { - String osName = System.getProperty("os.name"); - if(osName.indexOf("Windows") != -1) - os = new Windows(); - else if(osName.indexOf("OS/2") != -1) - os = new HalfAnOS(); - else if(osName.indexOf("VMS") != -1) - os = new VMS(); - else - os = new Unix(); - } + if(System.getProperty("mrj.version") != null) + os = new MacOS(); + else + { + String osName = System.getProperty("os.name"); + if(osName.indexOf("Windows") != -1) + os = new Windows(); + else if(osName.indexOf("OS/2") != -1) + os = new HalfAnOS(); + else if(osName.indexOf("VMS") != -1) + os = new VMS(); + else + os = new Unix(); + } - return os; - } + return os; + } - public static class Unix extends OperatingSystem - { - public String getInstallDirectory(String name, String version) - { - String dir = "/usr/local/share/"; - if(!new File(dir).canWrite()) - dir = System.getProperty("user.home"); + public static class Unix extends OperatingSystem + { + public String getInstallDirectory(String name, String version) + { + String dir = "/usr/local/share/"; + if(!new File(dir).canWrite()) + dir = System.getProperty("user.home"); - return new File(dir,name.toLowerCase() + "/" + version).getPath(); - } + return new File(dir,name.toLowerCase() + "/" + version).getPath(); + } - public class ScriptOSTask extends OSTask - { - public ScriptOSTask(Install installer) - { - super(installer,"unix-script"); - } + public class ScriptOSTask extends OSTask + { + public ScriptOSTask(Install installer) + { + super(installer,"unix-script"); + } - public String getDefaultDirectory(Install installer) - { - String dir = "/usr/local/"; - if(!new File(dir).canWrite()) - dir = System.getProperty("user.home"); + public String getDefaultDirectory(Install installer) + { + String dir = "/usr/local/"; + if(!new File(dir).canWrite()) + dir = System.getProperty("user.home"); - return new File(dir,"bin").getPath(); - } + return new File(dir,"bin").getPath(); + } - public void perform(String installDir, - Vector filesets) throws IOException - { - if(!enabled) - return; + public void perform(String installDir, + Vector filesets) throws IOException + { + if(!enabled) + return; - mkdirs(directory); + mkdirs(directory); - String name = installer.getProperty("app.name"); + String name = installer.getProperty("app.name"); + String vmArgs = installer.getProperty("extra.vm.args"); - // create app start script - String script = directory + File.separatorChar - + name.toLowerCase(); + // create app start script + String script = directory + File.separatorChar + + name.toLowerCase(); - // Delete existing copy - new File(script).delete(); + // Delete existing copy + new File(script).delete(); - // Write simple script - FileWriter out = new FileWriter(script); - out.write("#!/bin/sh\n"); - out.write("# Java heap size, in megabytes\n"); - out.write("JAVA_HEAP_SIZE=32\n"); - out.write("DEFAULT_JAVA_HOME=\"" - + System.getProperty("java.home") - + "\"\n"); - out.write("if [ \"$JAVA_HOME\" = \"\" ]; then\n"); - out.write("JAVA_HOME=\"$DEFAULT_JAVA_HOME\"\n"); - out.write("fi\n"); + // Write simple script + FileWriter out = new FileWriter(script); + out.write("#!/bin/sh\n"); + out.write("# Java heap size, in megabytes\n"); + out.write("JAVA_HEAP_SIZE=32\n"); + out.write("DEFAULT_JAVA_HOME=\"" + + System.getProperty("java.home") + + "\"\n"); + out.write("if [ \"$JAVA_HOME\" = \"\" ]; then\n"); + out.write("JAVA_HOME=\"$DEFAULT_JAVA_HOME\"\n"); + out.write("fi\n"); - out.write("exec \"$JAVA_HOME" - + "/bin/java\" -mx${JAVA_HEAP_SIZE}m ${" - + name.toUpperCase() + "} "); + out.write("exec \"$JAVA_HOME" + + "/bin/java\" -mx${JAVA_HEAP_SIZE}m "+vmArgs+" ${" + + name.toUpperCase() + "} "); - String jar = installDir + File.separator - + name.toLowerCase() + ".jar"; + // String jar = installDir + File.separator + // + name.toLowerCase() + ".jar"; + + String jar = installDir + File.separator + + name + ".jar"; - out.write("-jar \"" + jar + "\" $@\n"); + out.write("-jar \"" + jar + "\" $@\n"); - out.close(); + out.close(); - // Make it executable - String[] chmodArgs = { "chmod", "755", script }; - exec(chmodArgs); - } - } + // Make it executable + String[] chmodArgs = { "chmod", "755", script }; + exec(chmodArgs); + } + } - public class ManPageOSTask extends OSTask - { - public ManPageOSTask(Install installer) - { - super(installer,"unix-man"); - } + public class ManPageOSTask extends OSTask + { + public ManPageOSTask(Install installer) + { + super(installer,"unix-man"); + } - public String getDefaultDirectory(Install installer) - { - String dir = "/usr/local/"; - if(!new File(dir).canWrite()) - dir = System.getProperty("user.home"); + public String getDefaultDirectory(Install installer) + { + String dir = "/usr/local/"; + if(!new File(dir).canWrite()) + dir = System.getProperty("user.home"); - return new File(dir,"man/man1").getPath(); - } + return new File(dir,"man/man1").getPath(); + } - public void perform(String installDir, - Vector filesets) throws IOException - { - if(!enabled) - return; + public void perform(String installDir, + Vector filesets) throws IOException + { + if(!enabled) + return; - mkdirs(directory); + mkdirs(directory); - String name = installer.getProperty("app.name"); + String name = installer.getProperty("app.name"); - // install man page - String manpage = installer.getProperty("ostask.unix-man.manpage"); + // install man page + String manpage = installer.getProperty("ostask.unix-man.manpage"); - InputStream in = getClass().getResourceAsStream("/" + manpage); - installer.copy(in,new File(directory,manpage).getPath(), - null); - } - } + if (manpage != null) { + InputStream in = getClass().getResourceAsStream("/" + manpage); + installer.copy(in, new File(directory,manpage).getPath(), null); + } + } + } - public OSTask[] getOSTasks(Install installer) - { - return new OSTask[] { new ScriptOSTask(installer), - new ManPageOSTask(installer) }; - } + public OSTask[] getOSTasks(Install installer) + { + return new OSTask[] { new ScriptOSTask(installer), + new ManPageOSTask(installer) }; + } - public void mkdirs(String directory) throws IOException - { - File file = new File(directory); - if(!file.exists()) - { - String[] mkdirArgs = { "mkdir", "-m", "755", - "-p", directory }; - exec(mkdirArgs); - } - } + public void mkdirs(String directory) throws IOException + { + File file = new File(directory); + if(!file.exists()) + { + String[] mkdirArgs = { "mkdir", "-m", "755", + "-p", directory }; + exec(mkdirArgs); + } + } - public void exec(String[] args) throws IOException - { - Process proc = Runtime.getRuntime().exec(args); - proc.getInputStream().close(); - proc.getOutputStream().close(); - proc.getErrorStream().close(); - try - { - proc.waitFor(); - } - catch(InterruptedException ie) - { - } - } - } + public void exec(String[] args) throws IOException + { + Process proc = Runtime.getRuntime().exec(args); + proc.getInputStream().close(); + proc.getOutputStream().close(); + proc.getErrorStream().close(); + try + { + proc.waitFor(); + } + catch(InterruptedException ie) + { + } + } + } - public static class MacOS extends Unix - { - public String getInstallDirectory(String name, String version) - { - return "/Applications/" + name + " " + version; - } - } + public static class MacOS extends Unix + { + public String getInstallDirectory(String name, String version) + { + return "/Applications/" + name + " " + version; + } + } - public static class Windows extends OperatingSystem - { - public String getInstallDirectory(String name, String version) - { - return "C:\\Program Files\\" + name + " " + version; - } + public static class Windows extends OperatingSystem + { + public String getInstallDirectory(String name, String version) + { + return "C:\\Program Files\\" + name + " " + version; + } - public class JEditLauncherOSTask extends OSTask - { - public JEditLauncherOSTask(Install installer) - { - super(installer,"jedit-launcher"); - } + public class JEditLauncherOSTask extends OSTask + { + public JEditLauncherOSTask(Install installer) + { + super(installer,"jedit-launcher"); + } - public String getDefaultDirectory(Install installer) - { - return null; - } + public String getDefaultDirectory(Install installer) + { + return null; + } - public void perform(String installDir, - Vector filesets) - { - if(!enabled - || !filesets.contains("jedit-windows")) - return; + public void perform(String installDir, + Vector filesets) + { + if(!enabled + || !filesets.contains("jedit-windows")) + return; - // run jEditLauncher installation - File executable = new File(installDir,"jedit.exe"); - if(!executable.exists()) - return; + // run jEditLauncher installation + File executable = new File(installDir,"jedit.exe"); + if(!executable.exists()) + return; - String[] args = { executable.getPath(), "/i", - System.getProperty("java.home") - + File.separator - + "bin" }; + String[] args = { executable.getPath(), "/i", + System.getProperty("java.home") + + File.separator + + "bin" }; - try - { - Runtime.getRuntime().exec(args).waitFor(); - } - catch(IOException io) - { - } - catch(InterruptedException ie) - { - } - } - } + try + { + Runtime.getRuntime().exec(args).waitFor(); + } + catch(IOException io) + { + } + catch(InterruptedException ie) + { + } + } + } - public OSTask[] getOSTasks(Install installer) - { - return new OSTask[] { /* new JEditLauncherOSTask(installer) */ }; - } - } + public OSTask[] getOSTasks(Install installer) + { + return new OSTask[] { /* new JEditLauncherOSTask(installer) */ }; + } + } - public static class HalfAnOS extends OperatingSystem - { - public String getInstallDirectory(String name, String version) - { - return "C:\\" + name + " " + version; - } - } + public static class HalfAnOS extends OperatingSystem + { + public String getInstallDirectory(String name, String version) + { + return "C:\\" + name + " " + version; + } + } - public static class VMS extends OperatingSystem - { - public String getInstallDirectory(String name, String version) - { - return "./" + name.toLowerCase() + "/" + version; - } - } + public static class VMS extends OperatingSystem + { + public String getInstallDirectory(String name, String version) + { + return "./" + name.toLowerCase() + "/" + version; + } + } - // private members - private static OperatingSystem os; + // private members + private static OperatingSystem os; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |