01: /*
02: * Copyright 2006-2007 Pentaho Corporation. All rights reserved.
03: * This software was developed by Pentaho Corporation and is provided under the terms
04: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
05: * this file except in compliance with the license. If you need a copy of the license,
06: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt.
07: *
08: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
09: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
10: * the license for the specific language governing your rights and limitations.
11: *
12: * Additional Contributor(s): Martin Schmid gridvision engineering GmbH
13: */
14: package org.pentaho.reportdesigner.crm.report.tests;
15:
16: import org.jetbrains.annotations.NotNull;
17: import org.pentaho.reportdesigner.crm.report.util.FileUtils;
18:
19: import java.io.File;
20: import java.io.FilenameFilter;
21: import java.io.IOException;
22:
23: /**
24: * User: Martin
25: * Date: 11.08.2006
26: * Time: 09:32:05
27: */
28: @SuppressWarnings({"ALL"})
29: public class CreateStartScripts {
30: public static void main(@NotNull
31: String[] args) throws IOException {
32: StringBuilder windows = new StringBuilder(
33: "start javaw -cp resources;lib;lib\\ReportDesigner.jar;");
34:
35: StringBuilder linux = new StringBuilder("#!/bin/sh\n" + "\n"
36: + "if [ \"$LD_LIBRARY_PATH\" = \"\" ]; then\n"
37: + " LD_LIBRARY_PATH=/usr/lib/xulrunner-1.8.0.1\n"
38: + " export LD_LIBRARY_PATH\n" + "fi\n" + "\n"
39: + "if [ \"$MOZILLA_FIVE_HOME\" = \"\" ]; then\n"
40: + " MOZILLA_FIVE_HOME=/usr/lib/xulrunner-1.8.0.1\n"
41: + " export MOZILLA_FIVE_HOME\n" + "fi\n" + " \n"
42: + "java -cp resources:lib:lib/ReportDesigner.jar:");
43:
44: StringBuilder osx = new StringBuilder(
45: "#!/bin/sh\n"
46: + "\n"
47: + "export LD_LIBRARY_PATH=./swt-osx\n"
48: + "java -XstartOnFirstThread -cp \"resources:lib:lib/ReportDesigner.jar:");
49:
50: File libraryDirectory = new File("lib");
51: File[] files = libraryDirectory.listFiles(new FilenameFilter() {
52: public boolean accept(@NotNull
53: File dir, @NotNull
54: String name) {
55: return name.endsWith(".jar");
56: }
57: });
58:
59: for (int i = 0; i < files.length; i++) {
60: File file = files[i];
61: String filename = file.getName();
62:
63: windows.append("lib\\");
64: windows.append(filename);
65:
66: linux.append("lib/");
67: linux.append(filename);
68:
69: osx.append("lib/");
70: osx.append(filename);
71:
72: windows.append(";");
73: linux.append(":");
74: osx.append(":");
75: }
76:
77: windows
78: .append("lib\\swt-win32\\swt.jar -Djava.library.path=lib\\swt-win32 org.pentaho.reportdesigner.crm.report.ReportDialog");
79: linux
80: .append("lib/swt-linux/linux-swt.jar -Djava.library.path=lib/swt-linux/:/usr/lib/mozilla-1.7.8 org.pentaho.reportdesigner.crm.report.ReportDialog");
81: osx
82: .append("lib/swt-osx/swt-osx.jar\" -Djava.library.path=\"lib/swt-osx\" org.pentaho.reportdesigner.crm.report.ReportDialog");
83:
84: FileUtils.writeTextToFile(new File("./src/startdesigner.bat"),
85: windows.toString());
86: FileUtils.writeTextToFile(new File(
87: "./src/startdesigner_linux.sh"), linux.toString());
88: FileUtils.writeTextToFile(
89: new File("./src/startdesigner_osx.sh"), osx.toString());
90:
91: System.out.println(windows.toString());
92: System.out.println();
93: System.out.println(linux.toString());
94: System.out.println();
95: System.out.println(osx.toString());
96: }
97: }
|