Changeset 7212f85


Ignore:
Timestamp:
Feb 9, 2010 5:21:48 PM (12 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
05d22344
Parents:
d7e9096
Message:

Upgrade to launch4j 3.0.1 2008-07-20.
The license is BSD for launch4j and MIT for the wrapper code in head/

Changelog is in installer/lib/launch4j/web/changelog.html
Hopefully this will fix installs for 64-bit JRE on 64-bit windows.

The previous version was 2.0-RC3 2005-08-13.
The previous license was GPLv2 for launch4j and LGPLv2.1 for the wrapper code in head/

The bin/ld.exe and bin/windres.exe files were contributed by
i2p users in 2005 so the i2p installer could be built on windows.

They have not been updated for 3.0.1, so pkg builds on windows
will presumably still get 2.0-RC3.

Files:
85 added
8 deleted
69 edited

Legend:

Unmodified
Added
Removed
  • LICENSE.txt

    rd7e9096 r7212f85  
    8181
    8282Installer:
    83    Launch4j 2.0.RC3:
    84    Copyright (C) 2005 Grzegorz Kowal
    85    See licenses/LICENSE-GPLv2.txt
     83   Launch4j 3.0.1:
     84   Copyright (c) 2004, 2008 Grzegorz Kowal
     85   See licenses/LICENSE-Launch4j.txt (in binary packages)
     86   See installer/lib/launch4j/LICENSE.txt (in source packages)
    8687   The following projects are used by Launch4j...
    8788        MinGW binutils (http://www.mingw.org/)
  • build.xml

    rd7e9096 r7212f85  
    381381          <fileset dir="licenses/" />
    382382        </copy>
     383        <!--
     384              The license in launch4j/ is a BSD license for launch4j
     385              The license in launch4j/head is a MIT license for the code that is actually wrapped around the jars
     386              So we include the MIT one in our binary package
     387         -->
     388        <copy file="installer/lib/launch4j/head/LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-Launch4j.txt" />
     389        <!--  Not sure if these are used or should be included -->
    383390        <copy file="installer/lib/launch4j/lib/foxtrot.LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-Foxtrot.txt" />
    384391        <copy file="installer/lib/launch4j/lib/JGoodies.Forms.LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-JGoodies-Forms.txt" />
  • installer/lib/launch4j/LICENSE.txt

    rd7e9096 r7212f85  
    1                     GNU GENERAL PUBLIC LICENSE
    2                        Version 2, June 1991
     1Launch4j (http://launch4j.sourceforge.net/)
     2Cross-platform Java application wrapper for creating Windows native executables.
    33
    4  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
    5                        51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    6  Everyone is permitted to copy and distribute verbatim copies
    7  of this license document, but changing it is not allowed.
     4Copyright (c) 2004, 2008 Grzegorz Kowal
    85
    9                             Preamble
     6All rights reserved.
    107
    11   The licenses for most software are designed to take away your
    12 freedom to share and change it.  By contrast, the GNU General Public
    13 License is intended to guarantee your freedom to share and change free
    14 software--to make sure the software is free for all its users.  This
    15 General Public License applies to most of the Free Software
    16 Foundation's software and to any other program whose authors commit to
    17 using it.  (Some other Free Software Foundation software is covered by
    18 the GNU Library General Public License instead.)  You can apply it to
    19 your programs, too.
     8Redistribution and use in source and binary forms, with or without modification,
     9are permitted provided that the following conditions are met:
    2010
    21   When we speak of free software, we are referring to freedom, not
    22 price.  Our General Public Licenses are designed to make sure that you
    23 have the freedom to distribute copies of free software (and charge for
    24 this service if you wish), that you receive source code or can get it
    25 if you want it, that you can change the software or use pieces of it
    26 in new free programs; and that you know you can do these things.
     11    * Redistributions of source code must retain the above copyright notice,
     12      this list of conditions and the following disclaimer.
     13    * Redistributions in binary form must reproduce the above copyright notice,
     14      this list of conditions and the following disclaimer in the documentation
     15      and/or other materials provided with the distribution.
     16    * Neither the name of the Launch4j nor the names of its contributors
     17      may be used to endorse or promote products derived from this software without
     18      specific prior written permission.
    2719
    28   To protect your rights, we need to make restrictions that forbid
    29 anyone to deny you these rights or to ask you to surrender the rights.
    30 These restrictions translate to certain responsibilities for you if you
    31 distribute copies of the software, or if you modify it.
    32 
    33   For example, if you distribute copies of such a program, whether
    34 gratis or for a fee, you must give the recipients all the rights that
    35 you have.  You must make sure that they, too, receive or can get the
    36 source code.  And you must show them these terms so they know their
    37 rights.
    38 
    39   We protect your rights with two steps: (1) copyright the software, and
    40 (2) offer you this license which gives you legal permission to copy,
    41 distribute and/or modify the software.
    42 
    43   Also, for each author's protection and ours, we want to make certain
    44 that everyone understands that there is no warranty for this free
    45 software.  If the software is modified by someone else and passed on, we
    46 want its recipients to know that what they have is not the original, so
    47 that any problems introduced by others will not reflect on the original
    48 authors' reputations.
    49 
    50   Finally, any free program is threatened constantly by software
    51 patents.  We wish to avoid the danger that redistributors of a free
    52 program will individually obtain patent licenses, in effect making the
    53 program proprietary.  To prevent this, we have made it clear that any
    54 patent must be licensed for everyone's free use or not licensed at all.
    55 
    56   The precise terms and conditions for copying, distribution and
    57 modification follow.
    58 
    59 
    60                     GNU GENERAL PUBLIC LICENSE
    61    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
    62 
    63   0. This License applies to any program or other work which contains
    64 a notice placed by the copyright holder saying it may be distributed
    65 under the terms of this General Public License.  The "Program", below,
    66 refers to any such program or work, and a "work based on the Program"
    67 means either the Program or any derivative work under copyright law:
    68 that is to say, a work containing the Program or a portion of it,
    69 either verbatim or with modifications and/or translated into another
    70 language.  (Hereinafter, translation is included without limitation in
    71 the term "modification".)  Each licensee is addressed as "you".
    72 
    73 Activities other than copying, distribution and modification are not
    74 covered by this License; they are outside its scope.  The act of
    75 running the Program is not restricted, and the output from the Program
    76 is covered only if its contents constitute a work based on the
    77 Program (independent of having been made by running the Program).
    78 Whether that is true depends on what the Program does.
    79 
    80   1. You may copy and distribute verbatim copies of the Program's
    81 source code as you receive it, in any medium, provided that you
    82 conspicuously and appropriately publish on each copy an appropriate
    83 copyright notice and disclaimer of warranty; keep intact all the
    84 notices that refer to this License and to the absence of any warranty;
    85 and give any other recipients of the Program a copy of this License
    86 along with the Program.
    87 
    88 You may charge a fee for the physical act of transferring a copy, and
    89 you may at your option offer warranty protection in exchange for a fee.
    90 
    91   2. You may modify your copy or copies of the Program or any portion
    92 of it, thus forming a work based on the Program, and copy and
    93 distribute such modifications or work under the terms of Section 1
    94 above, provided that you also meet all of these conditions:
    95 
    96     a) You must cause the modified files to carry prominent notices
    97     stating that you changed the files and the date of any change.
    98 
    99     b) You must cause any work that you distribute or publish, that in
    100     whole or in part contains or is derived from the Program or any
    101     part thereof, to be licensed as a whole at no charge to all third
    102     parties under the terms of this License.
    103 
    104     c) If the modified program normally reads commands interactively
    105     when run, you must cause it, when started running for such
    106     interactive use in the most ordinary way, to print or display an
    107     announcement including an appropriate copyright notice and a
    108     notice that there is no warranty (or else, saying that you provide
    109     a warranty) and that users may redistribute the program under
    110     these conditions, and telling the user how to view a copy of this
    111     License.  (Exception: if the Program itself is interactive but
    112     does not normally print such an announcement, your work based on
    113     the Program is not required to print an announcement.)
    114 
    115 
    116 These requirements apply to the modified work as a whole.  If
    117 identifiable sections of that work are not derived from the Program,
    118 and can be reasonably considered independent and separate works in
    119 themselves, then this License, and its terms, do not apply to those
    120 sections when you distribute them as separate works.  But when you
    121 distribute the same sections as part of a whole which is a work based
    122 on the Program, the distribution of the whole must be on the terms of
    123 this License, whose permissions for other licensees extend to the
    124 entire whole, and thus to each and every part regardless of who wrote it.
    125 
    126 Thus, it is not the intent of this section to claim rights or contest
    127 your rights to work written entirely by you; rather, the intent is to
    128 exercise the right to control the distribution of derivative or
    129 collective works based on the Program.
    130 
    131 In addition, mere aggregation of another work not based on the Program
    132 with the Program (or with a work based on the Program) on a volume of
    133 a storage or distribution medium does not bring the other work under
    134 the scope of this License.
    135 
    136   3. You may copy and distribute the Program (or a work based on it,
    137 under Section 2) in object code or executable form under the terms of
    138 Sections 1 and 2 above provided that you also do one of the following:
    139 
    140     a) Accompany it with the complete corresponding machine-readable
    141     source code, which must be distributed under the terms of Sections
    142     1 and 2 above on a medium customarily used for software interchange; or,
    143 
    144     b) Accompany it with a written offer, valid for at least three
    145     years, to give any third party, for a charge no more than your
    146     cost of physically performing source distribution, a complete
    147     machine-readable copy of the corresponding source code, to be
    148     distributed under the terms of Sections 1 and 2 above on a medium
    149     customarily used for software interchange; or,
    150 
    151     c) Accompany it with the information you received as to the offer
    152     to distribute corresponding source code.  (This alternative is
    153     allowed only for noncommercial distribution and only if you
    154     received the program in object code or executable form with such
    155     an offer, in accord with Subsection b above.)
    156 
    157 The source code for a work means the preferred form of the work for
    158 making modifications to it.  For an executable work, complete source
    159 code means all the source code for all modules it contains, plus any
    160 associated interface definition files, plus the scripts used to
    161 control compilation and installation of the executable.  However, as a
    162 special exception, the source code distributed need not include
    163 anything that is normally distributed (in either source or binary
    164 form) with the major components (compiler, kernel, and so on) of the
    165 operating system on which the executable runs, unless that component
    166 itself accompanies the executable.
    167 
    168 If distribution of executable or object code is made by offering
    169 access to copy from a designated place, then offering equivalent
    170 access to copy the source code from the same place counts as
    171 distribution of the source code, even though third parties are not
    172 compelled to copy the source along with the object code.
    173 
    174 
    175   4. You may not copy, modify, sublicense, or distribute the Program
    176 except as expressly provided under this License.  Any attempt
    177 otherwise to copy, modify, sublicense or distribute the Program is
    178 void, and will automatically terminate your rights under this License.
    179 However, parties who have received copies, or rights, from you under
    180 this License will not have their licenses terminated so long as such
    181 parties remain in full compliance.
    182 
    183   5. You are not required to accept this License, since you have not
    184 signed it.  However, nothing else grants you permission to modify or
    185 distribute the Program or its derivative works.  These actions are
    186 prohibited by law if you do not accept this License.  Therefore, by
    187 modifying or distributing the Program (or any work based on the
    188 Program), you indicate your acceptance of this License to do so, and
    189 all its terms and conditions for copying, distributing or modifying
    190 the Program or works based on it.
    191 
    192   6. Each time you redistribute the Program (or any work based on the
    193 Program), the recipient automatically receives a license from the
    194 original licensor to copy, distribute or modify the Program subject to
    195 these terms and conditions.  You may not impose any further
    196 restrictions on the recipients' exercise of the rights granted herein.
    197 You are not responsible for enforcing compliance by third parties to
    198 this License.
    199 
    200   7. If, as a consequence of a court judgment or allegation of patent
    201 infringement or for any other reason (not limited to patent issues),
    202 conditions are imposed on you (whether by court order, agreement or
    203 otherwise) that contradict the conditions of this License, they do not
    204 excuse you from the conditions of this License.  If you cannot
    205 distribute so as to satisfy simultaneously your obligations under this
    206 License and any other pertinent obligations, then as a consequence you
    207 may not distribute the Program at all.  For example, if a patent
    208 license would not permit royalty-free redistribution of the Program by
    209 all those who receive copies directly or indirectly through you, then
    210 the only way you could satisfy both it and this License would be to
    211 refrain entirely from distribution of the Program.
    212 
    213 If any portion of this section is held invalid or unenforceable under
    214 any particular circumstance, the balance of the section is intended to
    215 apply and the section as a whole is intended to apply in other
    216 circumstances.
    217 
    218 It is not the purpose of this section to induce you to infringe any
    219 patents or other property right claims or to contest validity of any
    220 such claims; this section has the sole purpose of protecting the
    221 integrity of the free software distribution system, which is
    222 implemented by public license practices.  Many people have made
    223 generous contributions to the wide range of software distributed
    224 through that system in reliance on consistent application of that
    225 system; it is up to the author/donor to decide if he or she is willing
    226 to distribute software through any other system and a licensee cannot
    227 impose that choice.
    228 
    229 This section is intended to make thoroughly clear what is believed to
    230 be a consequence of the rest of this License.
    231 
    232 
    233   8. If the distribution and/or use of the Program is restricted in
    234 certain countries either by patents or by copyrighted interfaces, the
    235 original copyright holder who places the Program under this License
    236 may add an explicit geographical distribution limitation excluding
    237 those countries, so that distribution is permitted only in or among
    238 countries not thus excluded.  In such case, this License incorporates
    239 the limitation as if written in the body of this License.
    240 
    241   9. The Free Software Foundation may publish revised and/or new versions
    242 of the General Public License from time to time.  Such new versions will
    243 be similar in spirit to the present version, but may differ in detail to
    244 address new problems or concerns.
    245 
    246 Each version is given a distinguishing version number.  If the Program
    247 specifies a version number of this License which applies to it and "any
    248 later version", you have the option of following the terms and conditions
    249 either of that version or of any later version published by the Free
    250 Software Foundation.  If the Program does not specify a version number of
    251 this License, you may choose any version ever published by the Free Software
    252 Foundation.
    253 
    254   10. If you wish to incorporate parts of the Program into other free
    255 programs whose distribution conditions are different, write to the author
    256 to ask for permission.  For software which is copyrighted by the Free
    257 Software Foundation, write to the Free Software Foundation; we sometimes
    258 make exceptions for this.  Our decision will be guided by the two goals
    259 of preserving the free status of all derivatives of our free software and
    260 of promoting the sharing and reuse of software generally.
    261 
    262                             NO WARRANTY
    263 
    264   11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
    265 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
    266 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
    267 PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
    268 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    269 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
    270 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
    271 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
    272 REPAIR OR CORRECTION.
    273 
    274   12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
    275 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
    276 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
    277 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
    278 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
    279 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
    280 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
    281 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
    282 POSSIBILITY OF SUCH DAMAGES.
    283 
    284                      END OF TERMS AND CONDITIONS
    285 
    286 
    287             How to Apply These Terms to Your New Programs
    288 
    289   If you develop a new program, and you want it to be of the greatest
    290 possible use to the public, the best way to achieve this is to make it
    291 free software which everyone can redistribute and change under these terms.
    292 
    293   To do so, attach the following notices to the program.  It is safest
    294 to attach them to the start of each source file to most effectively
    295 convey the exclusion of warranty; and each file should have at least
    296 the "copyright" line and a pointer to where the full notice is found.
    297 
    298     <one line to give the program's name and a brief idea of what it does.>
    299     Copyright (C) <year>  <name of author>
    300 
    301     This program is free software; you can redistribute it and/or modify
    302     it under the terms of the GNU General Public License as published by
    303     the Free Software Foundation; either version 2 of the License, or
    304     (at your option) any later version.
    305 
    306     This program is distributed in the hope that it will be useful,
    307     but WITHOUT ANY WARRANTY; without even the implied warranty of
    308     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    309     GNU General Public License for more details.
    310 
    311     You should have received a copy of the GNU General Public License
    312     along with this program; if not, write to the Free Software
    313     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    314 
    315 
    316 Also add information on how to contact you by electronic and paper mail.
    317 
    318 If the program is interactive, make it output a short notice like this
    319 when it starts in an interactive mode:
    320 
    321     Gnomovision version 69, Copyright (C) year name of author
    322     Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    323     This is free software, and you are welcome to redistribute it
    324     under certain conditions; type `show c' for details.
    325 
    326 The hypothetical commands `show w' and `show c' should show the appropriate
    327 parts of the General Public License.  Of course, the commands you use may
    328 be called something other than `show w' and `show c'; they could even be
    329 mouse-clicks or menu items--whatever suits your program.
    330 
    331 You should also get your employer (if you work as a programmer) or your
    332 school, if any, to sign a "copyright disclaimer" for the program, if
    333 necessary.  Here is a sample; alter the names:
    334 
    335   Yoyodyne, Inc., hereby disclaims all copyright interest in the program
    336   `Gnomovision' (which makes passes at compilers) written by James Hacker.
    337 
    338   <signature of Ty Coon>, 1 April 1989
    339   Ty Coon, President of Vice
    340 
    341 This General Public License does not permit incorporating your program into
    342 proprietary programs.  If your program is a subroutine library, you may
    343 consider it more useful to permit linking proprietary applications with the
    344 library.  If this is what you want to do, use the GNU Library General
    345 Public License instead of this License.
     20THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     21"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     22LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     23A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     24CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     25EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     26PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     27PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     28LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     29NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     30SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  • installer/lib/launch4j/build.xml

    rd7e9096 r7212f85  
    11<project name="launch4j" default="compile" basedir=".">
    2         <property name="versionNumber" value="2.0.0.0" />
    3         <property name="version" value="2.0.RC3" />
    42        <property name="src" location="src" />
    53        <property name="lib" location="lib" />
    64        <property name="build" location="build" />
    7         <property name="dist" location="${user.home}/dist/${ant.project.name}" />
    85        <property name="jar" location="./${ant.project.name}.jar" />
    96        <property name="launch4j.dir" location="." />
    10         <property name="javac.compilerargs" value="" />
    117
    128        <path id="dist.classpath">
     
    2016                <tstamp />
    2117                <mkdir dir="${build}" />
    22                 <mkdir dir="${dist}" />
    2318        </target>
    2419
    2520        <target name="compile" depends="init" description="compile the source">
    2621                <javac srcdir="${src}" destdir="${build}" classpathref="dist.classpath" source="1.4" debug="on" />
    27                         <compilerarg line="${javac.compilerargs}" />
    28                 </javac>
    2922                <copy todir="${build}/images">
    3023                        <fileset dir="${src}/images">
    3124                                <include name="**/*" />
     25                        </fileset>
     26                </copy>
     27                <copy todir="${build}">
     28                        <fileset dir="${src}">
     29                                <include name="**/*.properties" />
    3230                        </fileset>
    3331                </copy>
     
    4341                <!-- Put everything in ${build} into a jar file -->
    4442                <jar jarfile="${jar}">
    45                         <fileset dir="${build}" includes="**/*" />
     43                        <fileset dir="${build}" excludes="**/messages_es.properties" />
    4644                        <manifest>
    4745                                <attribute name="Main-Class" value="net.sf.launch4j.Main" />
    4846                                <attribute name="Class-Path" value=". ${dist.classpath}" />
    49                         </manifest>
    50                 </jar>
    51                 <jar jarfile="./launcher.jar">
    52                         <fileset dir="${build}" includes="net/sf/launch4j/Launcher.class" />
    53                         <manifest>
    54                                 <attribute name="Main-Class" value="net.sf.launch4j.Launcher" />
    55                                 <attribute name="Class-Path" value=". ./${ant.project.name}.jar ${dist.classpath}" />
    5647                        </manifest>
    5748                </jar>
     
    6354        </target>
    6455
    65         <target name="dist.linux" depends="jar" description="generate the Linux distribution">
    66                 <!-- changes executables to default mode!
    67                                 <tar tarfile="${dist}/${ant.project.name}-${version}-linux.tgz" basedir="."
    68                                 compression="gzip" excludes="**/build/** **/CVS/** **/*.exe"/> -->
    69                 <exec executable="tar" failonerror="true">
    70                         <arg line="-czC .. --exclude build --exclude CVS --exclude *.bat --exclude *.exe --exclude launch4j/l4j --exclude launch4j/launcher.jar -f ${dist}/${ant.project.name}-${version}-linux.tgz ./launch4j" />
    71                 </exec>
    72         </target>
    73 
    74         <target name="dist.win32" depends="jar" description="generate the Windows distribution">
    75                 <taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${build}:./lib/xstream.jar" />
    76                 <launch4j configFile="./l4j/launch4j.xml"
    77                         fileVersion="${versionNumber}" txtFileVersion="${version}"
    78                         productVersion="${versionNumber}" txtProductVersion="${version}" />
    79                 <launch4j configFile="./l4j/launch4jc.xml"
    80                         fileVersion="${versionNumber}" txtFileVersion="${version}"
    81                         productVersion="${versionNumber}" txtProductVersion="${version}" />
    82                 <zip destfile="${dist}/${ant.project.name}-${version}-win32.zip">
    83                         <zipfileset dir="." prefix="launch4j" excludes="**/build/** **/CVS/** bin/ld bin/windres l4j/** launch4j launcher.jar" />
    84                 </zip>
    85         </target>
    86 
    87         <target name="dist" depends="demo, dist.linux, dist.win32, clean" description="generate all distributions" />
    88 
    8956        <target name="clean" description="clean up">
     57                <delete dir="${build}" />
    9058                <delete file="${jar}" />
    91                 <delete file="./launcher.jar" />
    92                 <delete>
    93                         <fileset dir="." includes="*.exe"/>
    94                 </delete>
    9559                <ant dir="./demo/ConsoleApp" target="clean" inheritAll="false" />
    9660                <ant dir="./demo/SimpleApp" target="clean" inheritAll="false" />
    9761        </target>
    98 
    99         <target name="clean.all" depends="clean" description="clean up">
    100                 <delete dir="${build}" />
    101         </target>
    10262</project>
  • installer/lib/launch4j/demo/ConsoleApp/build.xml

    rd7e9096 r7212f85  
    11<project name="ConsoleApp" default="exe" basedir=".">
    2         <property name="src" location="src"/>
    3         <property name="lib"  location="lib"/>
    4         <property name="build" location="build"/>
     2        <property name="src" location="src" />
     3        <property name="lib" location="lib" />
     4        <property name="build" location="build" />
    55        <property name="launch4j.dir" location="../.." />
    66
    77        <path id="dist.classpath">
    8                 <pathelement path="${build}"/>
     8                <pathelement path="${build}" />
    99                <fileset dir="${lib}">
    10                         <include name="**/*.jar"/>
    11                 </fileset>
     10                        <include name="**/*.jar" />
     11                </fileset>
    1212        </path>
    1313
    1414        <target name="init">
    15                 <tstamp/>
    16                 <mkdir dir="${build}"/>
     15                <tstamp />
     16                <mkdir dir="${build}" />
    1717        </target>
    1818
    1919        <target name="compile" depends="init" description="compile the source">
    20                 <javac srcdir="${src}"  destdir="${build}"  classpathref="dist.classpath"  debug="on"/>
     20                <javac srcdir="${src}" destdir="${build}" classpathref="dist.classpath" source="1.4" debug="on" />
    2121        </target>
    2222
    2323        <target name="jar" depends="compile" description="create the jar">
    2424                <fileset dir="${lib}" id="lib.dist.fileset">
    25                         <include name="**/*.jar"/>
     25                        <include name="**/*.jar" />
    2626                </fileset>
    2727                <pathconvert pathsep=" " property="dist.classpath" refid="lib.dist.fileset">
    28                         <map from="${lib}" to=".\lib"/>
     28                        <map from="${lib}" to=".\lib" />
    2929                </pathconvert>
    3030                <!-- Put everything in ${build} into a jar file -->
    3131                <jar jarfile="${ant.project.name}.jar">
    32                         <fileset dir="${build}" includes="**/*"/>
     32                        <fileset dir="${build}" includes="**/*" />
    3333                        <manifest>
    3434                                <!-- SET YOUR MAIN CLASS HERE -->
    35                                 <attribute name="Main-Class" value="net.sf.launch4j.example.ConsoleApp"/>
    36                                 <attribute name="Class-Path" value=". ${dist.classpath}"/>
     35                                <attribute name="Main-Class" value="net.sf.launch4j.example.ConsoleApp" />
     36                                <attribute name="Class-Path" value=". ${dist.classpath}" />
    3737                        </manifest>
    3838                </jar>
     
    4040
    4141        <target name="exe" depends="jar">
    42                 <taskdef name="launch4j"
    43                   classname="net.sf.launch4j.ant.Launch4jTask"
    44                   classpath="${launch4j.dir}/launch4j.jar
     42                <taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${launch4j.dir}/launch4j.jar
    4543                    :${launch4j.dir}/lib/xstream.jar" />
    4644                <launch4j>
    47                   <config headerType="1" jar="ConsoleApp.jar" outfile="ConsoleApp.exe"
    48                           errTitle="ConsoleApp" chdir="." customProcName="true" icon="l4j/ConsoleApp.ico">
    49                     <jre minVersion="1.4.0" />
    50                   </config>
     45                        <config headerType="console" jar="ConsoleApp.jar" outfile="ConsoleApp.exe" errTitle="ConsoleApp" chdir="." customProcName="true" icon="l4j/ConsoleApp.ico">
     46                                <singleInstance mutexName="net.sf.launch4j.example.ConsoleApp" />
     47                                <jre minVersion="1.4.0" />
     48                        </config>
    5149                </launch4j>
    5250        </target>
    5351
    54         <target name="clean" description="clean up" >
    55                 <delete dir="${build}"/>
    56                 <delete file="${ant.project.name}.jar"/>
    57                 <delete file="${ant.project.name}.exe"/>
     52        <target name="clean" description="clean up">
     53                <delete dir="${build}" />
     54                <delete file="${ant.project.name}.jar" />
     55                <delete file="${ant.project.name}.exe" />
    5856        </target>
    5957</project>
  • installer/lib/launch4j/demo/ConsoleApp/src/net/sf/launch4j/example/ConsoleApp.java

    rd7e9096 r7212f85  
    11/*
    2         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    3         Copyright (C) 2005 Grzegorz Kowal
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
    44
    5         This program is free software; you can redistribute it and/or modify
    6         it under the terms of the GNU General Public License as published by
    7         the Free Software Foundation; either version 2 of the License, or
    8         (at your option) any later version.
     5        Copyright (c) 2004, 2007 Grzegorz Kowal
    96
    10         This program is distributed in the hope that it will be useful,
    11         but WITHOUT ANY WARRANTY; without even the implied warranty of
    12         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13         GNU General Public License for more details.
     7        All rights reserved.
    148
    15         You should have received a copy of the GNU General Public License
    16         along with this program; if not, write to the Free Software
    17         Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     9        Redistribution and use in source and binary forms, with or without modification,
     10        are permitted provided that the following conditions are met:
     11
     12            * Redistributions of source code must retain the above copyright notice,
     13              this list of conditions and the following disclaimer.
     14            * Redistributions in binary form must reproduce the above copyright notice,
     15              this list of conditions and the following disclaimer in the documentation
     16              and/or other materials provided with the distribution.
     17            * Neither the name of the Launch4j nor the names of its contributors
     18              may be used to endorse or promote products derived from this software without
     19              specific prior written permission.
     20
     21        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     22        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     23        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     24        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     25        CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     26        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     27        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     28        PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     29        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     30        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     31        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1832*/
    1933
     
    4761                        BufferedReader is = new BufferedReader(new InputStreamReader(System.in));
    4862                        String line;
    49                         while ((line = is.readLine()) != null) {
     63                        while ((line = is.readLine()) != null && !line.equalsIgnoreCase("quit")) {
    5064                                System.out.print("You wrote: " + line + "\n\n>");
    5165                        }
    5266                        is.close();
     67                        System.exit(123);
    5368                } catch (IOException e) {
    5469                        System.err.print(e);
  • installer/lib/launch4j/demo/LICENSE.txt

    rd7e9096 r7212f85  
    1                     GNU GENERAL PUBLIC LICENSE
    2                        Version 2, June 1991
     1Launch4j (http://launch4j.sourceforge.net/)
     2Cross-platform Java application wrapper for creating Windows native executables.
    33
    4  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
    5                        51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    6  Everyone is permitted to copy and distribute verbatim copies
    7  of this license document, but changing it is not allowed.
     4Copyright (c) 2004, 2007 Grzegorz Kowal
    85
    9                             Preamble
     6All rights reserved.
    107
    11   The licenses for most software are designed to take away your
    12 freedom to share and change it.  By contrast, the GNU General Public
    13 License is intended to guarantee your freedom to share and change free
    14 software--to make sure the software is free for all its users.  This
    15 General Public License applies to most of the Free Software
    16 Foundation's software and to any other program whose authors commit to
    17 using it.  (Some other Free Software Foundation software is covered by
    18 the GNU Library General Public License instead.)  You can apply it to
    19 your programs, too.
     8Redistribution and use in source and binary forms, with or without modification,
     9are permitted provided that the following conditions are met:
    2010
    21   When we speak of free software, we are referring to freedom, not
    22 price.  Our General Public Licenses are designed to make sure that you
    23 have the freedom to distribute copies of free software (and charge for
    24 this service if you wish), that you receive source code or can get it
    25 if you want it, that you can change the software or use pieces of it
    26 in new free programs; and that you know you can do these things.
     11    * Redistributions of source code must retain the above copyright notice,
     12      this list of conditions and the following disclaimer.
     13    * Redistributions in binary form must reproduce the above copyright notice,
     14      this list of conditions and the following disclaimer in the documentation
     15      and/or other materials provided with the distribution.
     16    * Neither the name of the Launch4j nor the names of its contributors
     17      may be used to endorse or promote products derived from this software without
     18      specific prior written permission.
    2719
    28   To protect your rights, we need to make restrictions that forbid
    29 anyone to deny you these rights or to ask you to surrender the rights.
    30 These restrictions translate to certain responsibilities for you if you
    31 distribute copies of the software, or if you modify it.
    32 
    33   For example, if you distribute copies of such a program, whether
    34 gratis or for a fee, you must give the recipients all the rights that
    35 you have.  You must make sure that they, too, receive or can get the
    36 source code.  And you must show them these terms so they know their
    37 rights.
    38 
    39   We protect your rights with two steps: (1) copyright the software, and
    40 (2) offer you this license which gives you legal permission to copy,
    41 distribute and/or modify the software.
    42 
    43   Also, for each author's protection and ours, we want to make certain
    44 that everyone understands that there is no warranty for this free
    45 software.  If the software is modified by someone else and passed on, we
    46 want its recipients to know that what they have is not the original, so
    47 that any problems introduced by others will not reflect on the original
    48 authors' reputations.
    49 
    50   Finally, any free program is threatened constantly by software
    51 patents.  We wish to avoid the danger that redistributors of a free
    52 program will individually obtain patent licenses, in effect making the
    53 program proprietary.  To prevent this, we have made it clear that any
    54 patent must be licensed for everyone's free use or not licensed at all.
    55 
    56   The precise terms and conditions for copying, distribution and
    57 modification follow.
    58 
    59 
    60                     GNU GENERAL PUBLIC LICENSE
    61    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
    62 
    63   0. This License applies to any program or other work which contains
    64 a notice placed by the copyright holder saying it may be distributed
    65 under the terms of this General Public License.  The "Program", below,
    66 refers to any such program or work, and a "work based on the Program"
    67 means either the Program or any derivative work under copyright law:
    68 that is to say, a work containing the Program or a portion of it,
    69 either verbatim or with modifications and/or translated into another
    70 language.  (Hereinafter, translation is included without limitation in
    71 the term "modification".)  Each licensee is addressed as "you".
    72 
    73 Activities other than copying, distribution and modification are not
    74 covered by this License; they are outside its scope.  The act of
    75 running the Program is not restricted, and the output from the Program
    76 is covered only if its contents constitute a work based on the
    77 Program (independent of having been made by running the Program).
    78 Whether that is true depends on what the Program does.
    79 
    80   1. You may copy and distribute verbatim copies of the Program's
    81 source code as you receive it, in any medium, provided that you
    82 conspicuously and appropriately publish on each copy an appropriate
    83 copyright notice and disclaimer of warranty; keep intact all the
    84 notices that refer to this License and to the absence of any warranty;
    85 and give any other recipients of the Program a copy of this License
    86 along with the Program.
    87 
    88 You may charge a fee for the physical act of transferring a copy, and
    89 you may at your option offer warranty protection in exchange for a fee.
    90 
    91   2. You may modify your copy or copies of the Program or any portion
    92 of it, thus forming a work based on the Program, and copy and
    93 distribute such modifications or work under the terms of Section 1
    94 above, provided that you also meet all of these conditions:
    95 
    96     a) You must cause the modified files to carry prominent notices
    97     stating that you changed the files and the date of any change.
    98 
    99     b) You must cause any work that you distribute or publish, that in
    100     whole or in part contains or is derived from the Program or any
    101     part thereof, to be licensed as a whole at no charge to all third
    102     parties under the terms of this License.
    103 
    104     c) If the modified program normally reads commands interactively
    105     when run, you must cause it, when started running for such
    106     interactive use in the most ordinary way, to print or display an
    107     announcement including an appropriate copyright notice and a
    108     notice that there is no warranty (or else, saying that you provide
    109     a warranty) and that users may redistribute the program under
    110     these conditions, and telling the user how to view a copy of this
    111     License.  (Exception: if the Program itself is interactive but
    112     does not normally print such an announcement, your work based on
    113     the Program is not required to print an announcement.)
    114 
    115 
    116 These requirements apply to the modified work as a whole.  If
    117 identifiable sections of that work are not derived from the Program,
    118 and can be reasonably considered independent and separate works in
    119 themselves, then this License, and its terms, do not apply to those
    120 sections when you distribute them as separate works.  But when you
    121 distribute the same sections as part of a whole which is a work based
    122 on the Program, the distribution of the whole must be on the terms of
    123 this License, whose permissions for other licensees extend to the
    124 entire whole, and thus to each and every part regardless of who wrote it.
    125 
    126 Thus, it is not the intent of this section to claim rights or contest
    127 your rights to work written entirely by you; rather, the intent is to
    128 exercise the right to control the distribution of derivative or
    129 collective works based on the Program.
    130 
    131 In addition, mere aggregation of another work not based on the Program
    132 with the Program (or with a work based on the Program) on a volume of
    133 a storage or distribution medium does not bring the other work under
    134 the scope of this License.
    135 
    136   3. You may copy and distribute the Program (or a work based on it,
    137 under Section 2) in object code or executable form under the terms of
    138 Sections 1 and 2 above provided that you also do one of the following:
    139 
    140     a) Accompany it with the complete corresponding machine-readable
    141     source code, which must be distributed under the terms of Sections
    142     1 and 2 above on a medium customarily used for software interchange; or,
    143 
    144     b) Accompany it with a written offer, valid for at least three
    145     years, to give any third party, for a charge no more than your
    146     cost of physically performing source distribution, a complete
    147     machine-readable copy of the corresponding source code, to be
    148     distributed under the terms of Sections 1 and 2 above on a medium
    149     customarily used for software interchange; or,
    150 
    151     c) Accompany it with the information you received as to the offer
    152     to distribute corresponding source code.  (This alternative is
    153     allowed only for noncommercial distribution and only if you
    154     received the program in object code or executable form with such
    155     an offer, in accord with Subsection b above.)
    156 
    157 The source code for a work means the preferred form of the work for
    158 making modifications to it.  For an executable work, complete source
    159 code means all the source code for all modules it contains, plus any
    160 associated interface definition files, plus the scripts used to
    161 control compilation and installation of the executable.  However, as a
    162 special exception, the source code distributed need not include
    163 anything that is normally distributed (in either source or binary
    164 form) with the major components (compiler, kernel, and so on) of the
    165 operating system on which the executable runs, unless that component
    166 itself accompanies the executable.
    167 
    168 If distribution of executable or object code is made by offering
    169 access to copy from a designated place, then offering equivalent
    170 access to copy the source code from the same place counts as
    171 distribution of the source code, even though third parties are not
    172 compelled to copy the source along with the object code.
    173 
    174 
    175   4. You may not copy, modify, sublicense, or distribute the Program
    176 except as expressly provided under this License.  Any attempt
    177 otherwise to copy, modify, sublicense or distribute the Program is
    178 void, and will automatically terminate your rights under this License.
    179 However, parties who have received copies, or rights, from you under
    180 this License will not have their licenses terminated so long as such
    181 parties remain in full compliance.
    182 
    183   5. You are not required to accept this License, since you have not
    184 signed it.  However, nothing else grants you permission to modify or
    185 distribute the Program or its derivative works.  These actions are
    186 prohibited by law if you do not accept this License.  Therefore, by
    187 modifying or distributing the Program (or any work based on the
    188 Program), you indicate your acceptance of this License to do so, and
    189 all its terms and conditions for copying, distributing or modifying
    190 the Program or works based on it.
    191 
    192   6. Each time you redistribute the Program (or any work based on the
    193 Program), the recipient automatically receives a license from the
    194 original licensor to copy, distribute or modify the Program subject to
    195 these terms and conditions.  You may not impose any further
    196 restrictions on the recipients' exercise of the rights granted herein.
    197 You are not responsible for enforcing compliance by third parties to
    198 this License.
    199 
    200   7. If, as a consequence of a court judgment or allegation of patent
    201 infringement or for any other reason (not limited to patent issues),
    202 conditions are imposed on you (whether by court order, agreement or
    203 otherwise) that contradict the conditions of this License, they do not
    204 excuse you from the conditions of this License.  If you cannot
    205 distribute so as to satisfy simultaneously your obligations under this
    206 License and any other pertinent obligations, then as a consequence you
    207 may not distribute the Program at all.  For example, if a patent
    208 license would not permit royalty-free redistribution of the Program by
    209 all those who receive copies directly or indirectly through you, then
    210 the only way you could satisfy both it and this License would be to
    211 refrain entirely from distribution of the Program.
    212 
    213 If any portion of this section is held invalid or unenforceable under
    214 any particular circumstance, the balance of the section is intended to
    215 apply and the section as a whole is intended to apply in other
    216 circumstances.
    217 
    218 It is not the purpose of this section to induce you to infringe any
    219 patents or other property right claims or to contest validity of any
    220 such claims; this section has the sole purpose of protecting the
    221 integrity of the free software distribution system, which is
    222 implemented by public license practices.  Many people have made
    223 generous contributions to the wide range of software distributed
    224 through that system in reliance on consistent application of that
    225 system; it is up to the author/donor to decide if he or she is willing
    226 to distribute software through any other system and a licensee cannot
    227 impose that choice.
    228 
    229 This section is intended to make thoroughly clear what is believed to
    230 be a consequence of the rest of this License.
    231 
    232 
    233   8. If the distribution and/or use of the Program is restricted in
    234 certain countries either by patents or by copyrighted interfaces, the
    235 original copyright holder who places the Program under this License
    236 may add an explicit geographical distribution limitation excluding
    237 those countries, so that distribution is permitted only in or among
    238 countries not thus excluded.  In such case, this License incorporates
    239 the limitation as if written in the body of this License.
    240 
    241   9. The Free Software Foundation may publish revised and/or new versions
    242 of the General Public License from time to time.  Such new versions will
    243 be similar in spirit to the present version, but may differ in detail to
    244 address new problems or concerns.
    245 
    246 Each version is given a distinguishing version number.  If the Program
    247 specifies a version number of this License which applies to it and "any
    248 later version", you have the option of following the terms and conditions
    249 either of that version or of any later version published by the Free
    250 Software Foundation.  If the Program does not specify a version number of
    251 this License, you may choose any version ever published by the Free Software
    252 Foundation.
    253 
    254   10. If you wish to incorporate parts of the Program into other free
    255 programs whose distribution conditions are different, write to the author
    256 to ask for permission.  For software which is copyrighted by the Free
    257 Software Foundation, write to the Free Software Foundation; we sometimes
    258 make exceptions for this.  Our decision will be guided by the two goals
    259 of preserving the free status of all derivatives of our free software and
    260 of promoting the sharing and reuse of software generally.
    261 
    262                             NO WARRANTY
    263 
    264   11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
    265 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
    266 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
    267 PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
    268 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    269 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
    270 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
    271 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
    272 REPAIR OR CORRECTION.
    273 
    274   12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
    275 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
    276 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
    277 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
    278 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
    279 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
    280 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
    281 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
    282 POSSIBILITY OF SUCH DAMAGES.
    283 
    284                      END OF TERMS AND CONDITIONS
    285 
    286 
    287             How to Apply These Terms to Your New Programs
    288 
    289   If you develop a new program, and you want it to be of the greatest
    290 possible use to the public, the best way to achieve this is to make it
    291 free software which everyone can redistribute and change under these terms.
    292 
    293   To do so, attach the following notices to the program.  It is safest
    294 to attach them to the start of each source file to most effectively
    295 convey the exclusion of warranty; and each file should have at least
    296 the "copyright" line and a pointer to where the full notice is found.
    297 
    298     <one line to give the program's name and a brief idea of what it does.>
    299     Copyright (C) <year>  <name of author>
    300 
    301     This program is free software; you can redistribute it and/or modify
    302     it under the terms of the GNU General Public License as published by
    303     the Free Software Foundation; either version 2 of the License, or
    304     (at your option) any later version.
    305 
    306     This program is distributed in the hope that it will be useful,
    307     but WITHOUT ANY WARRANTY; without even the implied warranty of
    308     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    309     GNU General Public License for more details.
    310 
    311     You should have received a copy of the GNU General Public License
    312     along with this program; if not, write to the Free Software
    313     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    314 
    315 
    316 Also add information on how to contact you by electronic and paper mail.
    317 
    318 If the program is interactive, make it output a short notice like this
    319 when it starts in an interactive mode:
    320 
    321     Gnomovision version 69, Copyright (C) year name of author
    322     Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    323     This is free software, and you are welcome to redistribute it
    324     under certain conditions; type `show c' for details.
    325 
    326 The hypothetical commands `show w' and `show c' should show the appropriate
    327 parts of the General Public License.  Of course, the commands you use may
    328 be called something other than `show w' and `show c'; they could even be
    329 mouse-clicks or menu items--whatever suits your program.
    330 
    331 You should also get your employer (if you work as a programmer) or your
    332 school, if any, to sign a "copyright disclaimer" for the program, if
    333 necessary.  Here is a sample; alter the names:
    334 
    335   Yoyodyne, Inc., hereby disclaims all copyright interest in the program
    336   `Gnomovision' (which makes passes at compilers) written by James Hacker.
    337 
    338   <signature of Ty Coon>, 1 April 1989
    339   Ty Coon, President of Vice
    340 
    341 This General Public License does not permit incorporating your program into
    342 proprietary programs.  If your program is a subroutine library, you may
    343 consider it more useful to permit linking proprietary applications with the
    344 library.  If this is what you want to do, use the GNU Library General
    345 Public License instead of this License.
     20THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     21"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     22LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     23A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     24CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     25EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     26PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     27PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     28LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     29NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     30SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  • installer/lib/launch4j/head/LICENSE.txt

    rd7e9096 r7212f85  
    1                   GNU LESSER GENERAL PUBLIC LICENSE
    2                        Version 2.1, February 1999
     1Copyright (c) 2004, 2007 Grzegorz Kowal
    32
    4  Copyright (C) 1991, 1999 Free Software Foundation, Inc.
    5      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    6  Everyone is permitted to copy and distribute verbatim copies
    7  of this license document, but changing it is not allowed.
     3Permission is hereby granted, free of charge, to any person obtaining a copy
     4of this software and associated documentation files (the "Software"), to deal
     5in the Software without restriction, including without limitation the rights
     6to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     7copies of the Software, and to permit persons to whom the Software is
     8furnished to do so, subject to the following conditions:
    89
    9 [This is the first released version of the Lesser GPL.  It also counts
    10  as the successor of the GNU Library Public License, version 2, hence
    11  the version number 2.1.]
     10The above copyright notice and this permission notice shall be included in
     11all copies or substantial portions of the Software.
    1212
    13                             Preamble
     13Except as contained in this notice, the name(s) of the above copyright holders
     14shall not be used in advertising or otherwise to promote the sale, use or other
     15dealings in this Software without prior written authorization.
    1416
    15   The licenses for most software are designed to take away your
    16 freedom to share and change it.  By contrast, the GNU General Public
    17 Licenses are intended to guarantee your freedom to share and change
    18 free software--to make sure the software is free for all its users.
    19 
    20   This license, the Lesser General Public License, applies to some
    21 specially designated software packages--typically libraries--of the
    22 Free Software Foundation and other authors who decide to use it.  You
    23 can use it too, but we suggest you first think carefully about whether
    24 this license or the ordinary General Public License is the better
    25 strategy to use in any particular case, based on the explanations below.
    26 
    27   When we speak of free software, we are referring to freedom of use,
    28 not price.  Our General Public Licenses are designed to make sure that
    29 you have the freedom to distribute copies of free software (and charge
    30 for this service if you wish); that you receive source code or can get
    31 it if you want it; that you can change the software and use pieces of
    32 it in new free programs; and that you are informed that you can do
    33 these things.
    34 
    35   To protect your rights, we need to make restrictions that forbid
    36 distributors to deny you these rights or to ask you to surrender these
    37 rights.  These restrictions translate to certain responsibilities for
    38 you if you distribute copies of the library or if you modify it.
    39 
    40   For example, if you distribute copies of the library, whether gratis
    41 or for a fee, you must give the recipients all the rights that we gave
    42 you.  You must make sure that they, too, receive or can get the source
    43 code.  If you link other code with the library, you must provide
    44 complete object files to the recipients, so that they can relink them
    45 with the library after making changes to the library and recompiling
    46 it.  And you must show them these terms so they know their rights.
    47 
    48   We protect your rights with a two-step method: (1) we copyright the
    49 library, and (2) we offer you this license, which gives you legal
    50 permission to copy, distribute and/or modify the library.
    51 
    52   To protect each distributor, we want to make it very clear that
    53 there is no warranty for the free library.  Also, if the library is
    54 modified by someone else and passed on, the recipients should know
    55 that what they have is not the original version, so that the original
    56 author's reputation will not be affected by problems that might be
    57 introduced by others.
    58 
    59 
    60   Finally, software patents pose a constant threat to the existence of
    61 any free program.  We wish to make sure that a company cannot
    62 effectively restrict the users of a free program by obtaining a
    63 restrictive license from a patent holder.  Therefore, we insist that
    64 any patent license obtained for a version of the library must be
    65 consistent with the full freedom of use specified in this license.
    66 
    67   Most GNU software, including some libraries, is covered by the
    68 ordinary GNU General Public License.  This license, the GNU Lesser
    69 General Public License, applies to certain designated libraries, and
    70 is quite different from the ordinary General Public License.  We use
    71 this license for certain libraries in order to permit linking those
    72 libraries into non-free programs.
    73 
    74   When a program is linked with a library, whether statically or using
    75 a shared library, the combination of the two is legally speaking a
    76 combined work, a derivative of the original library.  The ordinary
    77 General Public License therefore permits such linking only if the
    78 entire combination fits its criteria of freedom.  The Lesser General
    79 Public License permits more lax criteria for linking other code with
    80 the library.
    81 
    82   We call this license the "Lesser" General Public License because it
    83 does Less to protect the user's freedom than the ordinary General
    84 Public License.  It also provides other free software developers Less
    85 of an advantage over competing non-free programs.  These disadvantages
    86 are the reason we use the ordinary General Public License for many
    87 libraries.  However, the Lesser license provides advantages in certain
    88 special circumstances.
    89 
    90   For example, on rare occasions, there may be a special need to
    91 encourage the widest possible use of a certain library, so that it becomes
    92 a de-facto standard.  To achieve this, non-free programs must be
    93 allowed to use the library.  A more frequent case is that a free
    94 library does the same job as widely used non-free libraries.  In this
    95 case, there is little to gain by limiting the free library to free
    96 software only, so we use the Lesser General Public License.
    97 
    98   In other cases, permission to use a particular library in non-free
    99 programs enables a greater number of people to use a large body of
    100 free software.  For example, permission to use the GNU C Library in
    101 non-free programs enables many more people to use the whole GNU
    102 operating system, as well as its variant, the GNU/Linux operating
    103 system.
    104 
    105   Although the Lesser General Public License is Less protective of the
    106 users' freedom, it does ensure that the user of a program that is
    107 linked with the Library has the freedom and the wherewithal to run
    108 that program using a modified version of the Library.
    109 
    110   The precise terms and conditions for copying, distribution and
    111 modification follow.  Pay close attention to the difference between a
    112 "work based on the library" and a "work that uses the library".  The
    113 former contains code derived from the library, whereas the latter must
    114 be combined with the library in order to run.
    115 
    116 
    117                   GNU LESSER GENERAL PUBLIC LICENSE
    118    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
    119 
    120   0. This License Agreement applies to any software library or other
    121 program which contains a notice placed by the copyright holder or
    122 other authorized party saying it may be distributed under the terms of
    123 this Lesser General Public License (also called "this License").
    124 Each licensee is addressed as "you".
    125 
    126   A "library" means a collection of software functions and/or data
    127 prepared so as to be conveniently linked with application programs
    128 (which use some of those functions and data) to form executables.
    129 
    130   The "Library", below, refers to any such software library or work
    131 which has been distributed under these terms.  A "work based on the
    132 Library" means either the Library or any derivative work under
    133 copyright law: that is to say, a work containing the Library or a
    134 portion of it, either verbatim or with modifications and/or translated
    135 straightforwardly into another language.  (Hereinafter, translation is
    136 included without limitation in the term "modification".)
    137 
    138   "Source code" for a work means the preferred form of the work for
    139 making modifications to it.  For a library, complete source code means
    140 all the source code for all modules it contains, plus any associated
    141 interface definition files, plus the scripts used to control compilation
    142 and installation of the library.
    143 
    144   Activities other than copying, distribution and modification are not
    145 covered by this License; they are outside its scope.  The act of
    146 running a program using the Library is not restricted, and output from
    147 such a program is covered only if its contents constitute a work based
    148 on the Library (independent of the use of the Library in a tool for
    149 writing it).  Whether that is true depends on what the Library does
    150 and what the program that uses the Library does.
    151  
    152   1. You may copy and distribute verbatim copies of the Library's
    153 complete source code as you receive it, in any medium, provided that
    154 you conspicuously and appropriately publish on each copy an
    155 appropriate copyright notice and disclaimer of warranty; keep intact
    156 all the notices that refer to this License and to the absence of any
    157 warranty; and distribute a copy of this License along with the
    158 Library.
    159 
    160   You may charge a fee for the physical act of transferring a copy,
    161 and you may at your option offer warranty protection in exchange for a
    162 fee.
    163 
    164 
    165   2. You may modify your copy or copies of the Library or any portion
    166 of it, thus forming a work based on the Library, and copy and
    167 distribute such modifications or work under the terms of Section 1
    168 above, provided that you also meet all of these conditions:
    169 
    170     a) The modified work must itself be a software library.
    171 
    172     b) You must cause the files modified to carry prominent notices
    173     stating that you changed the files and the date of any change.
    174 
    175     c) You must cause the whole of the work to be licensed at no
    176     charge to all third parties under the terms of this License.
    177 
    178     d) If a facility in the modified Library refers to a function or a
    179     table of data to be supplied by an application program that uses
    180     the facility, other than as an argument passed when the facility
    181     is invoked, then you must make a good faith effort to ensure that,
    182     in the event an application does not supply such function or
    183     table, the facility still operates, and performs whatever part of
    184     its purpose remains meaningful.
    185 
    186     (For example, a function in a library to compute square roots has
    187     a purpose that is entirely well-defined independent of the
    188     application.  Therefore, Subsection 2d requires that any
    189     application-supplied function or table used by this function must
    190     be optional: if the application does not supply it, the square
    191     root function must still compute square roots.)
    192 
    193 These requirements apply to the modified work as a whole.  If
    194 identifiable sections of that work are not derived from the Library,
    195 and can be reasonably considered independent and separate works in
    196 themselves, then this License, and its terms, do not apply to those
    197 sections when you distribute them as separate works.  But when you
    198 distribute the same sections as part of a whole which is a work based
    199 on the Library, the distribution of the whole must be on the terms of
    200 this License, whose permissions for other licensees extend to the
    201 entire whole, and thus to each and every part regardless of who wrote
    202 it.
    203 
    204 Thus, it is not the intent of this section to claim rights or contest
    205 your rights to work written entirely by you; rather, the intent is to
    206 exercise the right to control the distribution of derivative or
    207 collective works based on the Library.
    208 
    209 In addition, mere aggregation of another work not based on the Library
    210 with the Library (or with a work based on the Library) on a volume of
    211 a storage or distribution medium does not bring the other work under
    212 the scope of this License.
    213 
    214   3. You may opt to apply the terms of the ordinary GNU General Public
    215 License instead of this License to a given copy of the Library.  To do
    216 this, you must alter all the notices that refer to this License, so
    217 that they refer to the ordinary GNU General Public License, version 2,
    218 instead of to this License.  (If a newer version than version 2 of the
    219 ordinary GNU General Public License has appeared, then you can specify
    220 that version instead if you wish.)  Do not make any other change in
    221 these notices.
    222 
    223 
    224   Once this change is made in a given copy, it is irreversible for
    225 that copy, so the ordinary GNU General Public License applies to all
    226 subsequent copies and derivative works made from that copy.
    227 
    228   This option is useful when you wish to copy part of the code of
    229 the Library into a program that is not a library.
    230 
    231   4. You may copy and distribute the Library (or a portion or
    232 derivative of it, under Section 2) in object code or executable form
    233 under the terms of Sections 1 and 2 above provided that you accompany
    234 it with the complete corresponding machine-readable source code, which
    235 must be distributed under the terms of Sections 1 and 2 above on a
    236 medium customarily used for software interchange.
    237 
    238   If distribution of object code is made by offering access to copy
    239 from a designated place, then offering equivalent access to copy the
    240 source code from the same place satisfies the requirement to
    241 distribute the source code, even though third parties are not
    242 compelled to copy the source along with the object code.
    243 
    244   5. A program that contains no derivative of any portion of the
    245 Library, but is designed to work with the Library by being compiled or
    246 linked with it, is called a "work that uses the Library".  Such a
    247 work, in isolation, is not a derivative work of the Library, and
    248 therefore falls outside the scope of this License.
    249 
    250   However, linking a "work that uses the Library" with the Library
    251 creates an executable that is a derivative of the Library (because it
    252 contains portions of the Library), rather than a "work that uses the
    253 library".  The executable is therefore covered by this License.
    254 Section 6 states terms for distribution of such executables.
    255 
    256   When a "work that uses the Library" uses material from a header file
    257 that is part of the Library, the object code for the work may be a
    258 derivative work of the Library even though the source code is not.
    259 Whether this is true is especially significant if the work can be
    260 linked without the Library, or if the work is itself a library.  The
    261 threshold for this to be true is not precisely defined by law.
    262 
    263   If such an object file uses only numerical parameters, data
    264 structure layouts and accessors, and small macros and small inline
    265 functions (ten lines or less in length), then the use of the object
    266 file is unrestricted, regardless of whether it is legally a derivative
    267 work.  (Executables containing this object code plus portions of the
    268 Library will still fall under Section 6.)
    269 
    270   Otherwise, if the work is a derivative of the Library, you may
    271 distribute the object code for the work under the terms of Section 6.
    272 Any executables containing that work also fall under Section 6,
    273 whether or not they are linked directly with the Library itself.
    274 
    275 
    276   6. As an exception to the Sections above, you may also combine or
    277 link a "work that uses the Library" with the Library to produce a
    278 work containing portions of the Library, and distribute that work
    279 under terms of your choice, provided that the terms permit
    280 modification of the work for the customer's own use and reverse
    281 engineering for debugging such modifications.
    282 
    283   You must give prominent notice with each copy of the work that the
    284 Library is used in it and that the Library and its use are covered by
    285 this License.  You must supply a copy of this License.  If the work
    286 during execution displays copyright notices, you must include the
    287 copyright notice for the Library among them, as well as a reference
    288 directing the user to the copy of this License.  Also, you must do one
    289 of these things:
    290 
    291     a) Accompany the work with the complete corresponding
    292     machine-readable source code for the Library including whatever
    293     changes were used in the work (which must be distributed under
    294     Sections 1 and 2 above); and, if the work is an executable linked
    295     with the Library, with the complete machine-readable "work that
    296     uses the Library", as object code and/or source code, so that the
    297     user can modify the Library and then relink to produce a modified
    298     executable containing the modified Library.  (It is understood
    299     that the user who changes the contents of definitions files in the
    300     Library will not necessarily be able to recompile the application
    301     to use the modified definitions.)
    302 
    303     b) Use a suitable shared library mechanism for linking with the
    304     Library.  A suitable mechanism is one that (1) uses at run time a
    305     copy of the library already present on the user's computer system,
    306     rather than copying library functions into the executable, and (2)
    307     will operate properly with a modified version of the library, if
    308     the user installs one, as long as the modified version is
    309     interface-compatible with the version that the work was made with.
    310 
    311     c) Accompany the work with a written offer, valid for at
    312     least three years, to give the same user the materials
    313     specified in Subsection 6a, above, for a charge no more
    314     than the cost of performing this distribution.
    315 
    316     d) If distribution of the work is made by offering access to copy
    317     from a designated place, offer equivalent access to copy the above
    318     specified materials from the same place.
    319 
    320     e) Verify that the user has already received a copy of these
    321     materials or that you have already sent this user a copy.
    322 
    323   For an executable, the required form of the "work that uses the
    324 Library" must include any data and utility programs needed for
    325 reproducing the executable from it.  However, as a special exception,
    326 the materials to be distributed need not include anything that is
    327 normally distributed (in either source or binary form) with the major
    328 components (compiler, kernel, and so on) of the operating system on
    329 which the executable runs, unless that component itself accompanies
    330 the executable.
    331 
    332   It may happen that this requirement contradicts the license
    333 restrictions of other proprietary libraries that do not normally
    334 accompany the operating system.  Such a contradiction means you cannot
    335 use both them and the Library together in an executable that you
    336 distribute.
    337 
    338 
    339   7. You may place library facilities that are a work based on the
    340 Library side-by-side in a single library together with other library
    341 facilities not covered by this License, and distribute such a combined
    342 library, provided that the separate distribution of the work based on
    343 the Library and of the other library facilities is otherwise
    344 permitted, and provided that you do these two things:
    345 
    346     a) Accompany the combined library with a copy of the same work
    347     based on the Library, uncombined with any other library
    348     facilities.  This must be distributed under the terms of the
    349     Sections above.
    350 
    351     b) Give prominent notice with the combined library of the fact
    352     that part of it is a work based on the Library, and explaining
    353     where to find the accompanying uncombined form of the same work.
    354 
    355   8. You may not copy, modify, sublicense, link with, or distribute
    356 the Library except as expressly provided under this License.  Any
    357 attempt otherwise to copy, modify, sublicense, link with, or
    358 distribute the Library is void, and will automatically terminate your
    359 rights under this License.  However, parties who have received copies,
    360 or rights, from you under this License will not have their licenses
    361 terminated so long as such parties remain in full compliance.
    362 
    363   9. You are not required to accept this License, since you have not
    364 signed it.  However, nothing else grants you permission to modify or
    365 distribute the Library or its derivative works.  These actions are
    366 prohibited by law if you do not accept this License.  Therefore, by
    367 modifying or distributing the Library (or any work based on the
    368 Library), you indicate your acceptance of this License to do so, and
    369 all its terms and conditions for copying, distributing or modifying
    370 the Library or works based on it.
    371 
    372   10. Each time you redistribute the Library (or any work based on the
    373 Library), the recipient automatically receives a license from the
    374 original licensor to copy, distribute, link with or modify the Library
    375 subject to these terms and conditions.  You may not impose any further
    376 restrictions on the recipients' exercise of the rights granted herein.
    377 You are not responsible for enforcing compliance by third parties with
    378 this License.
    379 
    380 
    381   11. If, as a consequence of a court judgment or allegation of patent
    382 infringement or for any other reason (not limited to patent issues),
    383 conditions are imposed on you (whether by court order, agreement or
    384 otherwise) that contradict the conditions of this License, they do not
    385 excuse you from the conditions of this License.  If you cannot
    386 distribute so as to satisfy simultaneously your obligations under this
    387 License and any other pertinent obligations, then as a consequence you
    388 may not distribute the Library at all.  For example, if a patent
    389 license would not permit royalty-free redistribution of the Library by
    390 all those who receive copies directly or indirectly through you, then
    391 the only way you could satisfy both it and this License would be to
    392 refrain entirely from distribution of the Library.
    393 
    394 If any portion of this section is held invalid or unenforceable under any
    395 particular circumstance, the balance of the section is intended to apply,
    396 and the section as a whole is intended to apply in other circumstances.
    397 
    398 It is not the purpose of this section to induce you to infringe any
    399 patents or other property right claims or to contest validity of any
    400 such claims; this section has the sole purpose of protecting the
    401 integrity of the free software distribution system which is
    402 implemented by public license practices.  Many people have made
    403 generous contributions to the wide range of software distributed
    404 through that system in reliance on consistent application of that
    405 system; it is up to the author/donor to decide if he or she is willing
    406 to distribute software through any other system and a licensee cannot
    407 impose that choice.
    408 
    409 This section is intended to make thoroughly clear what is believed to
    410 be a consequence of the rest of this License.
    411 
    412   12. If the distribution and/or use of the Library is restricted in
    413 certain countries either by patents or by copyrighted interfaces, the
    414 original copyright holder who places the Library under this License may add
    415 an explicit geographical distribution limitation excluding those countries,
    416 so that distribution is permitted only in or among countries not thus
    417 excluded.  In such case, this License incorporates the limitation as if
    418 written in the body of this License.
    419 
    420   13. The Free Software Foundation may publish revised and/or new
    421 versions of the Lesser General Public License from time to time.
    422 Such new versions will be similar in spirit to the present version,
    423 but may differ in detail to address new problems or concerns.
    424 
    425 Each version is given a distinguishing version number.  If the Library
    426 specifies a version number of this License which applies to it and
    427 "any later version", you have the option of following the terms and
    428 conditions either of that version or of any later version published by
    429 the Free Software Foundation.  If the Library does not specify a
    430 license version number, you may choose any version ever published by
    431 the Free Software Foundation.
    432 
    433 
    434   14. If you wish to incorporate parts of the Library into other free
    435 programs whose distribution conditions are incompatible with these,
    436 write to the author to ask for permission.  For software which is
    437 copyrighted by the Free Software Foundation, write to the Free
    438 Software Foundation; we sometimes make exceptions for this.  Our
    439 decision will be guided by the two goals of preserving the free status
    440 of all derivatives of our free software and of promoting the sharing
    441 and reuse of software generally.
    442 
    443                             NO WARRANTY
    444 
    445   15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
    446 WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
    447 EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
    448 OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
    449 KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
    450 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    451 PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
    452 LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
    453 THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
    454 
    455   16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
    456 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
    457 AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
    458 FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
    459 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
    460 LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
    461 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
    462 FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
    463 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
    464 DAMAGES.
    465 
    466                      END OF TERMS AND CONDITIONS
    467 
    468 
    469            How to Apply These Terms to Your New Libraries
    470 
    471   If you develop a new library, and you want it to be of the greatest
    472 possible use to the public, we recommend making it free software that
    473 everyone can redistribute and change.  You can do so by permitting
    474 redistribution under these terms (or, alternatively, under the terms of the
    475 ordinary General Public License).
    476 
    477   To apply these terms, attach the following notices to the library.  It is
    478 safest to attach them to the start of each source file to most effectively
    479 convey the exclusion of warranty; and each file should have at least the
    480 "copyright" line and a pointer to where the full notice is found.
    481 
    482     <one line to give the library's name and a brief idea of what it does.>
    483     Copyright (C) <year>  <name of author>
    484 
    485     This library is free software; you can redistribute it and/or
    486     modify it under the terms of the GNU Lesser General Public
    487     License as published by the Free Software Foundation; either
    488     version 2.1 of the License, or (at your option) any later version.
    489 
    490     This library is distributed in the hope that it will be useful,
    491     but WITHOUT ANY WARRANTY; without even the implied warranty of
    492     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    493     Lesser General Public License for more details.
    494 
    495     You should have received a copy of the GNU Lesser General Public
    496     License along with this library; if not, write to the Free Software
    497     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    498 
    499 Also add information on how to contact you by electronic and paper mail.
    500 
    501 You should also get your employer (if you work as a programmer) or your
    502 school, if any, to sign a "copyright disclaimer" for the library, if
    503 necessary.  Here is a sample; alter the names:
    504 
    505   Yoyodyne, Inc., hereby disclaims all copyright interest in the
    506   library `Frob' (a library for tweaking knobs) written by James Random Hacker.
    507 
    508   <signature of Ty Coon>, 1 April 1990
    509   Ty Coon, President of Vice
    510 
    511 That's all there is to it!
    512 
    513 
     17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     23THE SOFTWARE.
  • installer/lib/launch4j/head_src/LICENSE.txt

    rd7e9096 r7212f85  
    1                   GNU LESSER GENERAL PUBLIC LICENSE
    2                        Version 2.1, February 1999
     1Copyright (c) 2004, 2008 Grzegorz Kowal
    32
    4  Copyright (C) 1991, 1999 Free Software Foundation, Inc.
    5      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    6  Everyone is permitted to copy and distribute verbatim copies
    7  of this license document, but changing it is not allowed.
     3Permission is hereby granted, free of charge, to any person obtaining a copy
     4of this software and associated documentation files (the "Software"), to deal
     5in the Software without restriction, including without limitation the rights
     6to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     7copies of the Software, and to permit persons to whom the Software is
     8furnished to do so, subject to the following conditions:
    89
    9 [This is the first released version of the Lesser GPL.  It also counts
    10  as the successor of the GNU Library Public License, version 2, hence
    11  the version number 2.1.]
     10The above copyright notice and this permission notice shall be included in
     11all copies or substantial portions of the Software.
    1212
    13                             Preamble
     13Except as contained in this notice, the name(s) of the above copyright holders
     14shall not be used in advertising or otherwise to promote the sale, use or other
     15dealings in this Software without prior written authorization.
    1416
    15   The licenses for most software are designed to take away your
    16 freedom to share and change it.  By contrast, the GNU General Public
    17 Licenses are intended to guarantee your freedom to share and change
    18 free software--to make sure the software is free for all its users.
    19 
    20   This license, the Lesser General Public License, applies to some
    21 specially designated software packages--typically libraries--of the
    22 Free Software Foundation and other authors who decide to use it.  You
    23 can use it too, but we suggest you first think carefully about whether
    24 this license or the ordinary General Public License is the better
    25 strategy to use in any particular case, based on the explanations below.
    26 
    27   When we speak of free software, we are referring to freedom of use,
    28 not price.  Our General Public Licenses are designed to make sure that
    29 you have the freedom to distribute copies of free software (and charge
    30 for this service if you wish); that you receive source code or can get
    31 it if you want it; that you can change the software and use pieces of
    32 it in new free programs; and that you are informed that you can do
    33 these things.
    34 
    35   To protect your rights, we need to make restrictions that forbid
    36 distributors to deny you these rights or to ask you to surrender these
    37 rights.  These restrictions translate to certain responsibilities for
    38 you if you distribute copies of the library or if you modify it.
    39 
    40   For example, if you distribute copies of the library, whether gratis
    41 or for a fee, you must give the recipients all the rights that we gave
    42 you.  You must make sure that they, too, receive or can get the source
    43 code.  If you link other code with the library, you must provide
    44 complete object files to the recipients, so that they can relink them
    45 with the library after making changes to the library and recompiling
    46 it.  And you must show them these terms so they know their rights.
    47 
    48   We protect your rights with a two-step method: (1) we copyright the
    49 library, and (2) we offer you this license, which gives you legal
    50 permission to copy, distribute and/or modify the library.
    51 
    52   To protect each distributor, we want to make it very clear that
    53 there is no warranty for the free library.  Also, if the library is
    54 modified by someone else and passed on, the recipients should know
    55 that what they have is not the original version, so that the original
    56 author's reputation will not be affected by problems that might be
    57 introduced by others.
    58 
    59 
    60   Finally, software patents pose a constant threat to the existence of
    61 any free program.  We wish to make sure that a company cannot
    62 effectively restrict the users of a free program by obtaining a
    63 restrictive license from a patent holder.  Therefore, we insist that
    64 any patent license obtained for a version of the library must be
    65 consistent with the full freedom of use specified in this license.
    66 
    67   Most GNU software, including some libraries, is covered by the
    68 ordinary GNU General Public License.  This license, the GNU Lesser
    69 General Public License, applies to certain designated libraries, and
    70 is quite different from the ordinary General Public License.  We use
    71 this license for certain libraries in order to permit linking those
    72 libraries into non-free programs.
    73 
    74   When a program is linked with a library, whether statically or using
    75 a shared library, the combination of the two is legally speaking a
    76 combined work, a derivative of the original library.  The ordinary
    77 General Public License therefore permits such linking only if the
    78 entire combination fits its criteria of freedom.  The Lesser General
    79 Public License permits more lax criteria for linking other code with
    80 the library.
    81 
    82   We call this license the "Lesser" General Public License because it
    83 does Less to protect the user's freedom than the ordinary General
    84 Public License.  It also provides other free software developers Less
    85 of an advantage over competing non-free programs.  These disadvantages
    86 are the reason we use the ordinary General Public License for many
    87 libraries.  However, the Lesser license provides advantages in certain
    88 special circumstances.
    89 
    90   For example, on rare occasions, there may be a special need to
    91 encourage the widest possible use of a certain library, so that it becomes
    92 a de-facto standard.  To achieve this, non-free programs must be
    93 allowed to use the library.  A more frequent case is that a free
    94 library does the same job as widely used non-free libraries.  In this
    95 case, there is little to gain by limiting the free library to free
    96 software only, so we use the Lesser General Public License.
    97 
    98   In other cases, permission to use a particular library in non-free
    99 programs enables a greater number of people to use a large body of
    100 free software.  For example, permission to use the GNU C Library in
    101 non-free programs enables many more people to use the whole GNU
    102 operating system, as well as its variant, the GNU/Linux operating
    103 system.
    104 
    105   Although the Lesser General Public License is Less protective of the
    106 users' freedom, it does ensure that the user of a program that is
    107 linked with the Library has the freedom and the wherewithal to run
    108 that program using a modified version of the Library.
    109 
    110   The precise terms and conditions for copying, distribution and
    111 modification follow.  Pay close attention to the difference between a
    112 "work based on the library" and a "work that uses the library".  The
    113 former contains code derived from the library, whereas the latter must
    114 be combined with the library in order to run.
    115 
    116 
    117                   GNU LESSER GENERAL PUBLIC LICENSE
    118    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
    119 
    120   0. This License Agreement applies to any software library or other
    121 program which contains a notice placed by the copyright holder or
    122 other authorized party saying it may be distributed under the terms of
    123 this Lesser General Public License (also called "this License").
    124 Each licensee is addressed as "you".
    125 
    126   A "library" means a collection of software functions and/or data
    127 prepared so as to be conveniently linked with application programs
    128 (which use some of those functions and data) to form executables.
    129 
    130   The "Library", below, refers to any such software library or work
    131 which has been distributed under these terms.  A "work based on the
    132 Library" means either the Library or any derivative work under
    133 copyright law: that is to say, a work containing the Library or a
    134 portion of it, either verbatim or with modifications and/or translated
    135 straightforwardly into another language.  (Hereinafter, translation is
    136 included without limitation in the term "modification".)
    137 
    138   "Source code" for a work means the preferred form of the work for
    139 making modifications to it.  For a library, complete source code means
    140 all the source code for all modules it contains, plus any associated
    141 interface definition files, plus the scripts used to control compilation
    142 and installation of the library.
    143 
    144   Activities other than copying, distribution and modification are not
    145 covered by this License; they are outside its scope.  The act of
    146 running a program using the Library is not restricted, and output from
    147 such a program is covered only if its contents constitute a work based
    148 on the Library (independent of the use of the Library in a tool for
    149 writing it).  Whether that is true depends on what the Library does
    150 and what the program that uses the Library does.
    151  
    152   1. You may copy and distribute verbatim copies of the Library's
    153 complete source code as you receive it, in any medium, provided that
    154 you conspicuously and appropriately publish on each copy an
    155 appropriate copyright notice and disclaimer of warranty; keep intact
    156 all the notices that refer to this License and to the absence of any
    157 warranty; and distribute a copy of this License along with the
    158 Library.
    159 
    160   You may charge a fee for the physical act of transferring a copy,
    161 and you may at your option offer warranty protection in exchange for a
    162 fee.
    163 
    164 
    165   2. You may modify your copy or copies of the Library or any portion
    166 of it, thus forming a work based on the Library, and copy and
    167 distribute such modifications or work under the terms of Section 1
    168 above, provided that you also meet all of these conditions:
    169 
    170     a) The modified work must itself be a software library.
    171 
    172     b) You must cause the files modified to carry prominent notices
    173     stating that you changed the files and the date of any change.
    174 
    175     c) You must cause the whole of the work to be licensed at no
    176     charge to all third parties under the terms of this License.
    177 
    178     d) If a facility in the modified Library refers to a function or a
    179     table of data to be supplied by an application program that uses
    180     the facility, other than as an argument passed when the facility
    181     is invoked, then you must make a good faith effort to ensure that,
    182     in the event an application does not supply such function or
    183     table, the facility still operates, and performs whatever part of
    184     its purpose remains meaningful.
    185 
    186     (For example, a function in a library to compute square roots has
    187     a purpose that is entirely well-defined independent of the
    188     application.  Therefore, Subsection 2d requires that any
    189     application-supplied function or table used by this function must
    190     be optional: if the application does not supply it, the square
    191     root function must still compute square roots.)
    192 
    193 These requirements apply to the modified work as a whole.  If
    194 identifiable sections of that work are not derived from the Library,
    195 and can be reasonably considered independent and separate works in
    196 themselves, then this License, and its terms, do not apply to those
    197 sections when you distribute them as separate works.  But when you
    198 distribute the same sections as part of a whole which is a work based
    199 on the Library, the distribution of the whole must be on the terms of
    200 this License, whose permissions for other licensees extend to the
    201 entire whole, and thus to each and every part regardless of who wrote
    202 it.
    203 
    204 Thus, it is not the intent of this section to claim rights or contest
    205 your rights to work written entirely by you; rather, the intent is to
    206 exercise the right to control the distribution of derivative or
    207 collective works based on the Library.
    208 
    209 In addition, mere aggregation of another work not based on the Library
    210 with the Library (or with a work based on the Library) on a volume of
    211 a storage or distribution medium does not bring the other work under
    212 the scope of this License.
    213 
    214   3. You may opt to apply the terms of the ordinary GNU General Public
    215 License instead of this License to a given copy of the Library.  To do
    216 this, you must alter all the notices that refer to this License, so
    217 that they refer to the ordinary GNU General Public License, version 2,
    218 instead of to this License.  (If a newer version than version 2 of the
    219 ordinary GNU General Public License has appeared, then you can specify
    220 that version instead if you wish.)  Do not make any other change in
    221 these notices.
    222 
    223 
    224   Once this change is made in a given copy, it is irreversible for
    225 that copy, so the ordinary GNU General Public License applies to all
    226 subsequent copies and derivative works made from that copy.
    227 
    228   This option is useful when you wish to copy part of the code of
    229 the Library into a program that is not a library.
    230 
    231   4. You may copy and distribute the Library (or a portion or
    232 derivative of it, under Section 2) in object code or executable form
    233 under the terms of Sections 1 and 2 above provided that you accompany
    234 it with the complete corresponding machine-readable source code, which
    235 must be distributed under the terms of Sections 1 and 2 above on a
    236 medium customarily used for software interchange.
    237 
    238   If distribution of object code is made by offering access to copy
    239 from a designated place, then offering equivalent access to copy the
    240 source code from the same place satisfies the requirement to
    241 distribute the source code, even though third parties are not
    242 compelled to copy the source along with the object code.
    243 
    244   5. A program that contains no derivative of any portion of the
    245 Library, but is designed to work with the Library by being compiled or
    246 linked with it, is called a "work that uses the Library".  Such a
    247 work, in isolation, is not a derivative work of the Library, and
    248 therefore falls outside the scope of this License.
    249 
    250   However, linking a "work that uses the Library" with the Library
    251 creates an executable that is a derivative of the Library (because it
    252 contains portions of the Library), rather than a "work that uses the
    253 library".  The executable is therefore covered by this License.
    254 Section 6 states terms for distribution of such executables.
    255 
    256   When a "work that uses the Library" uses material from a header file
    257 that is part of the Library, the object code for the work may be a
    258 derivative work of the Library even though the source code is not.
    259 Whether this is true is especially significant if the work can be
    260 linked without the Library, or if the work is itself a library.  The
    261 threshold for this to be true is not precisely defined by law.
    262 
    263   If such an object file uses only numerical parameters, data
    264 structure layouts and accessors, and small macros and small inline
    265 functions (ten lines or less in length), then the use of the object
    266 file is unrestricted, regardless of whether it is legally a derivative
    267 work.  (Executables containing this object code plus portions of the
    268 Library will still fall under Section 6.)
    269 
    270   Otherwise, if the work is a derivative of the Library, you may
    271 distribute the object code for the work under the terms of Section 6.
    272 Any executables containing that work also fall under Section 6,
    273 whether or not they are linked directly with the Library itself.
    274 
    275 
    276   6. As an exception to the Sections above, you may also combine or
    277 link a "work that uses the Library" with the Library to produce a
    278 work containing portions of the Library, and distribute that work
    279 under terms of your choice, provided that the terms permit
    280 modification of the work for the customer's own use and reverse
    281 engineering for debugging such modifications.
    282 
    283   You must give prominent notice with each copy of the work that the
    284 Library is used in it and that the Library and its use are covered by
    285 this License.  You must supply a copy of this License.  If the work
    286 during execution displays copyright notices, you must include the
    287 copyright notice for the Library among them, as well as a reference
    288 directing the user to the copy of this License.  Also, you must do one
    289 of these things:
    290 
    291     a) Accompany the work with the complete corresponding
    292     machine-readable source code for the Library including whatever
    293     changes were used in the work (which must be distributed under
    294     Sections 1 and 2 above); and, if the work is an executable linked
    295     with the Library, with the complete machine-readable "work that
    296     uses the Library", as object code and/or source code, so that the
    297     user can modify the Library and then relink to produce a modified
    298     executable containing the modified Library.  (It is understood
    299     that the user who changes the contents of definitions files in the
    300     Library will not necessarily be able to recompile the application
    301     to use the modified definitions.)
    302 
    303     b) Use a suitable shared library mechanism for linking with the
    304     Library.  A suitable mechanism is one that (1) uses at run time a
    305     copy of the library already present on the user's computer system,
    306     rather than copying library functions into the executable, and (2)
    307     will operate properly with a modified version of the library, if
    308     the user installs one, as long as the modified version is
    309     interface-compatible with the version that the work was made with.
    310 
    311     c) Accompany the work with a written offer, valid for at
    312     least three years, to give the same user the materials
    313     specified in Subsection 6a, above, for a charge no more
    314     than the cost of performing this distribution.
    315 
    316     d) If distribution of the work is made by offering access to copy
    317     from a designated place, offer equivalent access to copy the above
    318     specified materials from the same place.
    319 
    320     e) Verify that the user has already received a copy of these
    321     materials or that you have already sent this user a copy.
    322 
    323   For an executable, the required form of the "work that uses the
    324 Library" must include any data and utility programs needed for
    325 reproducing the executable from it.  However, as a special exception,
    326 the materials to be distributed need not include anything that is
    327 normally distributed (in either source or binary form) with the major
    328 components (compiler, kernel, and so on) of the operating system on
    329 which the executable runs, unless that component itself accompanies
    330 the executable.
    331 
    332   It may happen that this requirement contradicts the license
    333 restrictions of other proprietary libraries that do not normally
    334 accompany the operating system.  Such a contradiction means you cannot
    335 use both them and the Library together in an executable that you
    336 distribute.
    337 
    338 
    339   7. You may place library facilities that are a work based on the
    340 Library side-by-side in a single library together with other library
    341 facilities not covered by this License, and distribute such a combined
    342 library, provided that the separate distribution of the work based on
    343 the Library and of the other library facilities is otherwise
    344 permitted, and provided that you do these two things:
    345 
    346     a) Accompany the combined library with a copy of the same work
    347     based on the Library, uncombined with any other library
    348     facilities.  This must be distributed under the terms of the
    349     Sections above.
    350 
    351     b) Give prominent notice with the combined library of the fact
    352     that part of it is a work based on the Library, and explaining
    353     where to find the accompanying uncombined form of the same work.
    354 
    355   8. You may not copy, modify, sublicense, link with, or distribute
    356 the Library except as expressly provided under this License.  Any
    357 attempt otherwise to copy, modify, sublicense, link with, or
    358 distribute the Library is void, and will automatically terminate your
    359 rights under this License.  However, parties who have received copies,
    360 or rights, from you under this License will not have their licenses
    361 terminated so long as such parties remain in full compliance.
    362 
    363   9. You are not required to accept this License, since you have not
    364 signed it.  However, nothing else grants you permission to modify or
    365 distribute the Library or its derivative works.  These actions are
    366 prohibited by law if you do not accept this License.  Therefore, by
    367 modifying or distributing the Library (or any work based on the
    368 Library), you indicate your acceptance of this License to do so, and
    369 all its terms and conditions for copying, distributing or modifying
    370 the Library or works based on it.
    371 
    372   10. Each time you redistribute the Library (or any work based on the
    373 Library), the recipient automatically receives a license from the
    374 original licensor to copy, distribute, link with or modify the Library
    375 subject to these terms and conditions.  You may not impose any further
    376 restrictions on the recipients' exercise of the rights granted herein.
    377 You are not responsible for enforcing compliance by third parties with
    378 this License.
    379 
    380 
    381   11. If, as a consequence of a court judgment or allegation of patent
    382 infringement or for any other reason (not limited to patent issues),
    383 conditions are imposed on you (whether by court order, agreement or
    384 otherwise) that contradict the conditions of this License, they do not
    385 excuse you from the conditions of this License.  If you cannot
    386 distribute so as to satisfy simultaneously your obligations under this
    387 License and any other pertinent obligations, then as a consequence you
    388 may not distribute the Library at all.  For example, if a patent
    389 license would not permit royalty-free redistribution of the Library by
    390 all those who receive copies directly or indirectly through you, then
    391 the only way you could satisfy both it and this License would be to
    392 refrain entirely from distribution of the Library.
    393 
    394 If any portion of this section is held invalid or unenforceable under any
    395 particular circumstance, the balance of the section is intended to apply,
    396 and the section as a whole is intended to apply in other circumstances.
    397 
    398 It is not the purpose of this section to induce you to infringe any
    399 patents or other property right claims or to contest validity of any
    400 such claims; this section has the sole purpose of protecting the
    401 integrity of the free software distribution system which is
    402 implemented by public license practices.  Many people have made
    403 generous contributions to the wide range of software distributed
    404 through that system in reliance on consistent application of that
    405 system; it is up to the author/donor to decide if he or she is willing
    406 to distribute software through any other system and a licensee cannot
    407 impose that choice.
    408 
    409 This section is intended to make thoroughly clear what is believed to
    410 be a consequence of the rest of this License.
    411 
    412   12. If the distribution and/or use of the Library is restricted in
    413 certain countries either by patents or by copyrighted interfaces, the
    414 original copyright holder who places the Library under this License may add
    415 an explicit geographical distribution limitation excluding those countries,
    416 so that distribution is permitted only in or among countries not thus
    417 excluded.  In such case, this License incorporates the limitation as if
    418 written in the body of this License.
    419 
    420   13. The Free Software Foundation may publish revised and/or new
    421 versions of the Lesser General Public License from time to time.
    422 Such new versions will be similar in spirit to the present version,
    423 but may differ in detail to address new problems or concerns.
    424 
    425 Each version is given a distinguishing version number.  If the Library
    426 specifies a version number of this License which applies to it and
    427 "any later version", you have the option of following the terms and
    428 conditions either of that version or of any later version published by
    429 the Free Software Foundation.  If the Library does not specify a
    430 license version number, you may choose any version ever published by
    431 the Free Software Foundation.
    432 
    433 
    434   14. If you wish to incorporate parts of the Library into other free
    435 programs whose distribution conditions are incompatible with these,
    436 write to the author to ask for permission.  For software which is
    437 copyrighted by the Free Software Foundation, write to the Free
    438 Software Foundation; we sometimes make exceptions for this.  Our
    439 decision will be guided by the two goals of preserving the free status
    440 of all derivatives of our free software and of promoting the sharing
    441 and reuse of software generally.
    442 
    443                             NO WARRANTY
    444 
    445   15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
    446 WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
    447 EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
    448 OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
    449 KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
    450 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    451 PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
    452 LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
    453 THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
    454 
    455   16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
    456 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
    457 AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
    458 FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
    459 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
    460 LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
    461 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
    462 FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
    463 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
    464 DAMAGES.
    465 
    466                      END OF TERMS AND CONDITIONS
    467 
    468 
    469            How to Apply These Terms to Your New Libraries
    470 
    471   If you develop a new library, and you want it to be of the greatest
    472 possible use to the public, we recommend making it free software that
    473 everyone can redistribute and change.  You can do so by permitting
    474 redistribution under these terms (or, alternatively, under the terms of the
    475 ordinary General Public License).
    476 
    477   To apply these terms, attach the following notices to the library.  It is
    478 safest to attach them to the start of each source file to most effectively
    479 convey the exclusion of warranty; and each file should have at least the
    480 "copyright" line and a pointer to where the full notice is found.
    481 
    482     <one line to give the library's name and a brief idea of what it does.>
    483     Copyright (C) <year>  <name of author>
    484 
    485     This library is free software; you can redistribute it and/or
    486     modify it under the terms of the GNU Lesser General Public
    487     License as published by the Free Software Foundation; either
    488     version 2.1 of the License, or (at your option) any later version.
    489 
    490     This library is distributed in the hope that it will be useful,
    491     but WITHOUT ANY WARRANTY; without even the implied warranty of
    492     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    493     Lesser General Public License for more details.
    494 
    495     You should have received a copy of the GNU Lesser General Public
    496     License along with this library; if not, write to the Free Software
    497     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    498 
    499 Also add information on how to contact you by electronic and paper mail.
    500 
    501 You should also get your employer (if you work as a programmer) or your
    502 school, if any, to sign a "copyright disclaimer" for the library, if
    503 necessary.  Here is a sample; alter the names:
    504 
    505   Yoyodyne, Inc., hereby disclaims all copyright interest in the
    506   library `Frob' (a library for tweaking knobs) written by James Random Hacker.
    507 
    508   <signature of Ty Coon>, 1 April 1990
    509   Ty Coon, President of Vice
    510 
    511 That's all there is to it!
    512 
    513 
     17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     23THE SOFTWARE.
  • installer/lib/launch4j/head_src/consolehead/Makefile.win

    rd7e9096 r7212f85  
    66WINDRES = windres.exe
    77RES  =
    8 OBJ  = consolehead.o ../head.o $(RES)
    9 LINKOBJ  = consolehead.o ../head.o $(RES)
    10 LIBS =  -L"lib"  -s
    11 INCS =  -I"include"
    12 CXXINCS =  -I"lib/gcc/mingw32/3.4.2/include"  -I"include/c++/3.4.2/backward"  -I"include/c++/3.4.2/mingw32"  -I"include/c++/3.4.2"  -I"include"
     8OBJ  = ../../head/consolehead.o ../../head/head.o $(RES)
     9LINKOBJ  = ../../head/consolehead.o ../../head/head.o $(RES)
     10LIBS =  -L"C:/Dev-Cpp/lib" -n  -s
     11INCS =  -I"C:/Dev-Cpp/include"
     12CXXINCS =  -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/Dev-Cpp/include/c++/3.4.2"  -I"C:/Dev-Cpp/include"
    1313BIN  = consolehead.exe
    1414CXXFLAGS = $(CXXINCS)   -fexpensive-optimizations -O3
     
    2525
    2626$(BIN): $(OBJ)
    27         $(CC) $(LINKOBJ) -o "consolehead.exe" $(LIBS)
     27#       $(CC) $(LINKOBJ) -o "consolehead.exe" $(LIBS)
    2828
    29 consolehead.o: consolehead.c
    30         $(CC) -c consolehead.c -o consolehead.o $(CFLAGS)
     29../../head/consolehead.o: consolehead.c
     30        $(CC) -c consolehead.c -o ../../head/consolehead.o $(CFLAGS)
    3131
    32 ../head.o: ../head.c
    33         $(CC) -c ../head.c -o ../head.o $(CFLAGS)
     32../../head/head.o: ../head.c
     33        $(CC) -c ../head.c -o ../../head/head.o $(CFLAGS)
  • installer/lib/launch4j/head_src/consolehead/consolehead.c

    rd7e9096 r7212f85  
    11/*
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
    24
    3         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    4         Copyright (C) 2004-2005 Grzegorz Kowal
     5        Copyright (c) 2004, 2007 Grzegorz Kowal
    56
    6         Compiled with Mingw port of GCC, Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
     7        Permission is hereby granted, free of charge, to any person obtaining a copy
     8        of this software and associated documentation files (the "Software"), to deal
     9        in the Software without restriction, including without limitation the rights
     10        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     11        copies of the Software, and to permit persons to whom the Software is
     12        furnished to do so, subject to the following conditions:
    713
    8         This library is free software; you can redistribute it and/or
    9         modify it under the terms of the GNU Lesser General Public
    10         License as published by the Free Software Foundation; either
    11         version 2.1 of the License, or (at your option) any later version.
     14        The above copyright notice and this permission notice shall be included in
     15        all copies or substantial portions of the Software.
    1216
    13         This library is distributed in the hope that it will be useful,
    14         but WITHOUT ANY WARRANTY; without even the implied warranty of
    15         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    16         Lesser General Public License for more details.
     17        Except as contained in this notice, the name(s) of the above copyright holders
     18        shall not be used in advertising or otherwise to promote the sale, use or other
     19        dealings in this Software without prior written authorization.
    1720
    18         You should have received a copy of the GNU Lesser General Public
    19         License along with this library; if not, write to the Free Software
    20         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    21 
     21        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     22        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     23        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     24        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     25        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     26        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     27        THE SOFTWARE.
    2228*/
    2329
     
    2834{
    2935    setConsoleFlag();
    30         HMODULE hLibrary = NULL;
    31         char cmdLine[BIG_STR] = "";
    32     int i; // causes error: 'for' loop initial declaration used outside C99 mode.
    33         for (i = 1; i < argc; i++) {
    34                 strcat(cmdLine, argv[i]);
    35                 if (i < argc - 1) {
    36                         strcat(cmdLine, " ");
     36        LPTSTR cmdLine = GetCommandLine();
     37        if (*cmdLine == '"') {
     38                if (*(cmdLine = strchr(cmdLine + 1, '"') + 1)) {
     39                        cmdLine++;
    3740                }
     41        } else if ((cmdLine = strchr(cmdLine, ' ')) != NULL) {
     42                cmdLine++;
     43        } else {
     44                cmdLine = "";
    3845        }
    39         if (!prepare(hLibrary, cmdLine)) {
    40                 if (hLibrary != NULL) {
    41                         FreeLibrary(hLibrary);
    42                 }
     46        int result = prepare(cmdLine);
     47        if (result == ERROR_ALREADY_EXISTS) {
     48                char errMsg[BIG_STR] = {0};
     49                loadString(INSTANCE_ALREADY_EXISTS_MSG, errMsg);
     50                msgBox(errMsg);
     51                closeLogFile();
     52                return 2;
     53        }
     54        if (result != TRUE) {
     55                signalError();
    4356                return 1;
    4457        }
    45         FreeLibrary(hLibrary);
    4658
    47         int result = (int) execute(TRUE);
     59        result = (int) execute(TRUE);
    4860        if (result == -1) {
    49                 char errMsg[BIG_STR] = "could not start the application: ";
    50                 strcat(errMsg, strerror(errno));
    51                 msgBox(errMsg);
    52                 return 1;
     61                signalError();
    5362        } else {
    5463                return result;
  • installer/lib/launch4j/head_src/consolehead/consolehead.dev

    rd7e9096 r7212f85  
    88Includes=
    99Libs=
    10 PrivateResource=consolehead_private.rc
     10PrivateResource=
    1111ResourceIncludes=
    1212MakeIncludes=
    1313Compiler=
    1414CppCompiler=
    15 Linker=
     15Linker=-n_@@_
    1616IsCpp=0
    1717Icon=
    1818ExeOutput=
    19 ObjectOutput=
     19ObjectOutput=..\..\head
    2020OverrideOutput=0
    2121OverrideOutputName=consolehead.exe
     
    2424CommandLine=
    2525UseCustomMakefile=0
    26 CustomMakefile=
     26CustomMakefile=Makefile.win
    2727IncludeVersionInfo=0
    2828SupportXPThemes=0
  • installer/lib/launch4j/head_src/guihead/Makefile.win

    rd7e9096 r7212f85  
    66WINDRES = windres.exe
    77RES  =
    8 OBJ  = guihead.o ../head.o $(RES)
    9 LINKOBJ  = guihead.o ../head.o $(RES)
    10 LIBS =  -L"lib" -mwindows 
    11 INCS =  -I"include"
    12 CXXINCS =  -I"lib/gcc/mingw32/3.4.2/include"  -I"include/c++/3.4.2/backward"  -I"include/c++/3.4.2/mingw32"  -I"include/c++/3.4.2"  -I"include"
     8OBJ  = ../../head/guihead.o ../../head/head.o $(RES)
     9LINKOBJ  = ../../head/guihead.o ../../head/head.o $(RES)
     10LIBS =  -L"C:/Dev-Cpp/lib" -mwindows -n  -s
     11INCS =  -I"C:/Dev-Cpp/include"
     12CXXINCS =  -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/Dev-Cpp/include/c++/3.4.2"  -I"C:/Dev-Cpp/include"
    1313BIN  = guihead.exe
    1414CXXFLAGS = $(CXXINCS)   -fexpensive-optimizations -O3
     
    2525
    2626$(BIN): $(OBJ)
    27         $(CC) $(LINKOBJ) -o "guihead.exe" $(LIBS)
     27#       $(CC) $(LINKOBJ) -o "guihead.exe" $(LIBS)
    2828
    29 guihead.o: guihead.c
    30         $(CC) -c guihead.c -o guihead.o $(CFLAGS)
     29../../head/guihead.o: guihead.c
     30        $(CC) -c guihead.c -o ../../head/guihead.o $(CFLAGS)
    3131
    32 ../head.o: ../head.c
    33         $(CC) -c ../head.c -o ../head.o $(CFLAGS)
     32../../head/head.o: ../head.c
     33        $(CC) -c ../head.c -o ../../head/head.o $(CFLAGS)
  • installer/lib/launch4j/head_src/guihead/guihead.c

    rd7e9096 r7212f85  
    11/*
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
    24
    3         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    4         Copyright (C) 2004-2005 Grzegorz Kowal
     5        Copyright (c) 2004, 2007 Grzegorz Kowal
     6                                                         Sylvain Mina (single instance patch)
    57
    6         Compiled with Mingw port of GCC, Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
     8        Permission is hereby granted, free of charge, to any person obtaining a copy
     9        of this software and associated documentation files (the "Software"), to deal
     10        in the Software without restriction, including without limitation the rights
     11        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     12        copies of the Software, and to permit persons to whom the Software is
     13        furnished to do so, subject to the following conditions:
    714
    8         This library is free software; you can redistribute it and/or
    9         modify it under the terms of the GNU Lesser General Public
    10         License as published by the Free Software Foundation; either
    11         version 2.1 of the License, or (at your option) any later version.
     15        The above copyright notice and this permission notice shall be included in
     16        all copies or substantial portions of the Software.
    1217
    13         This library is distributed in the hope that it will be useful,
    14         but WITHOUT ANY WARRANTY; without even the implied warranty of
    15         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    16         Lesser General Public License for more details.
     18        Except as contained in this notice, the name(s) of the above copyright holders
     19        shall not be used in advertising or otherwise to promote the sale, use or other
     20        dealings in this Software without prior written authorization.
    1721
    18         You should have received a copy of the GNU Lesser General Public
    19         License along with this library; if not, write to the Free Software
    20         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    21 
     22        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     23        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     24        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     25        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     26        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     27        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     28        THE SOFTWARE.
    2229*/
    2330
     
    2633#include "guihead.h"
    2734
     35extern FILE* hLog;
    2836extern PROCESS_INFORMATION pi;
    2937
     
    3442BOOL splashTimeoutErr;
    3543BOOL waitForWindow;
    36 int splashTimeout;              // tick count (s)
     44int splashTimeout = DEFAULT_SPLASH_TIMEOUT;
    3745
    3846int APIENTRY WinMain(HINSTANCE hInstance,
     
    4048                     LPSTR     lpCmdLine,
    4149                     int       nCmdShow) {
    42         HMODULE hLibrary = NULL;
    43         if (!prepare(hLibrary, lpCmdLine)) {
    44                 if (hLibrary != NULL) {
    45                         FreeLibrary(hLibrary);
    46                 }
     50        int result = prepare(lpCmdLine);
     51        if (result == ERROR_ALREADY_EXISTS) {
     52                HWND handle = getInstanceWindow();
     53                ShowWindow(handle, SW_SHOW);
     54                SetForegroundWindow(handle);
     55                closeLogFile();
     56                return 2;
     57        }
     58        if (result != TRUE) {
     59                signalError();
    4760                return 1;
    4861        }
    4962
    50         splash = loadBoolString(hLibrary, SHOW_SPLASH);
    51         stayAlive = loadBoolString(hLibrary, GUI_HEADER_STAYS_ALIVE);
     63        splash = loadBool(SHOW_SPLASH)
     64                        && strstr(lpCmdLine, "--l4j-no-splash") == NULL;
     65        stayAlive = loadBool(GUI_HEADER_STAYS_ALIVE)
     66                        && strstr(lpCmdLine, "--l4j-dont-wait") == NULL;
    5267        if (splash || stayAlive) {
    5368                hWnd = CreateWindowEx(WS_EX_TOOLWINDOW, "STATIC", "",
     
    5570                                0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
    5671                if (splash) {
    57                         char timeout[10] = "";
    58                         if (!loadString(hLibrary, SPLASH_TIMEOUT, timeout)) {
    59                                 msgBox("Cannot load splash timeout property.");
    60                                 return 1;
     72                        char timeout[10] = {0};
     73                        if (loadString(SPLASH_TIMEOUT, timeout)) {
     74                                splashTimeout = atoi(timeout);
     75                                if (splashTimeout <= 0 || splashTimeout > MAX_SPLASH_TIMEOUT) {
     76                                        splashTimeout = DEFAULT_SPLASH_TIMEOUT;
     77                                }
    6178                        }
    62                         splashTimeout = atoi(timeout);
    63                         if (splashTimeout <= 0 || splashTimeout > 60 * 15 /* 15 minutes */) {
    64                                 msgBox("Invalid splash timeout property.");
    65                                 return 1;
    66                         }
    67                         splashTimeoutErr = loadBoolString(hLibrary, SPLASH_TIMEOUT_ERR);
    68                         waitForWindow = loadBoolString(hLibrary, SPLASH_WAITS_FOR_WINDOW);
     79                        splashTimeoutErr = loadBool(SPLASH_TIMEOUT_ERR)
     80                                        && strstr(lpCmdLine, "--l4j-no-splash-err") == NULL;
     81                        waitForWindow = loadBool(SPLASH_WAITS_FOR_WINDOW);
    6982                        HANDLE hImage = LoadImage(hInstance,    // handle of the instance containing the image
    7083                                        MAKEINTRESOURCE(SPLASH_BITMAP), // name or identifier of image
     
    7487                                        LR_DEFAULTSIZE);
    7588                        if (hImage == NULL) {
    76                                 msgBox("Cannot load splash screen.");
     89                                signalError();
    7790                                return 1;
    7891                        }
     
    87100                }
    88101                if (!SetTimer (hWnd, ID_TIMER, 1000 /* 1s */, TimerProc)) {
     102                        signalError();
    89103                        return 1;
    90104                }
    91105        }
    92         FreeLibrary(hLibrary);
    93106        if (execute(FALSE) == -1) {
    94                 char errMsg[BIG_STR] = "Error occured while starting the application...\n";
    95                 strcat(errMsg, strerror(errno));
    96                 msgBox(errMsg);
     107                signalError();
    97108                return 1;
    98109        }
    99110        if (!(splash || stayAlive)) {
     111                debug("Exit code:\t0\n");
    100112                closeHandles();
    101113                return 0;
    102114        }
     115
    103116        MSG msg;
    104117        while (GetMessage(&msg, NULL, 0, 0)) {
     
    106119                DispatchMessage(&msg);
    107120        }
     121        debug("Exit code:\t%d\n", dwExitCode);
    108122        closeHandles();
    109123        return dwExitCode;
     124}
     125
     126HWND getInstanceWindow() {
     127        char windowTitle[STR];
     128        char instWindowTitle[STR] = {0};
     129        if (loadString(INSTANCE_WINDOW_TITLE, instWindowTitle)) {
     130                HWND handle = FindWindowEx(NULL, NULL, NULL, NULL);
     131                while (handle != NULL) {
     132                        GetWindowText(handle, windowTitle, STR - 1);
     133                        if (strstr(windowTitle, instWindowTitle) != NULL) {
     134                                return handle;
     135                        } else {
     136                                handle = FindWindowEx(NULL, handle, NULL, NULL);
     137                        }
     138                }
     139        }
     140        return NULL;   
    110141}
    111142
     
    136167                        if (waitForWindow && splashTimeoutErr) {
    137168                                KillTimer(hwnd, ID_TIMER);
    138                                 msgBox("Could not start the application, operation timed out.");
     169                                signalError();
    139170                                PostQuitMessage(0);
    140171                        }
     
    150181                        || !(splash || stayAlive)) {
    151182                KillTimer(hWnd, ID_TIMER);
    152                 PostQuitMessage(0);     
    153                 return;
     183                PostQuitMessage(0);
    154184        }
    155185}
  • installer/lib/launch4j/head_src/guihead/guihead.dev

    rd7e9096 r7212f85  
    1313Compiler=
    1414CppCompiler=
    15 Linker=_@@_
     15Linker=-n_@@_
    1616IsCpp=0
    1717Icon=
    1818ExeOutput=
    19 ObjectOutput=
     19ObjectOutput=..\..\head
    2020OverrideOutput=0
    2121OverrideOutputName=guihead.exe
     
    2323Folders=
    2424CommandLine=
    25 UseCustomMakefile=0
    26 CustomMakefile=
     25UseCustomMakefile=1
     26CustomMakefile=Makefile.win
    2727IncludeVersionInfo=0
    2828SupportXPThemes=0
    2929CompilerSet=0
    30 CompilerSettings=0000000001001000000000
     30CompilerSettings=0000000001001000000100
    3131
    3232[Unit1]
     
    3838Priority=1000
    3939OverrideBuildCmd=0
    40 BuildCmd=
     40BuildCmd=$(CC) -c guihead.c -o ../../head/guihead.o $(CFLAGS)
    4141
    4242[Unit2]
     
    7979
    8080[Unit6]
    81 FileName=..\resource.h
    82 Folder=guihead
    83 Compile=1
    84 Link=1
    85 Priority=1000
    86 OverrideBuildCmd=0
    87 BuildCmd=
    88 CompileCpp=0
    89 
    90 [Unit7]
    9181FileName=..\resid.h
    9282CompileCpp=0
  • installer/lib/launch4j/head_src/guihead/guihead.h

    rd7e9096 r7212f85  
    11/*
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
    24
    3         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    4         Copyright (C) 2004-2005 Grzegorz Kowal
     5        Copyright (c) 2004, 2007 Grzegorz Kowal
    56
    6         Compiled with Mingw port of GCC, Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
     7        Permission is hereby granted, free of charge, to any person obtaining a copy
     8        of this software and associated documentation files (the "Software"), to deal
     9        in the Software without restriction, including without limitation the rights
     10        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     11        copies of the Software, and to permit persons to whom the Software is
     12        furnished to do so, subject to the following conditions:
    713
    8         This library is free software; you can redistribute it and/or
    9         modify it under the terms of the GNU Lesser General Public
    10         License as published by the Free Software Foundation; either
    11         version 2.1 of the License, or (at your option) any later version.
     14        The above copyright notice and this permission notice shall be included in
     15        all copies or substantial portions of the Software.
    1216
    13         This library is distributed in the hope that it will be useful,
    14         but WITHOUT ANY WARRANTY; without even the implied warranty of
    15         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    16         Lesser General Public License for more details.
     17        Except as contained in this notice, the name(s) of the above copyright holders
     18        shall not be used in advertising or otherwise to promote the sale, use or other
     19        dealings in this Software without prior written authorization.
    1720
    18         You should have received a copy of the GNU Lesser General Public
    19         License along with this library; if not, write to the Free Software
    20         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    21 
     21        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     22        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     23        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     24        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     25        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     26        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     27        THE SOFTWARE.
    2228*/
    2329
    2430#define ID_TIMER 1
     31#define DEFAULT_SPLASH_TIMEOUT  60                      /* 60 seconds */
     32#define MAX_SPLASH_TIMEOUT              60 * 15         /* 15 minutes */
     33
     34HWND getInstanceWindow();
     35
     36BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam);
    2537
    2638VOID CALLBACK TimerProc(
  • installer/lib/launch4j/head_src/head.c

    rd7e9096 r7212f85  
    11/*
    2 
    3         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    4         Copyright (C) 2004-2005 Grzegorz Kowal
    5 
    6         Compiled with Mingw port of GCC, Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
    7 
    8         This library is free software; you can redistribute it and/or
    9         modify it under the terms of the GNU Lesser General Public
    10         License as published by the Free Software Foundation; either
    11         version 2.1 of the License, or (at your option) any later version.
    12 
    13         This library is distributed in the hope that it will be useful,
    14         but WITHOUT ANY WARRANTY; without even the implied warranty of
    15         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    16         Lesser General Public License for more details.
    17 
    18         You should have received a copy of the GNU Lesser General Public
    19         License along with this library; if not, write to the Free Software
    20         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    21 
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
     4
     5        Copyright (c) 2004, 2008 Grzegorz Kowal,
     6                                                         Ian Roberts (jdk preference patch)
     7                                                         Sylvain Mina (single instance patch)
     8
     9        Permission is hereby granted, free of charge, to any person obtaining a copy
     10        of this software and associated documentation files (the "Software"), to deal
     11        in the Software without restriction, including without limitation the rights
     12        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     13        copies of the Software, and to permit persons to whom the Software is
     14        furnished to do so, subject to the following conditions:
     15
     16        The above copyright notice and this permission notice shall be included in
     17        all copies or substantial portions of the Software.
     18
     19        Except as contained in this notice, the name(s) of the above copyright holders
     20        shall not be used in advertising or otherwise to promote the sale, use or other
     21        dealings in this Software without prior written authorization.
     22
     23        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     24        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     25        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     26        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     27        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     28        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     29        THE SOFTWARE.
    2230*/
    2331
     
    2533#include "head.h"
    2634
     35HMODULE hModule;
     36FILE* hLog;
    2737BOOL console = FALSE;
     38BOOL wow64 = FALSE;
    2839int foundJava = NO_JAVA_FOUND;
    2940
    3041struct _stat statBuf;
    3142PROCESS_INFORMATION pi;
    32 
    33 char errTitle[STR] = "launch4j";
    34 char javaMinVer[STR] = "";
    35 char javaMaxVer[STR] = "";
    36 char foundJavaVer[STR] = "";
    37 
    38 char workingDir[_MAX_PATH] = "";
    39 char cmd[_MAX_PATH] = "";
    40 char args[BIG_STR * 2] = "";
     43DWORD priority;
     44
     45char mutexName[STR] = {0};
     46
     47char errUrl[256] = {0};
     48char errTitle[STR] = "Launch4j";
     49char errMsg[BIG_STR] = {0};
     50
     51char javaMinVer[STR] = {0};
     52char javaMaxVer[STR] = {0};
     53char foundJavaVer[STR] = {0};
     54char foundJavaKey[_MAX_PATH] = {0};
     55
     56char oldPwd[_MAX_PATH] = {0};
     57char workingDir[_MAX_PATH] = {0};
     58char cmd[_MAX_PATH] = {0};
     59char args[MAX_ARGS] = {0};
     60
     61FILE* openLogFile(const char* exePath, const int pathLen) {
     62        char path[_MAX_PATH] = {0};
     63        strncpy(path, exePath, pathLen);
     64        strcat(path, "\\launch4j.log");
     65        return fopen(path, "a");
     66}
     67
     68void closeLogFile() {
     69        if (hLog != NULL) {
     70                fclose(hLog);   
     71        }
     72}
     73
     74void setWow64Flag() {
     75        LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(
     76                        GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
     77
     78        if (fnIsWow64Process != NULL) {
     79                fnIsWow64Process(GetCurrentProcess(), &wow64);
     80        }
     81        debug("WOW64:\t\t%s\n", wow64 ? "yes" : "no");
     82}
    4183
    4284void setConsoleFlag() {
     
    5294}
    5395
    54 void showJavaWebPage() {
    55         ShellExecute(NULL, "open", "http://java.com", NULL, NULL, SW_SHOWNORMAL);
    56 }
    57 
    58 BOOL loadString(HMODULE hLibrary, int resID, char* buffer) {
     96void signalError() {
     97        DWORD err = GetLastError();
     98        if (err) {
     99                LPVOID lpMsgBuf;
     100                FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
     101                                                | FORMAT_MESSAGE_FROM_SYSTEM
     102                                                | FORMAT_MESSAGE_IGNORE_INSERTS,
     103                                NULL,
     104                                err,
     105                                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
     106                            (LPTSTR) &lpMsgBuf,
     107                            0,
     108                            NULL);
     109                debug("Error:\t\t%s\n", (LPCTSTR) lpMsgBuf);
     110                strcat(errMsg, "\n\n");
     111                strcat(errMsg, (LPCTSTR) lpMsgBuf);
     112                msgBox(errMsg);
     113                LocalFree(lpMsgBuf);
     114        } else {
     115                msgBox(errMsg);
     116        }
     117        if (*errUrl) {
     118                debug("Open URL:\t%s\n", errUrl);
     119                ShellExecute(NULL, "open", errUrl, NULL, NULL, SW_SHOWNORMAL);
     120        }
     121        closeLogFile();
     122}
     123
     124BOOL loadString(const int resID, char* buffer) {
    59125        HRSRC hResource;
    60126        HGLOBAL hResourceLoaded;
    61127        LPBYTE lpBuffer;
    62128
    63         hResource = FindResourceEx(hLibrary, RT_RCDATA, MAKEINTRESOURCE(resID),
     129        hResource = FindResourceEx(hModule, RT_RCDATA, MAKEINTRESOURCE(resID),
    64130                        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT));
    65131        if (NULL != hResource) {
    66                 hResourceLoaded = LoadResource(hLibrary, hResource);
     132                hResourceLoaded = LoadResource(hModule, hResource);
    67133                if (NULL != hResourceLoaded) {
    68134                        lpBuffer = (LPBYTE) LockResource(hResourceLoaded);           
     
    72138                                        buffer[x] = (char) lpBuffer[x];
    73139                                } while (buffer[x++] != 0);
     140                                // debug("Resource %d:\t%s\n", resID, buffer);
    74141                                return TRUE;
    75142                        }
    76143                }   
     144        } else {
     145                SetLastError(0);
    77146        }
    78147        return FALSE;
    79148}
    80149
    81 BOOL loadBoolString(HMODULE hLibrary, int resID) {
    82         char boolStr[10] = "";
    83         loadString(hLibrary, resID, boolStr);
     150BOOL loadBool(const int resID) {
     151        char boolStr[20] = {0};
     152        loadString(resID, boolStr);
    84153        return strcmp(boolStr, TRUE_STR) == 0;
    85154}
    86155
    87 void regSearch(HKEY hKey, char* keyName, int searchType) {
     156int loadInt(const int resID) {
     157        char intStr[20] = {0};
     158        loadString(resID, intStr);
     159        return atoi(intStr);
     160}
     161
     162BOOL regQueryValue(const char* regPath, unsigned char* buffer,
     163                unsigned long bufferLength) {
     164        HKEY hRootKey;
     165        char* key;
     166        char* value;
     167        if (strstr(regPath, HKEY_CLASSES_ROOT_STR) == regPath) {
     168                hRootKey = HKEY_CLASSES_ROOT;
     169        } else if (strstr(regPath, HKEY_CURRENT_USER_STR) == regPath) {
     170                hRootKey = HKEY_CURRENT_USER;
     171        } else if (strstr(regPath, HKEY_LOCAL_MACHINE_STR) == regPath) {
     172                hRootKey = HKEY_LOCAL_MACHINE;
     173        } else if (strstr(regPath, HKEY_USERS_STR) == regPath) {
     174                hRootKey = HKEY_USERS;
     175        } else if (strstr(regPath, HKEY_CURRENT_CONFIG_STR) == regPath) {
     176                hRootKey = HKEY_CURRENT_CONFIG;
     177        } else {
     178                return FALSE;
     179        }
     180        key = strchr(regPath, '\\') + 1;
     181        value = strrchr(regPath, '\\') + 1;
     182        *(value - 1) = 0;
     183
     184        HKEY hKey;
     185        unsigned long datatype;
     186        BOOL result = FALSE;
     187        if ((wow64 && RegOpenKeyEx(hRootKey,
     188                                                                key,
     189                                                                0,
     190                                                        KEY_READ | KEY_WOW64_64KEY,
     191                                                                &hKey) == ERROR_SUCCESS)
     192                        || RegOpenKeyEx(hRootKey,
     193                                                                key,
     194                                                                0,
     195                                                        KEY_READ,
     196                                                                &hKey) == ERROR_SUCCESS) {
     197                result = RegQueryValueEx(hKey, value, NULL, &datatype, buffer, &bufferLength)
     198                                == ERROR_SUCCESS;
     199                RegCloseKey(hKey);
     200        }
     201        *(value - 1) = '\\';
     202        return result;
     203}
     204
     205void regSearch(const HKEY hKey, const char* keyName, const int searchType) {
    88206        DWORD x = 0;
    89207        unsigned long size = BIG_STR;
    90208        FILETIME time;
    91         char buffer[BIG_STR] = "";
     209        char buffer[BIG_STR] = {0};
    92210        while (RegEnumKeyEx(
    93211                                hKey,                   // handle to key to enumerate
     
    99217                                NULL,                   // address for size of class buffer
    100218                                &time) == ERROR_SUCCESS) {
     219               
    101220                if (strcmp(buffer, javaMinVer) >= 0
    102                                 && (javaMaxVer[0] == 0 || strcmp(buffer, javaMaxVer) <= 0)
     221                                && (!*javaMaxVer || strcmp(buffer, javaMaxVer) <= 0)
    103222                                && strcmp(buffer, foundJavaVer) > 0) {
    104223                        strcpy(foundJavaVer, buffer);
     224                        strcpy(foundJavaKey, keyName);
     225                        appendPath(foundJavaKey, buffer);       
    105226                        foundJava = searchType;
     227                        debug("Match:\t\t%s\\%s\n", keyName, buffer);
     228                } else {
     229                        debug("Ignore:\t\t%s\\%s\n", keyName, buffer);
    106230                }
    107231                size = BIG_STR;
     
    109233}
    110234
    111 BOOL findJavaHome(char* path) {
     235void regSearchWow(const char* keyName, const int searchType) {
    112236        HKEY hKey;
    113         char jre[] = "SOFTWARE\\JavaSoft\\Java Runtime Environment";
    114         char sdk[] = "SOFTWARE\\JavaSoft\\Java Development Kit";
     237        debug("64-bit search:\t%s...\n", keyName);
     238        if (wow64 && RegOpenKeyEx(HKEY_LOCAL_MACHINE,
     239                        keyName,
     240                        0,
     241            KEY_READ | KEY_WOW64_64KEY,
     242                        &hKey) == ERROR_SUCCESS) {
     243               
     244                regSearch(hKey, keyName, searchType | KEY_WOW64_64KEY);
     245                RegCloseKey(hKey);
     246                if ((foundJava & KEY_WOW64_64KEY) != NO_JAVA_FOUND)
     247                {
     248                        debug("Using 64-bit runtime.\n");
     249                        return;
     250                }
     251        }
     252        debug("32-bit search:\t%s...\n", keyName);
    115253        if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
    116                         TEXT(jre),
     254                        keyName,
    117255                        0,
    118             KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS,
     256            KEY_READ,
    119257                        &hKey) == ERROR_SUCCESS) {
    120                 regSearch(hKey, jre, FOUND_JRE);
     258                regSearch(hKey, keyName, searchType);
    121259                RegCloseKey(hKey);
    122260        }
    123         if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
    124                         TEXT(sdk),
    125                         0,
    126             KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS,
    127                         &hKey) == ERROR_SUCCESS) {
    128                 regSearch(hKey, sdk, FOUND_SDK);
    129                 RegCloseKey(hKey);
     261}
     262
     263void regSearchJreSdk(const char* jreKeyName, const char* sdkKeyName,
     264                const int jdkPreference) {
     265        if (jdkPreference == JDK_ONLY || jdkPreference == PREFER_JDK) {
     266                regSearchWow(sdkKeyName, FOUND_SDK);
     267                if (jdkPreference != JDK_ONLY) {
     268                        regSearchWow(jreKeyName, FOUND_JRE);
     269                }
     270        } else { // jdkPreference == JRE_ONLY or PREFER_JRE
     271                regSearchWow(jreKeyName, FOUND_JRE);
     272                if (jdkPreference != JRE_ONLY) {
     273                        regSearchWow(sdkKeyName, FOUND_SDK);
     274                }
     275        }
     276}
     277
     278BOOL findJavaHome(char* path, const int jdkPreference) {
     279        regSearchJreSdk("SOFTWARE\\JavaSoft\\Java Runtime Environment",
     280                                        "SOFTWARE\\JavaSoft\\Java Development Kit",
     281                                        jdkPreference);
     282        if (foundJava == NO_JAVA_FOUND) {
     283                regSearchJreSdk("SOFTWARE\\IBM\\Java2 Runtime Environment",
     284                                                "SOFTWARE\\IBM\\Java Development Kit",
     285                                                jdkPreference);
    130286        }
    131287        if (foundJava != NO_JAVA_FOUND) {
    132                 char keyBuffer[BIG_STR];
    133                 unsigned long datatype;
    134                 unsigned long bufferlength = BIG_STR;
    135                 if (foundJava == FOUND_JRE)     {
    136                         strcpy(keyBuffer, jre);
    137                 } else {
    138                         strcpy(keyBuffer, sdk);
    139                 }
    140                 strcat(keyBuffer, "\\");
    141                 strcat(keyBuffer, foundJavaVer);
     288                HKEY hKey;
    142289                if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
    143                         TEXT(keyBuffer),
    144                         0,
    145             KEY_QUERY_VALUE,
    146                         &hKey) == ERROR_SUCCESS) {
    147                         unsigned char buffer[BIG_STR];
    148                         if (RegQueryValueEx(hKey, "JavaHome", NULL, &datatype, buffer, &bufferlength)
    149                                         == ERROR_SUCCESS) {
     290                                foundJavaKey,
     291                                0,
     292                    KEY_READ | (foundJava & KEY_WOW64_64KEY),
     293                                &hKey) == ERROR_SUCCESS) {
     294                        unsigned char buffer[BIG_STR] = {0};
     295                        unsigned long bufferlength = BIG_STR;
     296                        unsigned long datatype;
     297                        if (RegQueryValueEx(hKey, "JavaHome", NULL, &datatype, buffer,
     298                                        &bufferlength) == ERROR_SUCCESS) {
    150299                                int i = 0;
    151300                                do {
    152301                                        path[i] = buffer[i];
    153302                                } while (path[i++] != 0);
    154                                 if (foundJava == FOUND_SDK) {
    155                                         strcat(path, "\\jre");
     303                                if (foundJava & FOUND_SDK) {
     304                                        appendPath(path, "jre");
    156305                                }
    157306                                RegCloseKey(hKey);
     
    165314
    166315/*
    167  * extract the executable name, returns path length.
     316 * Extract the executable name, returns path length.
    168317 */
    169318int getExePath(char* exePath) {
    170         HMODULE hModule = GetModuleHandle(NULL);
    171     if (hModule == 0
    172                         || GetModuleFileName(hModule, exePath, _MAX_PATH) == 0) {
     319    if (GetModuleFileName(hModule, exePath, _MAX_PATH) == 0) {
    173320        return -1;
    174321    }
     
    176323}
    177324
     325void appendPath(char* basepath, const char* path) {
     326        if (basepath[strlen(basepath) - 1] != '\\') {
     327                strcat(basepath, "\\");
     328        }
     329        strcat(basepath, path);
     330}
     331
    178332void appendJavaw(char* jrePath) {
    179333    if (console) {
    180             strcat(jrePath, "\\bin\\java.exe");
     334            appendPath(jrePath, "bin\\java.exe");
    181335    } else {
    182         strcat(jrePath, "\\bin\\javaw.exe");
     336        appendPath(jrePath, "bin\\javaw.exe");
    183337    }
    184338}
    185339
    186 void appendLauncher(BOOL setProcName, char* exePath, int pathLen, char* cmd) {
     340void appendLauncher(const BOOL setProcName, char* exePath,
     341                const int pathLen, char* cmd) {
    187342        if (setProcName) {
    188                 char tmpspec[_MAX_PATH] = "";
    189                 char tmpfile[_MAX_PATH] = "";
     343                char tmpspec[_MAX_PATH];
     344                char tmpfile[_MAX_PATH];
    190345                strcpy(tmpspec, cmd);
    191346                strcat(tmpspec, LAUNCH4J_TMP_DIR);
    192347                tmpspec[strlen(tmpspec) - 1] = 0;
    193348                if (_stat(tmpspec, &statBuf) == 0) {
    194                         // remove temp launchers
     349                        // Remove temp launchers and manifests
    195350                        struct _finddata_t c_file;
    196351                        long hFile;
    197                         strcat(tmpspec, "\\*.exe");
     352                        appendPath(tmpspec, "*.exe");
    198353                        strcpy(tmpfile, cmd);
    199354                        strcat(tmpfile, LAUNCH4J_TMP_DIR);
     
    202357                                do {
    203358                                        strcpy(filename, c_file.name);
     359                                        debug("Unlink:\t\t%s\n", tmpfile);
     360                                        _unlink(tmpfile);
     361                                        strcat(tmpfile, MANIFEST);
     362                                        debug("Unlink:\t\t%s\n", tmpfile);
    204363                                        _unlink(tmpfile);
    205364                                } while (_findnext(hFile, &c_file) == 0);
     
    208367                } else {
    209368                        if (_mkdir(tmpspec) != 0) {
     369                                debug("Mkdir failed:\t%s\n", tmpspec);
    210370                                appendJavaw(cmd);
    211371                                return;
    212372                        }
    213373                }
    214                 char javaw[_MAX_PATH] = "";
     374                char javaw[_MAX_PATH];
    215375                strcpy(javaw, cmd);
    216376                appendJavaw(javaw);
    217377                strcpy(tmpfile, cmd);
    218378                strcat(tmpfile, LAUNCH4J_TMP_DIR);
     379                char* tmpfilename = tmpfile + strlen(tmpfile);
    219380                char* exeFilePart = exePath + pathLen + 1;
    220                 strcat(tmpfile, exeFilePart);
     381
     382                // Copy manifest
     383                char manifest[_MAX_PATH] = {0};
     384                strcpy(manifest, exePath);
     385                strcat(manifest, MANIFEST);
     386                if (_stat(manifest, &statBuf) == 0) {
     387                        strcat(tmpfile, exeFilePart);
     388                        strcat(tmpfile, MANIFEST);
     389                        debug("Copy:\t\t%s -> %s\n", manifest, tmpfile);
     390                        CopyFile(manifest, tmpfile, FALSE);
     391                }
     392
     393                // Copy launcher
     394                strcpy(tmpfilename, exeFilePart);
     395                debug("Copy:\t\t%s -> %s\n", javaw, tmpfile);
    221396                if (CopyFile(javaw, tmpfile, FALSE)) {
    222397                        strcpy(cmd, tmpfile);
    223398                        return;
    224                 } else {
     399                } else if (_stat(javaw, &statBuf) == 0) {
    225400                        long fs = statBuf.st_size;
    226401                        if (_stat(tmpfile, &statBuf) == 0 && fs == statBuf.st_size) {
     402                                debug("Reusing:\t\t%s\n", tmpfile);
    227403                                strcpy(cmd, tmpfile);
    228404                                return;
     
    233409}
    234410
    235 BOOL isJrePathOk(char* path) {
    236         if (!*path) {
     411void appendAppClasspath(char* dst, const char* src, const char* classpath) {
     412        strcat(dst, src);
     413        if (*classpath) {
     414                strcat(dst, ";");
     415        }
     416}
     417
     418BOOL isJrePathOk(const char* path) {
     419        char javaw[_MAX_PATH];
     420        BOOL result = FALSE;
     421        if (*path) {
     422                strcpy(javaw, path);
     423                appendJavaw(javaw);
     424                result = _stat(javaw, &statBuf) == 0;
     425        }       
     426        debug("Check launcher:\t%s %s\n", javaw, result ? "(OK)" : "(n/a)");
     427        return result;
     428}
     429
     430/*
     431 * Expand environment %variables%
     432 */
     433BOOL expandVars(char *dst, const char *src, const char *exePath, const int pathLen) {
     434    char varName[STR];
     435    char varValue[MAX_VAR_SIZE];
     436    while (strlen(src) > 0) {
     437        char *start = strchr(src, '%');
     438        if (start != NULL) {
     439            char *end = strchr(start + 1, '%');
     440            if (end == NULL) {
     441                return FALSE;
     442            }
     443            // Copy content up to %VAR%
     444            strncat(dst, src, start - src);
     445            // Insert value of %VAR%
     446            *varName = 0;
     447            strncat(varName, start + 1, end - start - 1);
     448            // Remember value start for logging
     449            char *varValue = dst + strlen(dst);
     450            if (strcmp(varName, "EXEDIR") == 0) {
     451                strncat(dst, exePath, pathLen);
     452            } else if (strcmp(varName, "EXEFILE") == 0) {
     453                strcat(dst, exePath);
     454            } else if (strcmp(varName, "PWD") == 0) {
     455                GetCurrentDirectory(_MAX_PATH, dst + strlen(dst));
     456            } else if (strcmp(varName, "OLDPWD") == 0) {
     457                strcat(dst, oldPwd);
     458                        } else if (strstr(varName, HKEY_STR) == varName) {
     459                                regQueryValue(varName, dst + strlen(dst), BIG_STR);
     460            } else if (GetEnvironmentVariable(varName, varValue, MAX_VAR_SIZE) > 0) {
     461                strcat(dst, varValue);
     462            }
     463            debug("Substitute:\t%s = %s\n", varName, varValue);
     464            src = end + 1;
     465        } else {
     466            // Copy remaining content
     467            strcat(dst, src);
     468            break;
     469        }
     470        }
     471        return TRUE;
     472}
     473
     474void appendHeapSizes(char *dst) {
     475        MEMORYSTATUS m;
     476        memset(&m, 0, sizeof(m));
     477        GlobalMemoryStatus(&m);
     478
     479        appendHeapSize(dst, INITIAL_HEAP_SIZE, INITIAL_HEAP_PERCENT,
     480                        m.dwAvailPhys, "-Xms");
     481        appendHeapSize(dst, MAX_HEAP_SIZE, MAX_HEAP_PERCENT,
     482                        m.dwAvailPhys, "-Xmx");
     483}
     484
     485void appendHeapSize(char *dst, const int absID, const int percentID,
     486                const DWORD freeMemory, const char *option) {
     487       
     488        const int mb = 1048576;         // 1 MB
     489        int abs = loadInt(absID);
     490        int percent = loadInt(percentID);
     491        int free = (long long) freeMemory * percent / (100 * mb);       // 100% * 1 MB
     492        int size = free > abs ? free : abs;
     493        if (size > 0) {
     494                debug("Heap %s:\t%d MB / %d%%, Free: %d MB, Heap size: %d MB\n",
     495                                option, abs, percent, freeMemory / mb, size);
     496                strcat(dst, option);
     497                _itoa(size, dst + strlen(dst), 10);                                             // 10 -- radix
     498                strcat(dst, "m ");
     499        }
     500}
     501
     502int prepare(const char *lpCmdLine) {
     503        char tmp[MAX_ARGS] = {0};
     504        hModule = GetModuleHandle(NULL);
     505        if (hModule == NULL) {
    237506                return FALSE;
    238507        }
    239         char javaw[_MAX_PATH];
    240         strcpy(javaw, path);
    241         appendJavaw(javaw);
    242         return _stat(javaw, &statBuf) == 0;
    243 }
    244 
    245 BOOL prepare(HMODULE hLibrary, char *lpCmdLine) {
    246         // open executable
    247         char exePath[_MAX_PATH] = "";
     508
     509        // Get executable path
     510        char exePath[_MAX_PATH] = {0};
    248511        int pathLen = getExePath(exePath);
    249512        if (pathLen == -1) {
    250                 msgBox("Cannot determinate exe file name.");
    251513                return FALSE;
    252514        }
    253         hLibrary = LoadLibrary(exePath);
    254         if (hLibrary == NULL) {
    255                 char msg[BIG_STR] = "Cannot find file: ";
    256                 strcat(msg, exePath);
    257                 msgBox(msg);
    258                 return FALSE;
    259         }
    260 
    261         // error message box title
    262         loadString(hLibrary, ERR_TITLE, errTitle);
    263 
    264         // working dir
    265         char tmp_path[_MAX_PATH] = "";
    266         if (loadString(hLibrary, CHDIR, tmp_path)) {
     515
     516        // Initialize logging
     517    if (strstr(lpCmdLine, "--l4j-debug") != NULL) {
     518                hLog = openLogFile(exePath, pathLen);
     519                if (hLog == NULL) {
     520                        return FALSE;
     521                }
     522                debug("\n\nCmdLine:\t%s %s\n", exePath, lpCmdLine);
     523        }
     524
     525    setWow64Flag();
     526
     527        // Set default error message, title and optional support web site url.
     528        loadString(SUPPORT_URL, errUrl);
     529        loadString(ERR_TITLE, errTitle);
     530        if (!loadString(STARTUP_ERR, errMsg)) {
     531                return FALSE;                   
     532        }
     533
     534        // Single instance
     535        loadString(MUTEX_NAME, mutexName);
     536        if (*mutexName) {
     537                SECURITY_ATTRIBUTES security;
     538                security.nLength = sizeof(SECURITY_ATTRIBUTES);
     539                security.bInheritHandle = TRUE;
     540                security.lpSecurityDescriptor = NULL;
     541                CreateMutexA(&security, FALSE, mutexName);
     542                if (GetLastError() == ERROR_ALREADY_EXISTS) {
     543                        debug("Instance already exists.");
     544                        return ERROR_ALREADY_EXISTS;
     545                }
     546        }
     547       
     548        // Working dir
     549        char tmp_path[_MAX_PATH] = {0};
     550        GetCurrentDirectory(_MAX_PATH, oldPwd);
     551        if (loadString(CHDIR, tmp_path)) {
    267552                strncpy(workingDir, exePath, pathLen);
    268                 strcat(workingDir, "/");
    269                 strcat(workingDir, tmp_path);
     553                appendPath(workingDir, tmp_path);
    270554                _chdir(workingDir);
    271         }
    272 
    273         // custom process name
    274         const BOOL setProcName = loadBoolString(hLibrary, SET_PROC_NAME);
    275 
    276         // use bundled jre or find java
    277         if (loadString(hLibrary, JRE_PATH, tmp_path)) {
    278                 strncpy(cmd, exePath, pathLen);
    279                 strcat(cmd, "/");
    280                 strcat(cmd, tmp_path);         
     555                debug("Working dir:\t%s\n", workingDir);
     556        }
     557
     558        // Use bundled jre or find java
     559        if (loadString(JRE_PATH, tmp_path)) {
     560                char jrePath[MAX_ARGS] = {0};
     561                expandVars(jrePath, tmp_path, exePath, pathLen);
     562                debug("Bundled JRE:\t%s\n", jrePath);
     563                if (jrePath[0] == '\\' || jrePath[1] == ':') {
     564                        // Absolute
     565                        strcpy(cmd, jrePath);
     566                } else {
     567                        // Relative
     568                        strncpy(cmd, exePath, pathLen);
     569                        appendPath(cmd, jrePath);
     570                }
    281571    }
    282572        if (!isJrePathOk(cmd)) {
    283                 if (!loadString(hLibrary, JAVA_MIN_VER, javaMinVer)) {
    284                         msgBox("Cannot find bundled JRE or javaw.exe is missing.");
     573                if (!loadString(JAVA_MIN_VER, javaMinVer)) {
     574                        loadString(BUNDLED_JRE_ERR, errMsg);
    285575                        return FALSE;
    286576                }
    287                 loadString(hLibrary, JAVA_MAX_VER, javaMaxVer);
    288                 if (!findJavaHome(cmd)) {
    289                         char txt[BIG_STR] = "Cannot find Java ";
    290                         strcat(txt, javaMinVer);
     577                loadString(JAVA_MAX_VER, javaMaxVer);
     578                if (!findJavaHome(cmd, loadInt(JDK_PREFERENCE))) {
     579                        loadString(JRE_VERSION_ERR, errMsg);
     580                        strcat(errMsg, " ");
     581                        strcat(errMsg, javaMinVer);
    291582                        if (*javaMaxVer) {
    292                                 strcat(txt, " - ");
    293                                 strcat(txt, javaMaxVer);
     583                                strcat(errMsg, " - ");
     584                                strcat(errMsg, javaMaxVer);
    294585                        }
    295                         msgBox(txt);
    296                         showJavaWebPage();
     586                        loadString(DOWNLOAD_URL, errUrl);
    297587                        return FALSE;
    298588                }
    299589                if (!isJrePathOk(cmd)) {
    300                         msgBox("Java found, but javaw.exe seems to be missing.");
     590                        loadString(LAUNCHER_ERR, errMsg);
    301591                        return FALSE;
    302592                }
    303593        }
    304594
     595    // Append a path to the Path environment variable
     596        char jreBinPath[_MAX_PATH];
     597        strcpy(jreBinPath, cmd);
     598        strcat(jreBinPath, "\\bin");
     599        if (!appendToPathVar(jreBinPath)) {
     600                return FALSE;
     601        }
     602
     603        // Set environment variables
     604        char envVars[MAX_VAR_SIZE] = {0};
     605        loadString(ENV_VARIABLES, envVars);
     606        char *var = strtok(envVars, "\t");
     607        while (var != NULL) {
     608                char *varValue = strchr(var, '=');
     609                *varValue++ = 0;
     610                *tmp = 0;
     611                expandVars(tmp, varValue, exePath, pathLen);
     612                debug("Set var:\t%s = %s\n", var, tmp);
     613                SetEnvironmentVariable(var, tmp);
     614                var = strtok(NULL, "\t");
     615        }
     616        *tmp = 0;
     617
     618        // Process priority
     619        priority = loadInt(PRIORITY_CLASS);
     620
     621        // Custom process name
     622        const BOOL setProcName = loadBool(SET_PROC_NAME)
     623                        && strstr(lpCmdLine, "--l4j-default-proc") == NULL;
     624        const BOOL wrapper = loadBool(WRAPPER);
     625
    305626        appendLauncher(setProcName, exePath, pathLen, cmd);
    306627
    307         char jarArgs[BIG_STR] = "";
    308         loadString(hLibrary, JAR_ARGS, jarArgs);
    309         loadString(hLibrary, JVM_ARGS, args);
    310         if (*args) {
     628        // Heap sizes
     629        appendHeapSizes(args);
     630       
     631    // JVM options
     632        if (loadString(JVM_OPTIONS, tmp)) {
     633                strcat(tmp, " ");
     634        } else {
     635        *tmp = 0;
     636    }
     637        /*
     638         * Load additional JVM options from .l4j.ini file
     639         * Options are separated by spaces or CRLF
     640         * # starts an inline comment
     641         */
     642        strncpy(tmp_path, exePath, strlen(exePath) - 3);
     643        strcat(tmp_path, "l4j.ini");
     644        long hFile;
     645        if ((hFile = _open(tmp_path, _O_RDONLY)) != -1) {
     646                const int jvmOptLen = strlen(tmp);
     647                char* src = tmp + jvmOptLen;
     648                char* dst = src;
     649                const int len = _read(hFile, src, MAX_ARGS - jvmOptLen - BIG_STR);
     650                BOOL copy = TRUE;
     651                int i;
     652                for (i = 0; i < len; i++, src++) {
     653                        if (*src == '#') {
     654                                copy = FALSE;
     655                        } else if (*src == 13 || *src == 10) {
     656                                copy = TRUE;
     657                                if (dst > tmp && *(dst - 1) != ' ') {
     658                                        *dst++ = ' ';
     659                                }
     660                        } else if (copy) {
     661                                *dst++ = *src;
     662                        }
     663                }
     664                *dst = 0;
     665                if (len > 0 && *(dst - 1) != ' ') {
     666                        strcat(tmp, " ");
     667                }
     668                _close(hFile);
     669        }
     670
     671    // Expand environment %variables%
     672        expandVars(args, tmp, exePath, pathLen);
     673
     674        // MainClass + Classpath or Jar
     675        char mainClass[STR] = {0};
     676        char jar[_MAX_PATH] = {0};
     677        loadString(JAR, jar);
     678        if (loadString(MAIN_CLASS, mainClass)) {
     679                if (!loadString(CLASSPATH, tmp)) {
     680                        return FALSE;
     681                }
     682                char exp[MAX_ARGS] = {0};
     683                expandVars(exp, tmp, exePath, pathLen);
     684                strcat(args, "-classpath \"");
     685                if (wrapper) {
     686                        appendAppClasspath(args, exePath, exp);
     687                } else if (*jar) {
     688                        appendAppClasspath(args, jar, exp);
     689                }
     690
     691                // Deal with wildcards or >> strcat(args, exp); <<
     692                char* cp = strtok(exp, ";");
     693                while(cp != NULL) {
     694                        debug("Add classpath:\t%s\n", cp);
     695                        if (strpbrk(cp, "*?") != NULL) {
     696                                int len = strrchr(cp, '\\') - cp + 1;
     697                                strncpy(tmp_path, cp, len);
     698                                char* filename = tmp_path + len;
     699                                *filename = 0;
     700                                struct _finddata_t c_file;
     701                                long hFile;
     702                                if ((hFile = _findfirst(cp, &c_file)) != -1L) {
     703                                        do {
     704                                                strcpy(filename, c_file.name);
     705                                                strcat(args, tmp_path);
     706                                                strcat(args, ";");
     707                                                debug("      \"      :\t%s\n", tmp_path);
     708                                        } while (_findnext(hFile, &c_file) == 0);
     709                                }
     710                                _findclose(hFile);
     711                        } else {
     712                                strcat(args, cp);
     713                                strcat(args, ";");
     714                        }
     715                        cp = strtok(NULL, ";");
     716                }
     717                *(args + strlen(args) - 1) = 0;
     718
     719                strcat(args, "\" ");
     720                strcat(args, mainClass);
     721        } else if (wrapper) {
     722        strcat(args, "-jar \"");
     723                strcat(args, exePath);
     724                strcat(args, "\"");
     725    } else {
     726        strcat(args, "-jar \"");
     727        strncat(args, exePath, pathLen);
     728        appendPath(args, jar);
     729        strcat(args, "\"");
     730    }
     731
     732        // Constant command line args
     733        if (loadString(CMD_LINE, tmp)) {
    311734                strcat(args, " ");
    312         }
    313         strcat(args, "-jar \"");
    314         strcat(args, exePath);
    315         strcat(args, "\"");
    316         if (*jarArgs) {
    317                 strcat(args, " ");
    318                 strcat(args, jarArgs);
    319         }
     735                strcat(args, tmp);
     736        }
     737
     738        // Command line args
    320739        if (*lpCmdLine) {
    321                 strcat(args, " ");
    322                 strcat(args, lpCmdLine);
    323         }
    324 
    325         // msgBox(cmd);
    326         // msgBox(args);
    327         // msgBox(workingDir);
     740                strcpy(tmp, lpCmdLine);
     741                char* dst;
     742                while ((dst = strstr(tmp, "--l4j-")) != NULL) {
     743                        char* src = strchr(dst, ' ');
     744                        if (src == NULL || *(src + 1) == 0) {
     745                                *dst = 0;
     746                        } else {
     747                                strcpy(dst, src + 1);
     748                        }
     749                }
     750                if (*tmp) {
     751                        strcat(args, " ");
     752                        strcat(args, tmp);
     753                }
     754        }
     755
     756        debug("Launcher:\t%s\n", cmd);
     757        debug("Launcher args:\t%s\n", args);
     758        debug("Args length:\t%d/32768 chars\n", strlen(args));
    328759        return TRUE;
    329760}
     
    332763        CloseHandle(pi.hThread);
    333764        CloseHandle(pi.hProcess);
    334 }
    335 
    336 DWORD execute(BOOL wait) {
     765        closeLogFile();
     766}
     767
     768/*
     769 * Append a path to the Path environment variable
     770 */
     771BOOL appendToPathVar(const char* path) {
     772        char chBuf[MAX_VAR_SIZE] = {0};
     773
     774        const int pathSize = GetEnvironmentVariable("Path", chBuf, MAX_VAR_SIZE);
     775        if (MAX_VAR_SIZE - pathSize - 1 < strlen(path)) {
     776                return FALSE;
     777        }
     778        strcat(chBuf, ";");
     779        strcat(chBuf, path);
     780        return SetEnvironmentVariable("Path", chBuf);
     781}
     782
     783DWORD execute(const BOOL wait) {
    337784        STARTUPINFO si;
    338785    memset(&pi, 0, sizeof(pi));
     
    341788
    342789        DWORD dwExitCode = -1;
    343         char cmdline[_MAX_PATH + BIG_STR] = "\"";
     790        char cmdline[MAX_ARGS];
     791    strcpy(cmdline, "\"");
    344792        strcat(cmdline, cmd);
    345793        strcat(cmdline, "\" ");
    346794        strcat(cmdline, args);
    347795        if (CreateProcess(NULL, cmdline, NULL, NULL,
    348                         FALSE, 0, NULL, NULL, &si, &pi)) {
     796                        TRUE, priority, NULL, NULL, &si, &pi)) {
    349797                if (wait) {
    350798                        WaitForSingleObject(pi.hProcess, INFINITE);
    351799                        GetExitCodeProcess(pi.hProcess, &dwExitCode);
     800                        debug("Exit code:\t%d\n", dwExitCode);
    352801                        closeHandles();
    353802                } else {
  • installer/lib/launch4j/head_src/head.h

    rd7e9096 r7212f85  
    11/*
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
    24
    3         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    4         Copyright (C) 2004-2005 Grzegorz Kowal
     5        Copyright (c) 2004, 2008 Grzegorz Kowal,
     6                                                         Ian Roberts (jdk preference patch)
    57
    6         Compiled with Mingw port of GCC, Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
     8        Permission is hereby granted, free of charge, to any person obtaining a copy
     9        of this software and associated documentation files (the "Software"), to deal
     10        in the Software without restriction, including without limitation the rights
     11        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     12        copies of the Software, and to permit persons to whom the Software is
     13        furnished to do so, subject to the following conditions:
    714
    8         This library is free software; you can redistribute it and/or
    9         modify it under the terms of the GNU Lesser General Public
    10         License as published by the Free Software Foundation; either
    11         version 2.1 of the License, or (at your option) any later version.
     15        The above copyright notice and this permission notice shall be included in
     16        all copies or substantial portions of the Software.
    1217
    13         This library is distributed in the hope that it will be useful,
    14         but WITHOUT ANY WARRANTY; without even the implied warranty of
    15         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    16         Lesser General Public License for more details.
     18        Except as contained in this notice, the name(s) of the above copyright holders
     19        shall not be used in advertising or otherwise to promote the sale, use or other
     20        dealings in this Software without prior written authorization.
    1721
    18         You should have received a copy of the GNU Lesser General Public
    19         License along with this library; if not, write to the Free Software
    20         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    21 
     22        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     23        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     24        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     25        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     26        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     27        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     28        THE SOFTWARE.
    2229*/
    2330
     
    3744#include <shellapi.h>
    3845#include <direct.h>
     46#include <fcntl.h>
    3947#include <stdio.h>
    4048#include <sys/stat.h>
     
    4654#define FOUND_SDK 2
    4755
     56#define JRE_ONLY 0
     57#define PREFER_JRE 1
     58#define PREFER_JDK 2
     59#define JDK_ONLY 3
     60
    4861#define LAUNCH4J_TMP_DIR "\\launch4j-tmp\\"
     62#define MANIFEST ".manifest"
     63
     64#define KEY_WOW64_64KEY 0x0100
     65
     66#define HKEY_STR "HKEY"
     67#define HKEY_CLASSES_ROOT_STR "HKEY_CLASSES_ROOT"
     68#define HKEY_CURRENT_USER_STR "HKEY_CURRENT_USER"
     69#define HKEY_LOCAL_MACHINE_STR "HKEY_LOCAL_MACHINE"
     70#define HKEY_USERS_STR "HKEY_USERS"
     71#define HKEY_CURRENT_CONFIG_STR "HKEY_CURRENT_CONFIG"
    4972
    5073#define STR 128
    5174#define BIG_STR 1024
     75#define MAX_VAR_SIZE 32767
     76#define MAX_ARGS 32768
    5277
    5378#define TRUE_STR "true"
    5479#define FALSE_STR "false"
    5580
     81#define debug(args...) if (hLog != NULL) fprintf(hLog, ## args);
     82
     83typedef void (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
     84
     85FILE* openLogFile(const char* exePath, const int pathLen);
     86void closeLogFile();
    5687void msgBox(const char* text);
    57 void showJavaWebPage();
    58 BOOL loadString(HMODULE hLibrary, int resID, char* buffer);
    59 BOOL loadBoolString(HMODULE hLibrary, int resID);
    60 void regSearch(HKEY hKey, char* keyName, int searchType);
    61 BOOL findJavaHome(char* path);
     88void signalError();
     89BOOL loadString(const int resID, char* buffer);
     90BOOL loadBool(const int resID);
     91int loadInt(const int resID);
     92BOOL regQueryValue(const char* regPath, unsigned char* buffer,
     93                unsigned long bufferLength);
     94void regSearch(const HKEY hKey, const char* keyName, const int searchType);
     95void regSearchWow(const char* keyName, const int searchType);
     96void regSearchJreSdk(const char* jreKeyName, const char* sdkKeyName,
     97                const int jdkPreference);
     98BOOL findJavaHome(char* path, const int jdkPreference);
    6299int getExePath(char* exePath);
    63 void catJavaw(char* jrePath);
    64 BOOL isJrePathOk(char* path);
    65 BOOL prepare(HMODULE hLibrary, char *lpCmdLine);
     100void appendPath(char* basepath, const char* path);
     101void appendJavaw(char* jrePath);
     102void appendAppClasspath(char* dst, const char* src, const char* classpath);
     103BOOL isJrePathOk(const char* path);
     104BOOL expandVars(char *dst, const char *src, const char *exePath, const int pathLen);
     105void appendHeapSizes(char *dst);
     106void appendHeapSize(char *dst, const int absID, const int percentID,
     107                const DWORD freeMemory, const char *option);
     108int prepare(const char *lpCmdLine);
    66109void closeHandles();
    67 DWORD execute(BOOL wait);
     110BOOL appendToPathVar(const char* path);
     111DWORD execute(const BOOL wait);
    68112
    69113#endif // _LAUNCH4J_HEAD__INCLUDED_
  • installer/lib/launch4j/head_src/resource.h

    rd7e9096 r7212f85  
    11/*
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
    24
    3         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    4         Copyright (C) 2004-2005 Grzegorz Kowal
     5        Copyright (c) 2004, 2008 Grzegorz Kowal
     6                                                         Ian Roberts (jdk preference patch)
    57
    6         Compiled with Mingw port of GCC, Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
     8        Permission is hereby granted, free of charge, to any person obtaining a copy
     9        of this software and associated documentation files (the "Software"), to deal
     10        in the Software without restriction, including without limitation the rights
     11        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     12        copies of the Software, and to permit persons to whom the Software is
     13        furnished to do so, subject to the following conditions:
    714
    8         This library is free software; you can redistribute it and/or
    9         modify it under the terms of the GNU Lesser General Public
    10         License as published by the Free Software Foundation; either
    11         version 2.1 of the License, or (at your option) any later version.
     15        The above copyright notice and this permission notice shall be included in
     16        all copies or substantial portions of the Software.
    1217
    13         This library is distributed in the hope that it will be useful,
    14         but WITHOUT ANY WARRANTY; without even the implied warranty of
    15         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    16         Lesser General Public License for more details.
     18        Except as contained in this notice, the name(s) of the above copyright holders
     19        shall not be used in advertising or otherwise to promote the sale, use or other
     20        dealings in this Software without prior written authorization.
    1721
    18         You should have received a copy of the GNU Lesser General Public
    19         License along with this library; if not, write to the Free Software
    20         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    21 
     22        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     23        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     24        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     25        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     26        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     27        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     28        THE SOFTWARE.
    2229*/
    2330
    2431// ICON
    25 #define APP_ICON 1
     32#define APP_ICON                                        1
    2633
    2734// BITMAP
    28 #define SPLASH_BITMAP 1
     35#define SPLASH_BITMAP                           1
    2936
    3037// RCDATA
    31 #define JRE_PATH 1
    32 #define JAVA_MIN_VER 2
    33 #define JAVA_MAX_VER 3
    34 #define SHOW_SPLASH 4
    35 #define SPLASH_WAITS_FOR_WINDOW 5
    36 #define SPLASH_TIMEOUT 6
    37 #define SPLASH_TIMEOUT_ERR 7
    38 #define CHDIR 8
    39 #define SET_PROC_NAME 9
    40 #define ERR_TITLE 10
    41 #define GUI_HEADER_STAYS_ALIVE 11
    42 #define JVM_ARGS 12
    43 #define JAR_ARGS 13
     38#define JRE_PATH                                        1
     39#define JAVA_MIN_VER                            2
     40#define JAVA_MAX_VER                            3
     41#define SHOW_SPLASH                                     4
     42#define SPLASH_WAITS_FOR_WINDOW         5
     43#define SPLASH_TIMEOUT                          6
     44#define SPLASH_TIMEOUT_ERR                      7
     45#define CHDIR                                           8
     46#define SET_PROC_NAME                           9
     47#define ERR_TITLE                                       10
     48#define GUI_HEADER_STAYS_ALIVE          11
     49#define JVM_OPTIONS                                     12
     50#define CMD_LINE                                        13
     51#define JAR                                                     14
     52#define MAIN_CLASS                                      15
     53#define CLASSPATH                                       16
     54#define WRAPPER                                         17
     55#define JDK_PREFERENCE                          18
     56#define ENV_VARIABLES                           19
     57#define PRIORITY_CLASS                          20
     58#define DOWNLOAD_URL                            21
     59#define SUPPORT_URL                                     22
     60#define MUTEX_NAME                                      23
     61#define INSTANCE_WINDOW_TITLE           24
     62#define INITIAL_HEAP_SIZE                       25
     63#define INITIAL_HEAP_PERCENT            26
     64#define MAX_HEAP_SIZE                           27
     65#define MAX_HEAP_PERCENT                        28
     66
     67#define STARTUP_ERR                                     101
     68#define BUNDLED_JRE_ERR                         102
     69#define JRE_VERSION_ERR                         103
     70#define LAUNCHER_ERR                            104
     71#define INSTANCE_ALREADY_EXISTS_MSG     105
  • installer/lib/launch4j/lib/JGoodies.Looks.LICENSE.txt

    rd7e9096 r7212f85  
    1            The BSD License for the JGoodies Looks
    2            ======================================
    31
    4 Copyright (c) 2003 JGoodies Karsten Lentzsch. All rights reserved.
     2              The BSD License for the JGoodies Looks
     3              ======================================
     4
     5Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All rights reserved.
    56
    67Redistribution and use in source and binary forms, with or without
  • installer/lib/launch4j/src/net/sf/launch4j/Builder.java

    rd7e9096 r7212f85  
    11/*
    2         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    3         Copyright (C) 2005 Grzegorz Kowal
    4 
    5         This program is free software; you can redistribute it and/or modify
    6         it under the terms of the GNU General Public License as published by
    7         the Free Software Foundation; either version 2 of the License, or
    8         (at your option) any later version.
    9 
    10         This program is distributed in the hope that it will be useful,
    11         but WITHOUT ANY WARRANTY; without even the implied warranty of
    12         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13         GNU General Public License for more details.
    14 
    15         You should have received a copy of the GNU General Public License
    16         along with this program; if not, write to the Free Software
    17         Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
     4
     5        Copyright (c) 2004, 2007 Grzegorz Kowal
     6
     7        All rights reserved.
     8
     9        Redistribution and use in source and binary forms, with or without modification,
     10        are permitted provided that the following conditions are met:
     11
     12            * Redistributions of source code must retain the above copyright notice,
     13              this list of conditions and the following disclaimer.
     14            * Redistributions in binary form must reproduce the above copyright notice,
     15              this list of conditions and the following disclaimer in the documentation
     16              and/or other materials provided with the distribution.
     17            * Neither the name of the Launch4j nor the names of its contributors
     18              may be used to endorse or promote products derived from this software without
     19              specific prior written permission.
     20
     21        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     22        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     23        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     24        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     25        CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     26        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     27        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     28        PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     29        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     30        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     31        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1832*/
    1933
     
    2741import java.io.FileOutputStream;
    2842import java.io.IOException;
     43import java.util.ArrayList;
     44import java.util.Iterator;
     45import java.util.List;
     46import java.util.StringTokenizer;
    2947
    3048import net.sf.launch4j.binding.InvariantViolationException;
     
    3755public class Builder {
    3856        private final Log _log;
     57        private final File _basedir;
    3958
    4059        public Builder(Log log) {
    4160                _log = log;
     61                _basedir = Util.getJarBasedir();
     62        }
     63
     64        public Builder(Log log, File basedir) {
     65                _log = log;
     66                _basedir = basedir;
    4267        }
    4368
     
    5984                final RcBuilder rcb = new RcBuilder();
    6085                try {
    61                         String basedir = Util.getJarBasedir();
    62                         if (basedir == null) {
    63                                 basedir = ".";
    64                         }
    6586                        rc = rcb.build(c);
    66                         ro = File.createTempFile("launch4j", "o");
     87                        ro = Util.createTempFile("o");
    6788                        outfile = ConfigPersister.getInstance().getOutputFile();
    6889
    69                         Cmd resCmd = new Cmd(basedir);
    70                         resCmd.addExe("/bin/windres")
     90                        Cmd resCmd = new Cmd(_basedir);
     91                        resCmd.addExe("windres")
    7192                                        .add(Util.WINDOWS_OS ? "--preprocessor=type" : "--preprocessor=cat")
    7293                                        .add("-J rc -O coff -F pe-i386")
    73                                         .add(rc.getPath())
    74                                         .add(ro.getPath());
    75                         _log.append("Compiling resources");
    76                         Util.exec(resCmd.toString(), _log);
    77 
    78                         Cmd ldCmd = new Cmd(basedir);
    79                         ldCmd.addExe("/bin/ld")
     94                                        .addAbsFile(rc)
     95                                        .addAbsFile(ro);
     96                        _log.append(Messages.getString("Builder.compiling.resources"));
     97                        resCmd.exec(_log);
     98
     99                        Cmd ldCmd = new Cmd(_basedir);
     100                        ldCmd.addExe("ld")
    80101                                        .add("-mi386pe")
    81102                                        .add("--oformat pei-i386")
    82                                         .add((c.getHeaderType() == Config.GUI_HEADER)
     103                                        .add((c.getHeaderType().equals(Config.GUI_HEADER))
    83104                                                        ? "--subsystem windows" : "--subsystem console")
    84105                                        .add("-s")              // strip symbols
    85                                         .addFile("/w32api/crt2.o")
    86                                         .addFile((c.getHeaderType() == Config.GUI_HEADER)
    87                                                         ? "/head/guihead.o" : "/head/consolehead.o")
    88                                         .addFile("/head/head.o")
    89                                         .addAbsFile(ro.getPath())
    90                                         .addFile("/w32api/libmingw32.a")
    91                                         .addFile("/w32api/libgcc.a")
    92                                         .addFile("/w32api/libmsvcrt.a")
    93                                         .addFile("/w32api/libkernel32.a")
    94                                         .addFile("/w32api/libuser32.a")
    95                                         .addFile("/w32api/libadvapi32.a")
    96                                         .addFile("/w32api/libshell32.a")
     106                                        .addFiles(c.getHeaderObjects())
     107                                        .addAbsFile(ro)
     108                                        .addFiles(c.getLibs())
    97109                                        .add("-o")
    98                                         .addAbsFile(outfile.getPath());
    99                         _log.append("Linking");
    100                         Util.exec(ldCmd.toString(), _log);
    101 
    102                         _log.append("Wrapping");
    103                         int len;
    104                         byte[] buffer = new byte[1024];
    105                         is = new FileInputStream(
    106                                         Util.getAbsoluteFile(ConfigPersister.getInstance().getConfigPath(),     c.getJar()));
    107                         os = new FileOutputStream(outfile, true);
    108                         while ((len = is.read(buffer)) > 0) {
    109                                 os.write(buffer, 0, len);
     110                                        .addAbsFile(outfile);
     111                        _log.append(Messages.getString("Builder.linking"));
     112                        ldCmd.exec(_log);
     113
     114                        if (!c.isDontWrapJar()) {
     115                                _log.append(Messages.getString("Builder.wrapping"));
     116                                int len;
     117                                byte[] buffer = new byte[1024];
     118                                is = new FileInputStream(Util.getAbsoluteFile(
     119                                                ConfigPersister.getInstance().getConfigPath(),  c.getJar()));
     120                                os = new FileOutputStream(outfile, true);
     121                                while ((len = is.read(buffer)) > 0) {
     122                                        os.write(buffer, 0, len);
     123                                }
    110124                        }
    111                         _log.append("Successfully created " + outfile.getPath());
     125                        _log.append(Messages.getString("Builder.success") + outfile.getPath());
    112126                        return outfile;
    113127                } catch (IOException e) {
     
    119133                        String msg = e.getMessage();
    120134                        if (msg != null && msg.indexOf("windres") != -1) {
    121                                 _log.append("Generated resource file...\n");
    122                                 _log.append(rcb.getContent());
     135                                if (e.getErrLine() != -1) {
     136                                        _log.append(Messages.getString("Builder.line.has.errors",
     137                                                        String.valueOf(e.getErrLine())));
     138                                        _log.append(rcb.getLine(e.getErrLine()));
     139                                } else {
     140                                        _log.append(Messages.getString("Builder.generated.resource.file"));
     141                                        _log.append(rcb.getContent());
     142                                }
    123143                        }
    124144                        throw new BuilderException(e);
     
    133153
    134154class Cmd {
    135         private final StringBuffer _sb = new StringBuffer();
    136         private final String _basedir;
    137         private final boolean _quote;
    138 
    139         public Cmd(String basedir) {
     155        private final List _cmd = new ArrayList();
     156        private final File _basedir;
     157        private final File _bindir;
     158
     159        public Cmd(File basedir) {
    140160                _basedir = basedir;
    141                 _quote = basedir.indexOf(' ') != -1;
     161                String path = System.getProperty("launch4j.bindir");
     162                if (path == null) {
     163                        _bindir = new File(basedir, "bin");
     164                } else {
     165                        File bindir = new File(path);
     166                        _bindir = bindir.isAbsolute() ? bindir : new File(basedir, path);
     167                }
    142168        }
    143169
    144170        public Cmd add(String s) {
    145                 space();
    146                 _sb.append(s);
    147                 return this;
    148         }
    149 
    150         public Cmd addAbsFile(String file) {
    151                 space();
    152                 boolean quote = file.indexOf(' ') != -1;
    153                 if (quote) {
    154                         _sb.append('"');
    155                 }
    156                 _sb.append(file);
    157                 if (quote) {
    158                         _sb.append('"');
    159                 }
    160                 return this;
    161         }
    162 
    163         public Cmd addFile(String file) {
    164                 space();
    165                 if (_quote) {
    166                         _sb.append('"');
    167                 }
    168                 _sb.append(_basedir);
    169                 _sb.append(file);
    170                 if (_quote) {
    171                         _sb.append('"');
    172                 }
    173                 return this;
    174         }
    175 
    176         public Cmd addExe(String file) {
    177                 return addFile(Util.WINDOWS_OS ? file + ".exe" : file);
    178         }
    179 
    180         private void space() {
    181                 if (_sb.length() > 0) {
    182                         _sb.append(' ');
    183                 }
    184         }
    185        
    186         public String toString() {
    187                 return _sb.toString();
     171                StringTokenizer st = new StringTokenizer(s);
     172                while (st.hasMoreTokens()) {
     173                        _cmd.add(st.nextToken());
     174                }
     175                return this;
     176        }
     177
     178        public Cmd addAbsFile(File file) {
     179                _cmd.add(file.getPath());
     180                return this;
     181        }
     182
     183        public Cmd addFile(String pathname) {
     184                _cmd.add(new File(_basedir, pathname).getPath());
     185                return this;
     186        }
     187
     188        public Cmd addExe(String pathname) {
     189                if (Util.WINDOWS_OS) {
     190                        pathname += ".exe";
     191                }
     192                _cmd.add(new File(_bindir, pathname).getPath());
     193                return this;
     194        }
     195
     196        public Cmd addFiles(List files) {
     197                for (Iterator iter = files.iterator(); iter.hasNext();) {
     198                        addFile((String) iter.next());
     199                }
     200                return this;
     201        }
     202
     203        public void exec(Log log) throws ExecException {
     204                String[] cmd = (String[]) _cmd.toArray(new String[_cmd.size()]);
     205                Util.exec(cmd, log);
    188206        }
    189207}
  • installer/lib/launch4j/src/net/sf/launch4j/BuilderException.java

    rd7e9096 r7212f85  
    11/*
    2         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    3         Copyright (C) 2005 Grzegorz Kowal
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
    44
    5         This program is free software; you can redistribute it and/or modify
    6         it under the terms of the GNU General Public License as published by
    7         the Free Software Foundation; either version 2 of the License, or
    8         (at your option) any later version.
     5        Copyright (c) 2004, 2007 Grzegorz Kowal
    96
    10         This program is distributed in the hope that it will be useful,
    11         but WITHOUT ANY WARRANTY; without even the implied warranty of
    12         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13         GNU General Public License for more details.
     7        All rights reserved.
    148
    15         You should have received a copy of the GNU General Public License
    16         along with this program; if not, write to the Free Software
    17         Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     9        Redistribution and use in source and binary forms, with or without modification,
     10        are permitted provided that the following conditions are met:
     11
     12            * Redistributions of source code must retain the above copyright notice,
     13              this list of conditions and the following disclaimer.
     14            * Redistributions in binary form must reproduce the above copyright notice,
     15              this list of conditions and the following disclaimer in the documentation
     16              and/or other materials provided with the distribution.
     17            * Neither the name of the Launch4j nor the names of its contributors
     18              may be used to endorse or promote products derived from this software without
     19              specific prior written permission.
     20
     21        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     22        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     23        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     24        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     25        CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     26        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     27        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     28        PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     29        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     30        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     31        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1832*/
    1933
  • installer/lib/launch4j/src/net/sf/launch4j/ExecException.java

    rd7e9096 r7212f85  
    11/*
    2         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    3         Copyright (C) 2005 Grzegorz Kowal
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
    44
    5         This program is free software; you can redistribute it and/or modify
    6         it under the terms of the GNU General Public License as published by
    7         the Free Software Foundation; either version 2 of the License, or
    8         (at your option) any later version.
     5        Copyright (c) 2004, 2007 Grzegorz Kowal
    96
    10         This program is distributed in the hope that it will be useful,
    11         but WITHOUT ANY WARRANTY; without even the implied warranty of
    12         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13         GNU General Public License for more details.
     7        All rights reserved.
    148
    15         You should have received a copy of the GNU General Public License
    16         along with this program; if not, write to the Free Software
    17         Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     9        Redistribution and use in source and binary forms, with or without modification,
     10        are permitted provided that the following conditions are met:
     11
     12            * Redistributions of source code must retain the above copyright notice,
     13              this list of conditions and the following disclaimer.
     14            * Redistributions in binary form must reproduce the above copyright notice,
     15              this list of conditions and the following disclaimer in the documentation
     16              and/or other materials provided with the distribution.
     17            * Neither the name of the Launch4j nor the names of its contributors
     18              may be used to endorse or promote products derived from this software without
     19              specific prior written permission.
     20
     21        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     22        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     23        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     24        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     25        CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     26        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     27        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     28        PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     29        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     30        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     31        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1832*/
    1933
     
    2741 */
    2842public class ExecException extends Exception {
    29         public ExecException() {}
     43        private final int _errLine;
     44
     45        public ExecException(Throwable t, int errLine) {
     46                super(t);
     47                _errLine = errLine;
     48        }
    3049
    3150        public ExecException(Throwable t) {
    32                 super(t);
     51                this(t, -1);
    3352        }
    34        
     53
     54        public ExecException(String msg, int errLine) {
     55                super(msg);
     56                _errLine = errLine;
     57        }
     58
    3559        public ExecException(String msg) {
    36                 super(msg);
     60                this(msg, -1);
     61        }
     62
     63        public int getErrLine() {
     64                return _errLine;
    3765        }
    3866}
  • installer/lib/launch4j/src/net/sf/launch4j/FileChooserFilter.java

    rd7e9096 r7212f85  
    11/*
    2         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    3         Copyright (C) 2005 Grzegorz Kowal
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
    44
    5         This program is free software; you can redistribute it and/or modify
    6         it under the terms of the GNU General Public License as published by
    7         the Free Software Foundation; either version 2 of the License, or
    8         (at your option) any later version.
     5        Copyright (c) 2004, 2007 Grzegorz Kowal
    96
    10         This program is distributed in the hope that it will be useful,
    11         but WITHOUT ANY WARRANTY; without even the implied warranty of
    12         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13         GNU General Public License for more details.
     7        All rights reserved.
    148
    15         You should have received a copy of the GNU General Public License
    16         along with this program; if not, write to the Free Software
    17         Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     9        Redistribution and use in source and binary forms, with or without modification,
     10        are permitted provided that the following conditions are met:
     11
     12            * Redistributions of source code must retain the above copyright notice,
     13              this list of conditions and the following disclaimer.
     14            * Redistributions in binary form must reproduce the above copyright notice,
     15              this list of conditions and the following disclaimer in the documentation
     16              and/or other materials provided with the distribution.
     17            * Neither the name of the Launch4j nor the names of its contributors
     18              may be used to endorse or promote products derived from this software without
     19              specific prior written permission.
     20
     21        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     22        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     23        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     24        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     25        CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     26        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     27        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     28        PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     29        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     30        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     31        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1832*/
    1933
  • installer/lib/launch4j/src/net/sf/launch4j/Log.java

    rd7e9096 r7212f85  
    11/*
    2         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    3         Copyright (C) 2005 Grzegorz Kowal
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
    44
    5         This program is free software; you can redistribute it and/or modify
    6         it under the terms of the GNU General Public License as published by
    7         the Free Software Foundation; either version 2 of the License, or
    8         (at your option) any later version.
     5        Copyright (c) 2004, 2007 Grzegorz Kowal
    96
    10         This program is distributed in the hope that it will be useful,
    11         but WITHOUT ANY WARRANTY; without even the implied warranty of
    12         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13         GNU General Public License for more details.
     7        All rights reserved.
    148
    15         You should have received a copy of the GNU General Public License
    16         along with this program; if not, write to the Free Software
    17         Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     9        Redistribution and use in source and binary forms, with or without modification,
     10        are permitted provided that the following conditions are met:
     11
     12            * Redistributions of source code must retain the above copyright notice,
     13              this list of conditions and the following disclaimer.
     14            * Redistributions in binary form must reproduce the above copyright notice,
     15              this list of conditions and the following disclaimer in the documentation
     16              and/or other materials provided with the distribution.
     17            * Neither the name of the Launch4j nor the names of its contributors
     18              may be used to endorse or promote products derived from this software without
     19              specific prior written permission.
     20
     21        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     22        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     23        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     24        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     25        CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     26        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     27        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     28        PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     29        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     30        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     31        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1832*/
    1933
  • installer/lib/launch4j/src/net/sf/launch4j/Main.java

    rd7e9096 r7212f85  
    11/*
    2         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    3         Copyright (C) 2005 Grzegorz Kowal
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
    44
    5         This program is free software; you can redistribute it and/or modify
    6         it under the terms of the GNU General Public License as published by
    7         the Free Software Foundation; either version 2 of the License, or
    8         (at your option) any later version.
     5        Copyright (c) 2004, 2008 Grzegorz Kowal
    96
    10         This program is distributed in the hope that it will be useful,
    11         but WITHOUT ANY WARRANTY; without even the implied warranty of
    12         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13         GNU General Public License for more details.
     7        All rights reserved.
    148
    15         You should have received a copy of the GNU General Public License
    16         along with this program; if not, write to the Free Software
    17         Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     9        Redistribution and use in source and binary forms, with or without modification,
     10        are permitted provided that the following conditions are met:
     11
     12            * Redistributions of source code must retain the above copyright notice,
     13              this list of conditions and the following disclaimer.
     14            * Redistributions in binary form must reproduce the above copyright notice,
     15              this list of conditions and the following disclaimer in the documentation
     16              and/or other materials provided with the distribution.
     17            * Neither the name of the Launch4j nor the names of its contributors
     18              may be used to endorse or promote products derived from this software without
     19              specific prior written permission.
     20
     21        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     22        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     23        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     24        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     25        CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     26        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     27        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     28        PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     29        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     30        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     31        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1832*/
    1933
     
    2438
    2539import java.io.File;
     40import java.io.InputStream;
     41import java.util.Properties;
    2642
    2743import net.sf.launch4j.config.ConfigPersister;
    28 import net.sf.launch4j.config.ConfigPersisterException;
    2944import net.sf.launch4j.formimpl.MainFrame;
    3045
     
    3348 */
    3449public class Main {
    35 
    36         public static final String PROGRAM_NAME = "launch4j 2.0.RC3";
    37         public static final String PROGRAM_DESCRIPTION = PROGRAM_NAME +
    38                 " :: Cross-platform Java application wrapper for creating Windows native executables\n" +
    39                 "Copyright (C) 2005 Grzegorz Kowal\n" +
    40                 "launch4j comes with ABSOLUTELY NO WARRANTY\n" +
    41             "This is free software, licensed under the GNU General Public License.\n" +
    42                 "This product includes software developed by the Apache Software Foundation (http://www.apache.org/).\n\n";
     50        private static String _name;
     51        private static String _description;
    4352
    4453        public static void main(String[] args) {
    4554                try {
     55                        Properties props = new Properties();
     56                        InputStream in = Main.class.getClassLoader()
     57                                        .getResourceAsStream("launch4j.properties");
     58                        props.load(in);
     59                        in.close();
     60                        setDescription(props);
     61
    4662                        if (args.length == 0) {
    4763                                ConfigPersister.getInstance().createBlank();
     
    5268                                b.build();
    5369                        } else {
    54                                 System.out.println(PROGRAM_DESCRIPTION + "usage: launch4j config.xml");
     70                                System.out.println(_description
     71                                                + Messages.getString("Main.usage")
     72                                                + ": launch4j config.xml");
    5573                        }
    56                 } catch (ConfigPersisterException e) {
    57                         Log.getConsoleLog().append(e.getMessage());
    58                 } catch (BuilderException e) {
     74                } catch (Exception e) {
    5975                        Log.getConsoleLog().append(e.getMessage());
    6076                }
    6177        }
     78
     79        public static String getName() {
     80                return _name;
     81        }
     82
     83        public static String getDescription() {
     84                return _description;
     85        }
     86
     87        private static void setDescription(Properties props) {
     88                _name = "Launch4j " + props.getProperty("version");
     89                _description = _name +
     90                                " (http://launch4j.sourceforge.net/)\n" +
     91                                "Cross-platform Java application wrapper" +
     92                                                " for creating Windows native executables.\n\n" +
     93                                "Copyright (C) 2004, 2008 Grzegorz Kowal\n\n" +
     94                                "Launch4j comes with ABSOLUTELY NO WARRANTY.\n" +
     95                                "This is free software, licensed under the BSD License.\n" +
     96                                "This product includes software developed by the Apache Software Foundation" +
     97                                                " (http://www.apache.org/).";
     98        }
    6299}
  • installer/lib/launch4j/src/net/sf/launch4j/OptionParser.java

    rd7e9096 r7212f85  
    11/*
    2         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    3         Copyright (C) 2005 Grzegorz Kowal
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
    44
    5         This program is free software; you can redistribute it and/or modify
    6         it under the terms of the GNU General Public License as published by
    7         the Free Software Foundation; either version 2 of the License, or
    8         (at your option) any later version.
     5        Copyright (c) 2004, 2007 Grzegorz Kowal
    96
    10         This program is distributed in the hope that it will be useful,
    11         but WITHOUT ANY WARRANTY; without even the implied warranty of
    12         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13         GNU General Public License for more details.
     7        All rights reserved.
    148
    15         You should have received a copy of the GNU General Public License
    16         along with this program; if not, write to the Free Software
    17         Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     9        Redistribution and use in source and binary forms, with or without modification,
     10        are permitted provided that the following conditions are met:
     11
     12            * Redistributions of source code must retain the above copyright notice,
     13              this list of conditions and the following disclaimer.
     14            * Redistributions in binary form must reproduce the above copyright notice,
     15              this list of conditions and the following disclaimer in the documentation
     16              and/or other materials provided with the distribution.
     17            * Neither the name of the Launch4j nor the names of its contributors
     18              may be used to endorse or promote products derived from this software without
     19              specific prior written permission.
     20
     21        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     22        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     23        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     24        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     25        CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     26        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     27        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     28        PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     29        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     30        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     31        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1832*/
    1933
  • installer/lib/launch4j/src/net/sf/launch4j/RcBuilder.java

    rd7e9096 r7212f85  
    11/*
    2         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    3         Copyright (C) 2005 Grzegorz Kowal
    4 
    5         This program is free software; you can redistribute it and/or modify
    6         it under the terms of the GNU General Public License as published by
    7         the Free Software Foundation; either version 2 of the License, or
    8         (at your option) any later version.
    9 
    10         This program is distributed in the hope that it will be useful,
    11         but WITHOUT ANY WARRANTY; without even the implied warranty of
    12         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13         GNU General Public License for more details.
    14 
    15         You should have received a copy of the GNU General Public License
    16         along with this program; if not, write to the Free Software
    17         Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
     4
     5        Copyright (c) 2004, 2007 Grzegorz Kowal
     6
     7        All rights reserved.
     8
     9        Redistribution and use in source and binary forms, with or without modification,
     10        are permitted provided that the following conditions are met:
     11
     12            * Redistributions of source code must retain the above copyright notice,
     13              this list of conditions and the following disclaimer.
     14            * Redistributions in binary form must reproduce the above copyright notice,
     15              this list of conditions and the following disclaimer in the documentation
     16              and/or other materials provided with the distribution.
     17            * Neither the name of the Launch4j nor the names of its contributors
     18              may be used to endorse or promote products derived from this software without
     19              specific prior written permission.
     20
     21        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     22        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     23        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     24        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     25        CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     26        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     27        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     28        PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     29        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     30        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     31        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1832*/
    1933
     
    2741import java.io.FileWriter;
    2842import java.io.IOException;
     43import java.util.List;
    2944
    3045import net.sf.launch4j.config.Config;
    3146import net.sf.launch4j.config.ConfigPersister;
    3247import net.sf.launch4j.config.Jre;
     48import net.sf.launch4j.config.Msg;
    3349import net.sf.launch4j.config.Splash;
    3450import net.sf.launch4j.config.VersionInfo;
     
    4460        public static final int SUBLANG_DEFAULT = 1;
    4561        public static final int SUBLANG_SYS_DEFAULT     = 2;
     62
     63        // MANIFEST
     64        public static final int MANIFEST = 1;
    4665
    4766        // ICON
     
    6382        public static final int ERR_TITLE = 10;
    6483        public static final int GUI_HEADER_STAYS_ALIVE = 11;
    65         public static final int JVM_ARGS = 12;
    66         public static final int JAR_ARGS = 13;
    67 
     84        public static final int JVM_OPTIONS = 12;
     85        public static final int CMD_LINE = 13;
     86        public static final int JAR = 14;
     87        public static final int MAIN_CLASS = 15;
     88        public static final int CLASSPATH = 16;
     89        public static final int WRAPPER = 17;
     90        public static final int JDK_PREFERENCE = 18;
     91        public static final int ENV_VARIABLES = 19;
     92        public static final int PRIORITY_CLASS = 20;
     93        public static final int DOWNLOAD_URL =  21;
     94        public static final int SUPPORT_URL = 22;
     95        public static final int MUTEX_NAME = 23;
     96        public static final int INSTANCE_WINDOW_TITLE = 24;
     97        public static final int INITIAL_HEAP_SIZE = 25;
     98        public static final int INITIAL_HEAP_PERCENT = 26;
     99        public static final int MAX_HEAP_SIZE = 27;
     100        public static final int MAX_HEAP_PERCENT = 28;
     101       
     102        public static final int STARTUP_ERR = 101;
     103        public static final int BUNDLED_JRE_ERR = 102;
     104        public static final int JRE_VERSION_ERR = 103;
     105        public static final int LAUNCHER_ERR = 104;
     106        public static final int INSTANCE_ALREADY_EXISTS_MSG = 105;
     107       
    68108        private final StringBuffer _sb = new StringBuffer();
    69109
    70110        public String getContent() {
    71111                return _sb.toString();
     112        }
     113
     114        public String getLine(int line) {
     115                return _sb.toString().split("\n")[line - 1];
    72116        }
    73117
     
    80124                addVersionInfo(c.getVersionInfo());
    81125                addJre(c.getJre());
     126                addManifest(MANIFEST, c.getManifest());
    82127                addIcon(APP_ICON, c.getIcon());
    83128                addText(ERR_TITLE, c.getErrTitle());
    84                 addText(JAR_ARGS, c.getJarArgs());
     129                addText(DOWNLOAD_URL, c.getDownloadUrl());
     130                addText(SUPPORT_URL, c.getSupportUrl());
     131                addText(CMD_LINE, c.getCmdLine());
    85132                addWindowsPath(CHDIR, c.getChdir());
     133                addText(PRIORITY_CLASS, String.valueOf(c.getPriorityClass()));
    86134                addTrue(SET_PROC_NAME, c.isCustomProcName());
    87135                addTrue(GUI_HEADER_STAYS_ALIVE, c.isStayAlive());
    88136                addSplash(c.getSplash());
    89                 File f = File.createTempFile("launch4j", "rc");
     137                addMessages(c);
     138
     139                if (c.getSingleInstance() != null) {
     140                        addText(MUTEX_NAME, c.getSingleInstance().getMutexName());
     141                        addText(INSTANCE_WINDOW_TITLE, c.getSingleInstance().getWindowTitle());
     142                }
     143
     144                if (c.getVariables() != null && !c.getVariables().isEmpty()) {
     145                        StringBuffer vars = new StringBuffer();
     146                        append(vars, c.getVariables(), "\t");
     147                        addText(ENV_VARIABLES, vars.toString());
     148                }
     149
     150                // MAIN_CLASS / JAR
     151                addTrue(WRAPPER, !c.isDontWrapJar());
     152                if (c.getClassPath() != null) {
     153                        addText(MAIN_CLASS, c.getClassPath().getMainClass());
     154                        addWindowsPath(CLASSPATH, c.getClassPath().getPathsString());
     155                }
     156                if (c.isDontWrapJar() && c.getJar() != null) {
     157                        addWindowsPath(JAR, c.getJar().getPath());
     158                }
     159
     160                File f = Util.createTempFile("rc");
    90161                BufferedWriter w = new BufferedWriter(new FileWriter(f));
    91162                w.write(_sb.toString());
     
    119190                addVerBlockValue("ProductName", v.getProductName());
    120191                addVerBlockValue("ProductVersion", v.getTxtProductVersion());
    121                 _sb.append("  }\n }\n}\n");
    122         }
    123        
     192                _sb.append("  }\n }\nBLOCK \"VarFileInfo\"\n{\nVALUE \"Translation\", 0x0409, 0x04E4\n}\n}");     
     193        }
     194
    124195        private void addJre(Jre jre) {
    125196                addWindowsPath(JRE_PATH, jre.getPath());
    126197                addText(JAVA_MIN_VER, jre.getMinVersion());
    127198                addText(JAVA_MAX_VER, jre.getMaxVersion());
    128                 StringBuffer jvmArgs = new StringBuffer();
    129                 if (jre.getInitialHeapSize() > 0) {
    130                         jvmArgs.append("-Xms");
    131                         jvmArgs.append(jre.getInitialHeapSize());
    132                         jvmArgs.append('m');
    133                 }
    134                 if (jre.getMaxHeapSize() > 0) {
    135                         addSpace(jvmArgs);
    136                         jvmArgs.append("-Xmx");
    137                         jvmArgs.append(jre.getMaxHeapSize());
    138                         jvmArgs.append('m');
    139                 }
    140                 if (jre.getArgs() != null && jre.getArgs().length() > 0) {
    141                         addSpace(jvmArgs);
    142                         jvmArgs.append(jre.getArgs().replaceAll("\n", " "));
    143                 }
    144                 addText(JVM_ARGS, jvmArgs.toString());
     199                addText(JDK_PREFERENCE, String.valueOf(jre.getJdkPreferenceIndex()));
     200                addInteger(INITIAL_HEAP_SIZE, jre.getInitialHeapSize());
     201                addInteger(INITIAL_HEAP_PERCENT, jre.getInitialHeapPercent());
     202                addInteger(MAX_HEAP_SIZE, jre.getMaxHeapSize());
     203                addInteger(MAX_HEAP_PERCENT, jre.getMaxHeapPercent());
     204
     205                StringBuffer options = new StringBuffer();
     206                if (jre.getOptions() != null && !jre.getOptions().isEmpty()) {
     207                        addSpace(options);
     208                        append(options, jre.getOptions(), " ");
     209                }
     210                addText(JVM_OPTIONS, options.toString());
    145211        }
    146212       
     
    155221                addBitmap(SPLASH_BITMAP, splash.getFile());
    156222        }
     223       
     224        private void addMessages(Config c) {
     225                Msg msg = c.getMessages();
     226                if (msg == null) {
     227                        msg = new Msg();
     228                }
     229                addText(STARTUP_ERR, msg.getStartupErr());
     230                addText(BUNDLED_JRE_ERR, msg.getBundledJreErr());
     231                addText(JRE_VERSION_ERR, msg.getJreVersionErr());
     232                addText(LAUNCHER_ERR, msg.getLauncherErr());
     233                if (c.getSingleInstance() != null) {
     234                        addText(INSTANCE_ALREADY_EXISTS_MSG, msg.getInstanceAlreadyExistsMsg());
     235                }
     236        }
     237
     238        private void append(StringBuffer sb, List list, String separator) {
     239                for (int i = 0; i < list.size(); i++) {
     240                        sb.append(list.get(i));
     241                        if (i < list.size() - 1) {
     242                                sb.append(separator);
     243                        }
     244                }
     245        }
    157246
    158247        private void addText(int id, String text) {
    159                 if (text == null || text.length() == 0) {
     248                if (text == null || text.equals("")) {
    160249                        return;
    161250                }
    162251                _sb.append(id);
    163252                _sb.append(" RCDATA BEGIN \"");
    164                 _sb.append(text);
     253                _sb.append(escape(text));
    165254                _sb.append("\\0\" END\n");
     255        }
     256
     257        private void addTrue(int id, boolean value) {
     258                if (value) {
     259                        addText(id, "true");
     260                }
     261        }
     262
     263        private void addInteger(int id, Integer value) {
     264                if (value != null) {
     265                        addText(id, value.toString());
     266                }
    166267        }
    167268
     
    180281        }
    181282
    182         private void addTrue(int id, boolean value) {
    183                 if (value) {
    184                         addText(id, "true");
    185                 }
     283        private void addManifest(int id, File manifest) {
     284                if (manifest == null || manifest.getPath().equals("")) {
     285                        return;
     286                }
     287                _sb.append(id);
     288                _sb.append(" 24 \"");
     289                _sb.append(getPath(Util.getAbsoluteFile(
     290                                ConfigPersister.getInstance().getConfigPath(), manifest)));
     291                _sb.append("\"\n");
    186292        }
    187293
     
    224330                _sb.append("\", \"");
    225331                if (value != null) {
    226                         _sb.append(value);
     332                        _sb.append(escape(value));
    227333                }
    228334                _sb.append("\"\n");
    229335        }
     336
     337        private String escape(String text) {
     338                return text.replaceAll("\"", "\"\"");
     339        }
    230340}
  • installer/lib/launch4j/src/net/sf/launch4j/Util.java

    rd7e9096 r7212f85  
    11/*
    2  launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    3  Copyright (C) 2005 Grzegorz Kowal
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
    44
    5  This program is free software; you can redistribute it and/or modify
    6  it under the terms of the GNU General Public License as published by
    7  the Free Software Foundation; either version 2 of the License, or
    8  (at your option) any later version.
     5        Copyright (c) 2004, 2007 Grzegorz Kowal
    96
    10  This program is distributed in the hope that it will be useful,
    11  but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  GNU General Public License for more details.
     7        All rights reserved.
    148
    15  You should have received a copy of the GNU General Public License
    16  along with this program; if not, write to the Free Software
    17  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18  */
     9        Redistribution and use in source and binary forms, with or without modification,
     10        are permitted provided that the following conditions are met:
     11
     12            * Redistributions of source code must retain the above copyright notice,
     13              this list of conditions and the following disclaimer.
     14            * Redistributions in binary form must reproduce the above copyright notice,
     15              this list of conditions and the following disclaimer in the documentation
     16              and/or other materials provided with the distribution.
     17            * Neither the name of the Launch4j nor the names of its contributors
     18              may be used to endorse or promote products derived from this software without
     19              specific prior written permission.
     20
     21        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     22        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     23        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     24        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     25        CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     26        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     27        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     28        PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     29        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     30        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     31        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32*/
    1933
    2034/*
     
    3145import java.io.Reader;
    3246import java.io.Writer;
     47import java.util.regex.Matcher;
     48import java.util.regex.Pattern;
    3349
    3450/**
     
    4157        private Util() {}
    4258
     59        public static File createTempFile(String suffix) throws IOException {
     60                String tmpdir = System.getProperty("launch4j.tmpdir");
     61                if (tmpdir != null) {
     62                        if (tmpdir.indexOf(' ') != -1) {
     63                                throw new IOException(Messages.getString("Util.tmpdir"));
     64                        }
     65                        return File.createTempFile("launch4j", suffix, new File(tmpdir));
     66                } else {
     67                        return File.createTempFile("launch4j", suffix);
     68                }
     69        }
     70
    4371        /**
    4472         * Returns the base directory of a jar file or null if the class is a standalone file.
     
    4775         * Based on a patch submitted by Josh Elsasser
    4876         */
    49         public static String getJarBasedir() {
     77        public static File getJarBasedir() {
    5078                String url = Util.class.getClassLoader()
    5179                                .getResource(Util.class.getName().replace('.', '/') + ".class")
     
    5987                        }
    6088                        String basedir = jar.substring(0, x + 1);
    61                         return new File(basedir).getPath();
     89                        return new File(basedir);
    6290                } else {
    63                         return null;
     91                        return new File(".");
    6492                }
    6593        }
     
    79107        }
    80108
    81         public static void exec(String cmd, Log log) throws ExecException {
     109        public static void exec(String[] cmd, Log log) throws ExecException {
    82110                BufferedReader is = null;
    83111                try {
    84112                        if (WINDOWS_OS) {
    85                                 cmd = cmd.replaceAll("/", "\\\\");
     113                                for (int i = 0; i < cmd.length; i++) {
     114                                        cmd[i] = cmd[i].replaceAll("/", "\\\\");
     115                                }
    86116                        }
    87117                        Process p = Runtime.getRuntime().exec(cmd);
    88118                        is = new BufferedReader(new InputStreamReader(p.getErrorStream()));
    89119                        String line;
     120                        int errLine = -1;
     121                        Pattern pattern = Pattern.compile(":\\d+:");
    90122                        while ((line = is.readLine()) != null) {
    91123                                log.append(line);
     124                                Matcher matcher = pattern.matcher(line);
     125                                if (matcher.find()) {
     126                                        errLine = Integer.valueOf(
     127                                                        line.substring(matcher.start() + 1, matcher.end() - 1))
     128                                                        .intValue();
     129                                        if (line.matches("(?i).*unrecognized escape sequence")) {
     130                                                log.append(Messages.getString("Util.use.double.backslash"));
     131                                        }
     132                                        break;
     133                                }
    92134                        }
    93135                        is.close();
    94136                        p.waitFor();
     137                        if (errLine != -1) {
     138                                throw new ExecException(Messages.getString("Util.exec.failed")
     139                                                + ": " + cmd, errLine);
     140                        }
    95141                        if (p.exitValue() != 0) {
    96                                 String msg = "Exec failed (" + p.exitValue() + "): " + cmd;
    97                                 log.append(msg);
    98                                 throw new ExecException(msg);
     142                                throw new ExecException(Messages.getString("Util.exec.failed")
     143                                                + "(" + p.exitValue() + "): " + cmd);
    99144                        }
    100145                } catch (IOException e) {
  • installer/lib/launch4j/src/net/sf/launch4j/ant/AntConfig.java

    rd7e9096 r7212f85  
    11/*
    2         launch4j :: Cross-platform Java application wrapper for creating Windows native executables
    3         Copyright (C) 2005 Grzegorz Kowal
     2        Launch4j (http://launch4j.sourceforge.net/)
     3        Cross-platform Java application wrapper for creating Windows native executables.
    44
    5         This program is free software; you can redistribute it and/or modify
    6         it under the terms of the GNU General Public License as published by
    7         the Free Software Foundation; either version 2 of the License, or
    8         (at your option) any later version.
     5        Copyright (c) 2004, 2007 Grzegorz Kowal
    96
    10         This program is distributed in the hope that it will be useful,
    11         but WITHOUT ANY WARRANTY; without even the implied warranty of
    12         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13         GNU General Public License for more details.
     7        All rights reserved.
    148
    15         You should have received a copy of the GNU General Public License
    16         along with this program; if not, write to the Free Software
    17         Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     9        Redistribution and use in source and binary forms, with or without modification,
     10        are permitted provided that the following conditions are met:
     11
     12            * Redistributions of source code must retain the above copyright notice,
     13              this list of conditions and the following disclaimer.
     14            * Redistributions in binary form must reproduce the above copyright notice,
     15              this list of conditions and the following disclaimer in the documentation
     16              and/or other materials provided with the distribution.
     17            * Neither the name of the Launch4j nor the names of its contributors
     18              may be used to endorse or promote products derived from this software without
     19              specific prior written permission.
     20
     21        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     22        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     23        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     24        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     25        CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     26        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     27        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     28        PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     29        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     30        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     31        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1832*/
    1933
     
    2337package net.sf.launch4j.ant;
    2438
     39import java.io.File;
     40import java.util.ArrayList;
     41import java.util.List;
     42
    2543import org.apache.tools.ant.BuildException;
    2644
    2745import net.sf.launch4j.config.Config;
    28 import net.sf.launch4j.config.Jre;
     46import net.sf.launch4j.config.Msg;
     47import net.sf.launch4j.config.SingleInstance;
    2948import net.sf.launch4j.config.Splash;
    3049import net.sf.launch4j.config.VersionInfo;
     
    3453 */
    3554public class AntConfig extends Config {
     55        private final List wrappedHeaderObjects = new ArrayList();
     56        private final List wrappedLibs = new ArrayList();
     57        private final List wrappedVariables = new ArrayList();
    3658
    37         public void addJre(Jre jre) {
     59        public void setJarPath(String path) {
     60                setJar(new File(path));
     61        }
     62
     63        public void addObj(StringWrapper obj) {
     64                wrappedHeaderObjects.add(obj);
     65        }
     66
     67        public void addLib(StringWrapper lib) {
     68                wrappedLibs.add(lib);
     69        }
     70       
     71        public void addVar(StringWrapper var) {
     72                wrappedVariables.add(var);
     73        }
     74
     75        // __________________________________________________________________________________
     76
     77        public void addSingleInstance(SingleInstance singleInstance) {
     78&