This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 39830 - [36cat] runide.sh fails on FreeBSD 5.2R
Summary: [36cat] runide.sh fails on FreeBSD 5.2R
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: Other Unix
: P3 blocker (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-09 18:41 UTC by malakim
Modified: 2008-12-22 14:24 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Improved version that should work (9.10 KB, text/plain)
2004-02-11 09:16 UTC, Jaroslav Tulach
Details
Version of the launcher using prefix (9.10 KB, text/plain)
2004-02-16 09:38 UTC, Jaroslav Tulach
Details

Note You need to log in before you can comment on or make changes to this bug.
Description malakim 2004-02-09 18:41:09 UTC
[ JDK VERSION : J2SE 1.4.2 ]

The default runide.sh fails with the following errors on FreeBSD 5.2R with native JDK 1.4.2-p6:
./runide.sh
expr: illegal option -- J
usage: expr [-e] expression
expr: illegal option -- J
usage: expr [-e] expression
expr: illegal option -- J
usage: expr [-e] expression
expr: illegal option -- J
usage: expr [-e] expression

Problem solved by using launcher script from previos installation of NetBeans 3.5.1 (presumably patched by FreeBSD ports system).

Files below.
runide.sh generated by installer (fails):
#!/bin/sh
#                 Sun Public License Notice
# 
# The contents of this file are subject to the Sun Public License
# Version 1.0 (the "License"). You may not use this file except in
# compliance with the License. A copy of the License is available at
# http://www.sun.com/
# 
# The Original Code is NetBeans. The Initial Developer of the Original
# Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
# Microsystems, Inc. All Rights Reserved.

# -----------------------------------------------------
# Run with -help for usage.
# Normally, editing this script should not be required.
# -----------------------------------------------------

# use $JDK_HOME or $NB_JDK_HOME or the -jdkhome switch, do not edit this here
# (see below for info on .runide_defaults.sh)
jdkhome=/usr/local/jdk1.4.2

# append on command line or ide.cfg, with -J prefix on each
jreflags=""

PRG=$0

#
# resolve symlinks
#

while [ -h "$PRG" ]; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null`
    if expr "$link" : '^/' 2> /dev/null >/dev/null; then
	PRG="$link"
    else
	PRG="`dirname "$PRG"`/$link"
    fi
done

progdir=`dirname "$PRG"`
progname=`basename "$0"`

idehome="$progdir/.."

# absolutize idehome

oldpwd=`pwd` ; cd "${idehome}"; idehome=`pwd`; cd "${oldpwd}"; unset oldpwd

# calculate branding to brand userdir with
defaults="$idehome/bin/.runide_defaults.sh"
if [ -r "$idehome/lib/branding" ]; then
    branding=`cat "$idehome/lib/branding"`
    if [ -r "$idehome/bin/.runide_defaults_$branding.sh" ]; then
        defaults="$idehome/bin/.runide_defaults_$branding.sh"
    fi
fi
# This script should set the var userdir at the least:
# (another likely option would be $jdkhome, see #18628)
. "$defaults"

jargs=${jreflags}
jargs="$jargs -Dnetbeans.home=\"$idehome\""
jargs="$jargs -Djava.security.policy=\"$idehome/bin/ide.policy\""

args=""

prefixcp=""
postfixcp=""

updater_class=org.netbeans.updater.UpdaterFrame
ide_class_option=

#
# defaults
#

# if JDK_HOME is set it overrides ${JAVA_PATH}

if [ ! -z "$JDK_HOME" -a -z "$jdkhome" ] ; then
    jdkhome="$JDK_HOME"
fi

# if JAVA_PATH is set it is used if necessary

if [ ! -z "$JAVA_PATH" -a -z "$jdkhome" ] ; then
    jdkhome="$JAVA_PATH"
fi

#
# parse arguments
#

parse_args() {
while [ $# -gt 0 ] ; do
#    echo "Processing arg: '$1'"
    case "$1" in
        -h|-?|-help|--help) cat >&2 <<EOF
Usage: $0 {options} arguments

General options:
  --help                show this help 
  --jdkhome <path>      path to Java(TM) 2 SDK, Standard Edition
  -J<jvm_option>        pass <jvm_option> to JVM

  --cp:p <classpath>    prepend <classpath> to classpath
  --cp:a <classpath>    append <classpath> to classpath

EOF
            # go on and print IDE options as well
            args="$args --help" ;;
        -jdkhome|--jdkhome) shift; if [ $# -gt 0 ] ; then jdkhome=$1; fi;;
        # this has to be here for purposes of updater.jar, but it should be
        # better to handle this argument inside the java launcher part 
        -userdir|--userdir) shift; if [ $# -gt 0 ] ; then userdir=$1; fi;;
        # For compatibility only:
        -mainclass) shift; if [ $# -gt 0 ] ; then ide_class_option=-Dnetbeans.mainclass=$1; fi;;
        -cp|-cp:a|--cp|--cp:a)
            shift;
            if [ $# -gt 0 ] ; then
                if [ ! -z "$postfixcp" ] ; then postfixcp="$postfixcp:" ; fi
                postfixcp=$postfixcp$1;
            fi
            ;;
        
        -cp:p|--cp:p)
            shift;
            if [ $# -gt 0 ] ; then
                if [ ! -z "$prefixcp" ] ; then prefixcp="$prefixcp:" ; fi
                prefixcp=$prefixcp$1;
            fi
            ;;
        
        -J*) jopt=`expr "$1" : '-J\(.*\)'`; jargs="$jargs \"$jopt\"";;
        *) args="$args \"$1\"" ;;
    esac
    shift
done
} # parse_args()

# Process any ./ide.cfg or ~/ide.cfg.
# Note that there is no quoting scheme for these files.
if [ -r "${HOME}/ide.cfg" ]; then
    parse_args `cat "${HOME}"/ide.cfg`
elif [ -r "${progdir}/ide.cfg" ]; then
    parse_args `cat "${progdir}"/ide.cfg`
# else leave as is
fi

if [ -f /usr/j2se/opt/javahelp/lib/jhall.jar ]; then
    # See http://www.netbeans.org/issues/show_bug.cgi?id=22455
    jhjar="`echo ${idehome}/modules/autoload/ext/jh-*.jar`"
    parse_args "-J-Xbootclasspath/p:${jhjar}"
fi

# Process arguments given on the command line.
parse_args "$@"

#
# check JDK
#

if [ -z "$jdkhome" ] ; then
    echo "Cannot find JDK. Please set the JDK_HOME environment variable to point" >&2
    echo "to your JDK installation directory, or use the --jdkhome switch" >&2
    exit 2
fi

if [ ! -x "${jdkhome}/bin/java" ] ; then
    echo "Cannot find JDK at ${jdkhome}. Please set the JDK_HOME" >&2
    echo "environment variable to point to your JDK installation directory," >&2
    echo "or use the --jdkhome switch" >&2
    exit 2
fi

#
# check userdir
#

if [ ! -z "$userdir" ] ; then
    args="--userdir \"${userdir}\" $args"
fi

#
# increase file descriptor's limit, on Solaris it's set to 64, too small for
# fastjavac
#

ulimit -n 1024

append_jars_to_cp() {
    dir="$1"
    for ex in jar zip ; do
        if [ "`echo "${dir}"/*.$ex`" != "${dir}/*.$ex" ] ; then
            for x in "${dir}"/*.$ex ; do
                if [ ! -z "$cp" ] ; then cp="$cp:" ; fi
                cp="$cp$x"
            done
        fi
    done
}

build_cp() {
    base="$1"
    append_jars_to_cp "${base}/lib/ext"
    append_jars_to_cp "${base}/lib/ext/locale"
}

do_run_updater() {
    eval "\"$jdkhome/bin/java\"" -classpath "\"${updatercp}\"" $jargs "-Dnetbeans.user=$userdir" $updater_class
}

look_for_pre_runs() {
    base="$1"
    dir="${base}/update/download"
    if [ -f "${dir}/install_later.xml" -a "`echo "${dir}"/*.nbm`" != "${dir}/*.nbm" ] ; then
        run_updater=yes
    fi
}

look_for_post_runs() {
    base="$1"
    dir="${base}/update/download"
    if [ \! -f "${dir}/install_later.xml" -a "`echo "${dir}"/*.nbm`" != "${dir}/*.nbm" ] ; then
        run_updater=yes
    fi
}

#
# dump the OS env variables into a temp file
#

nbenvfile="/tmp/nbenv.$$"

# attempt to delete a leftover from crashed instance which happened to have the
# same PID

rm -f ${nbenvfile}

# if ${nbenvfile} already exists there is a possibility that it is a leftover
# after another instance of this script crashed and the owner of the file can
# be another user (PIDs are reused).  In such a case keep appending 'X' to the
# filename until we find an unused name

while [ -f "$nbenvfile" ]
do
    nbenvfile=${nbenvfile}X
done

# #30621: handle embedded newlines in values, if possible.
if [ -r /proc/self/environ ]
then
    cat /proc/self/environ > "$nbenvfile"
    nbenvnullsep=true
# XXX works, but spends extra 350msec on a Solaris box I saw; probably too obscure to be worth it:
#elif perl -e 'foreach (keys %ENV) {print "$_=$ENV{$_}\0"}' > "$nbenvfile" 2> /dev/null
#then
#    nbenvnullsep=true
elif [ -x /usr/bin/env ] ; then
    /usr/bin/env > "$nbenvfile"
    nbenvnullsep=false
else
    echo "" > "$nbenvfile"
    nbenvnullsep=false
fi

# Note that Bash calls this even if you stop the command with Ctrl-C;
# Solaris' /bin/sh does not - but both call it on normal exit.
trap "rm -f '$nbenvfile'" EXIT

#
# main loop
#

# clear to prevent loop from ending
restart="yes"
first_time_starting="yes"

while [ "$restart" ] ; do

    #
    # build CLASSPATH
    #
    
    cp=""
    updatercp=""
    
    build_cp "${idehome}"
    
    if [ -f "${idehome}/lib/updater.jar" ] ; then
        updatercp="${idehome}/lib/updater.jar"
    fi

    # JDK tools
    
    for ex in jar zip ; do
        # XXX does this still work if ${jdkhome} contains spaces?
        if [ "`echo "${jdkhome}"/lib/*.$ex`" != "${jdkhome}/lib/*.$ex" ] ;then
            for x in "${jdkhome}"/lib/*.$ex ; do
                if [ ! -z "$cp" ] ; then cp="$cp:" ; fi
                cp="${cp}$x"
            done
        fi
    done

    # user-specified prefix and postfix CLASSPATH
    
    if [ ! -z "${prefixcp}" ] ; then
        cp="${prefixcp}:$cp"
    fi
    
    if [ ! -z "${postfixcp}" ] ; then
        cp="$cp:${postfixcp}"
    fi


    # prepend IDE's classpath to updater's classpath
    # (just xml-apis.jar and one XML parser would suffice)
    if [ ! -z "$updatercp" ] ; then
        updatercp=${cp}:${updatercp}
    else
        updatercp=${cp}
    fi

    # First check for pre-run updates.
    if [ "$first_time_starting" ] ; then
        run_updater=""
        look_for_pre_runs "$idehome"
        look_for_pre_runs "$userdir"
        if [ "$run_updater" ] ; then do_run_updater ; fi
        # Do not check this after a restart, it makes no sense.
        first_time_starting=""
    fi
    
    #
    # let's go
    #

    eval ${_NB_PROFILE_CMD} "\"${jdkhome}/bin/java\"" -Djdk.home="\"${jdkhome}\"" -classpath "\"$cp\"" \
        -Dnetbeans.osenv="${nbenvfile}" -Dnetbeans.osenv.nullsep=${nbenvnullsep} \
        $jargs $ide_class_option org.netbeans.Main $args
    exitcode=$?

    # If we should update anything, do it and restart IDE.
    run_updater=""
    look_for_post_runs "$idehome"
    look_for_post_runs "$userdir"
    if [ "$run_updater" ] ; then
        do_run_updater
        restart="yes"
    else
        restart=""
        # will fall thru loop and exit
    fi

done

# and we exit.
exit $exitcode

Launcher script from 3.5.1 (working)
#!/bin/sh
#                 Sun Public License Notice
# 
# The contents of this file are subject to the Sun Public License
# Version 1.0 (the "License"). You may not use this file except in
# compliance with the License. A copy of the License is available at
# http://www.sun.com/
# 
# The Original Code is NetBeans. The Initial Developer of the Original
# Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun
# Microsystems, Inc. All Rights Reserved.

# -----------------------------------------------------
# Run with -help for usage.
# Normally, editing this script should not be required.
# -----------------------------------------------------

# use $JDK_HOME or $NB_JDK_HOME or the -jdkhome switch, do not edit this here
# (see below for info on .runide_defaults.sh)
jdkhome=""

# append on command line or ide.cfg, with -J prefix on each
jreflags=""

PRG=$0

#
# resolve symlinks
#

while [ -h "$PRG" ]; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null`
    if expr "$link" : '^/' 2> /dev/null >/dev/null; then
	PRG="$link"
    else
	PRG="`dirname "$PRG"`/$link"
    fi
done

progdir=`dirname "$PRG"`
progname=`basename "$0"`

idehome="$progdir/.."

# absolutize idehome

oldpwd=`pwd` ; cd "${idehome}"; idehome=`pwd`; cd "${oldpwd}"; unset oldpwd

# calculate branding to brand userdir with
defaults="$idehome/bin/.runide_defaults.sh"
if [ -r "$idehome/lib/branding" ]; then
    branding=`cat "$idehome/lib/branding"`
    if [ -r "$idehome/bin/.runide_defaults_$branding.sh" ]; then
        defaults="$idehome/bin/.runide_defaults_$branding.sh"
    fi
fi
# This script should set the var userdir at the least:
# (another likely option would be $jdkhome, see #18628)
. "$defaults"

jargs=${jreflags}
jargs="$jargs -Dnetbeans.home=\"$idehome\""
jargs="$jargs -Djava.security.policy=\"$idehome/bin/ide.policy\""

args=""

prefixcp=""
postfixcp=""

updater_class=org.netbeans.updater.UpdaterFrame
openfile_class=org.netbeans.modules.openfile.Main
ide_class_option=

#
# defaults
#

# if JDK_HOME is set it overrides ${JAVA_PATH}

if [ ! -z "$JDK_HOME" -a -z "$jdkhome" ] ; then
    jdkhome="$JDK_HOME"
fi

# if JAVA_PATH is set it is used if necessary

if [ ! -z "$JAVA_PATH" -a -z "$jdkhome" ] ; then
    jdkhome="$JAVA_PATH"
fi

#
# parse arguments
#

parse_args() {
while [ $# -gt 0 ] ; do
#    echo "Processing arg: '$1'"
    case "$1" in
        -h|-help) cat <<EOF
Usage: $0 {options} arguments

Options can be

   -h -help
        shows usage
   -?
        help on more parameters (not interpreted by launcher)
   -jdkhome <path>
        path to JDK (could also be just JRE but some modules may not work!)
   -userdir <path>
        specifies user settings directory (${userdir} by default)
   -J<jvm_options>
        passes <jvm_option> to JVM
Opening files (requires utilities.jar to be enabled & Open File server on):
   -open <filename>
        open a file in the IDE (either uses existing IDE or launches new)
   -host <hostname>
        host to connect to; default localhost
   -port <portnumber>
        port to connect to; default 7318
Classpath options (normally you should NOT use these except to support -ui):
   -cp:p <classpath>
        prepends <classpath> to IDE's classpath
   -cp:a <classpath>
        appends <classpath> to IDE's classpath

All other options and arguments are passed to the IDE, so try -? for more.
Any options found in $HOME/ide.cfg or else $idehome/bin/ide.cfg
are treated as defaults (may be overridden).
See documentation for details.
EOF
exit 1
;;
        -jdkhome) shift; if [ $# -gt 0 ] ; then jdkhome=$1; fi;;
        -userdir) shift; if [ $# -gt 0 ] ; then userdir=$1; fi;;
        -open) shift; if [ $# -gt 0 ] ; then openfile=$1; fi;;
        -port) shift; if [ $# -gt 0 ] ; then port=$1; fi;;
        -host) shift; if [ $# -gt 0 ] ; then host=$1; fi;;
        # For compatibility only:
        -mainclass) shift; if [ $# -gt 0 ] ; then ide_class_option=-Dnetbeans.mainclass=$1; fi;;
        -cp|-cp:a)
            shift;
            if [ $# -gt 0 ] ; then
                if [ ! -z "$postfixcp" ] ; then postfixcp="$postfixcp:" ; fi
                postfixcp=$postfixcp$1;
            fi
            ;;
        
        -cp:p)
            shift;
            if [ $# -gt 0 ] ; then
                if [ ! -z "$prefixcp" ] ; then prefixcp="$prefixcp:" ; fi
                prefixcp=$prefixcp$1;
            fi
            ;;
        
        -J*) jopt=`expr -- "$1" : '-J\(.*\)'`; jargs="$jargs \"$jopt\"";;
        *) args="$args \"$1\"" ;;
    esac
    shift
done
} # parse_args()

# Process any ./ide.cfg or ~/ide.cfg.
# Note that there is no quoting scheme for these files.
if [ -r "${HOME}/ide.cfg" ]; then
    parse_args `cat "${HOME}"/ide.cfg`
elif [ -r "${progdir}/ide.cfg" ]; then
    parse_args `cat "${progdir}"/ide.cfg`
# else leave as is
fi

if [ -f /usr/j2se/opt/javahelp/lib/jhall.jar ]; then
    # See http://www.netbeans.org/issues/show_bug.cgi?id=22455
    jhjar="`echo ${idehome}/modules/autoload/ext/jh-*.jar`"
    parse_args "-J-Xbootclasspath/p:${jhjar}"
fi

# Process arguments given on the command line.
parse_args "$@"

#
# check JDK
#

if [ -z "$jdkhome" ] ; then
    echo "Cannot find JDK. Please set the JDK_HOME environment variable to point"
    echo "to your JDK installation directory, or use the -jdkhome switch"
    echo ""
    exit 1
fi

if [ ! -x "${jdkhome}/bin/java" ] ; then
    echo "Cannot find JDK at ${jdkhome}. Please set the JDK_HOME"
    echo "environment variable to point to your JDK installation directory,"
    echo "or use the -jdkhome switch"
    echo ""
    exit 1
fi

#
# open file?
#

if [ ! -z "$openfile" -a -f "${idehome}/modules/utilities.jar" ] ; then
    args=""
    if [ ! -z "$host" ] ; then
        args="$args -host $host"
    fi
    if [ ! -z "$port" ] ; then
        args="$args -port $port"
    fi
    eval "\"$jdkhome/bin/java\"" -classpath "\"${idehome}/modules/utilities.jar\"" $openfile_class $args "\"$openfile\""
    rc=$?
    
    if [ $rc -eq 0 -o $rc -eq 1 ] ; then
        exit 0
    else
        jargs="-Dnetbeans.openfile=\"$openfile\" $jargs"
    fi
fi

#
# check userdir
#

if [ ! -z "$userdir" ] ; then
    jargs="-Dnetbeans.user=\"${userdir}\" $jargs"
fi

#
# increase file descriptor's limit, on Solaris it's set to 64, too small for
# fastjavac
#

ulimit -n 1024

append_jars_to_cp() {
    dir="$1"
    for ex in jar zip ; do
        if [ "`echo "${dir}"/*.$ex`" != "${dir}/*.$ex" ] ; then
            for x in "${dir}"/*.$ex ; do
                if [ ! -z "$cp" ] ; then cp="$cp:" ; fi
                cp="$cp$x"
            done
        fi
    done
}

build_cp() {
    base="$1"
    append_jars_to_cp "${base}/lib/ext"
    append_jars_to_cp "${base}/lib/ext/locale"
}

do_run_updater() {
    eval "\"$jdkhome/bin/java\"" -classpath "\"${updatercp}\"" $jargs $updater_class
}

look_for_pre_runs() {
    base="$1"
    dir="${base}/update/download"
    if [ -f "${dir}/install_later.xml" -a "`echo "${dir}"/*.nbm`" != "${dir}/*.nbm" ] ; then
        run_updater=yes
    fi
}

look_for_post_runs() {
    base="$1"
    dir="${base}/update/download"
    if [ \! -f "${dir}/install_later.xml" -a "`echo "${dir}"/*.nbm`" != "${dir}/*.nbm" ] ; then
        run_updater=yes
    fi
}

#
# dump the OS env variables into a temp file
#

nbenvfile="/tmp/nbenv.$$"

# attempt to delete a leftover from crashed instance which happened to have the
# same PID

rm -f ${nbenvfile}

# if ${nbenvfile} already exists there is a possibility that it is a leftover
# after another instance of this script crashed and the owner of the file can
# be another user (PIDs are reused).  In such a case keep appending 'X' to the
# filename until we find an unused name

while [ -f "$nbenvfile" ]
do
    nbenvfile=${nbenvfile}X
done

# #30621: handle embedded newlines in values, if possible.
if [ -r /proc/self/environ ]
then
    cat /proc/self/environ > "$nbenvfile"
    nbenvnullsep=true
# XXX works, but spends extra 350msec on a Solaris box I saw; probably too obscure to be worth it:
#elif perl -e 'foreach (keys %ENV) {print "$_=$ENV{$_}\0"}' > "$nbenvfile" 2> /dev/null
#then
#    nbenvnullsep=true
elif [ -x /usr/bin/env ] ; then
    /usr/bin/env > "$nbenvfile"
    nbenvnullsep=false
else
    echo "" > "$nbenvfile"
    nbenvnullsep=false
fi

# Note that Bash calls this even if you stop the command with Ctrl-C;
# Solaris' /bin/sh does not - but both call it on normal exit.
trap "rm -f '$nbenvfile'" EXIT

#
# main loop
#

# clear to prevent loop from ending
restart="yes"
first_time_starting="yes"

while [ "$restart" ] ; do

    #
    # build CLASSPATH
    #
    
    cp=""
    updatercp=""
    
    build_cp "${idehome}"
    
    if [ -f "${idehome}/lib/updater.jar" ] ; then
        updatercp="${idehome}/lib/updater.jar"
    fi

    # JDK tools
    
    for ex in jar zip ; do
        # XXX does this still work if ${jdkhome} contains spaces?
        if [ "`echo "${jdkhome}"/lib/*.$ex`" != "${jdkhome}/lib/*.$ex" ] ;then
            for x in "${jdkhome}"/lib/*.$ex ; do
                if [ ! -z "$cp" ] ; then cp="$cp:" ; fi
                cp="${cp}$x"
            done
        fi
    done

    # user-specified prefix and postfix CLASSPATH
    
    if [ ! -z "${prefixcp}" ] ; then
        cp="${prefixcp}:$cp"
    fi
    
    if [ ! -z "${postfixcp}" ] ; then
        cp="$cp:${postfixcp}"
    fi


    # prepend IDE's classpath to updater's classpath
    # (just xml-apis.jar and one XML parser would suffice)
    if [ ! -z "$updatercp" ] ; then
        updatercp=${cp}:${updatercp}
    else
        updatercp=${cp}
    fi

    # First check for pre-run updates.
    if [ "$first_time_starting" ] ; then
        run_updater=""
        look_for_pre_runs "$idehome"
        look_for_pre_runs "$userdir"
        if [ "$run_updater" ] ; then do_run_updater ; fi
        # Do not check this after a restart, it makes no sense.
        first_time_starting=""
    fi
    
    #
    # let's go
    #

    if [ ! -z "$openfile" -a -f "${idehome}/modules/utilities.jar" ] ; then
        openfile_prop="-Dnetbeans.openfile=\"$openfile\""
        openfile=""
    fi
    
    eval ${_NB_PROFILE_CMD} "\"${jdkhome}/bin/java\"" -Djdk.home="\"${jdkhome}\"" -classpath "\"$cp\"" \
        -Dnetbeans.osenv="${nbenvfile}" -Dnetbeans.osenv.nullsep=${nbenvnullsep} \
        ${openfile_prop} \
        $jargs $ide_class_option org.netbeans.Main $args

    # If we should update anything, do it and restart IDE.
    run_updater=""
    look_for_post_runs "$idehome"
    look_for_post_runs "$userdir"
    if [ "$run_updater" ] ; then
        do_run_updater
        restart="yes"
    else
        restart=""
        # will fall thru loop and exit
    fi

done

# and we exit.
Comment 1 Marian Mirilovic 2004-02-10 08:32:00 UTC
Who want take this ? 
Yarda, Jesse ?
Comment 2 Jaroslav Tulach 2004-02-10 13:24:35 UTC
I need more info on what exactly falls. Please try to execute the new
script in debug mode and send me the output? Try this:

sh -x runide.sh >$HOME/output 2>&1

and attach the output to this bug.
Comment 3 malakim 2004-02-10 17:02:48 UTC
Output of sh -x runide.old >~/output 2>&1 below:

+ jdkhome=/usr/local/jdk1.4.2
+ jreflags=
+ PRG=runide.old
+ [ -h runide.old ]
+ dirname runide.old
+ progdir=.
+ basename runide.old
+ progname=runide.old
+ idehome=./..
+ pwd
+ oldpwd=/usr/local/NetBeans3.6Beta/bin
+ cd ./..
+ pwd
+ idehome=/usr/local/NetBeans3.6Beta
+ cd /usr/local/NetBeans3.6Beta/bin
+ unset oldpwd
+ defaults=/usr/local/NetBeans3.6Beta/bin/.runide_defaults.sh
+ [ -r /usr/local/NetBeans3.6Beta/lib/branding ]
+ . /usr/local/NetBeans3.6Beta/bin/.runide_defaults.sh
+ userdir=/home/markus/.netbeans/3.6_Beta
+ jdkhome=
+ jargs=
+ jargs= -Dnetbeans.home="/usr/local/NetBeans3.6Beta"
+ jargs= -Dnetbeans.home="/usr/local/NetBeans3.6Beta"
-Djava.security.policy="/usr/local/NetBeans3.6Beta/bin/ide.policy"
+ args=
+ prefixcp=
+ postfixcp=
+ updater_class=org.netbeans.updater.UpdaterFrame
+ ide_class_option=
+ [ ! -z  -a -z  ]
+ [ ! -z  -a -z  ]
+ [ -r /home/markus/ide.cfg ]
+ [ -r ./ide.cfg ]
+ cat ./ide.cfg
+ parse_args -jdkhome /usr/local/jdk1.4.2 -J-Xmx96m -J-Xss1024k
-J-Xms24m -J-Xverify:none
+ [ 6 -gt 0 ]
+ shift
+ [ 5 -gt 0 ]
+ jdkhome=/usr/local/jdk1.4.2
+ shift
+ [ 4 -gt 0 ]
+ expr -J-Xmx96m : -J\(.*\)
expr: illegal option -- J
usage: expr [-e] expression
+ jopt=
+ jargs= -Dnetbeans.home="/usr/local/NetBeans3.6Beta"
-Djava.security.policy="/usr/local/NetBeans3.6Beta/bin/ide.policy" ""
+ shift
+ [ 3 -gt 0 ]
+ expr -J-Xss1024k : -J\(.*\)
expr: illegal option -- J
usage: expr [-e] expression
+ jopt=
+ jargs= -Dnetbeans.home="/usr/local/NetBeans3.6Beta"
-Djava.security.policy="/usr/local/NetBeans3.6Beta/bin/ide.policy" "" ""
+ shift
+ [ 2 -gt 0 ]
+ expr -J-Xms24m : -J\(.*\)
expr: illegal option -- J
usage: expr [-e] expression
+ jopt=
+ jargs= -Dnetbeans.home="/usr/local/NetBeans3.6Beta"
-Djava.security.policy="/usr/local/NetBeans3.6Beta/bin/ide.policy" ""
"" ""
+ shift
+ [ 1 -gt 0 ]
+ expr -J-Xverify:none : -J\(.*\)
expr: illegal option -- J
usage: expr [-e] expression
+ jopt=
+ jargs= -Dnetbeans.home="/usr/local/NetBeans3.6Beta"
-Djava.security.policy="/usr/local/NetBeans3.6Beta/bin/ide.policy" ""
"" "" ""
+ shift
+ [ 0 -gt 0 ]
+ [ -f /usr/j2se/opt/javahelp/lib/jhall.jar ]
+ parse_args
+ [ 0 -gt 0 ]
+ [ -z /usr/local/jdk1.4.2 ]
+ [ ! -x /usr/local/jdk1.4.2/bin/java ]
+ [ ! -z /home/markus/.netbeans/3.6_Beta ]
+ args=--userdir "/home/markus/.netbeans/3.6_Beta" 
+ ulimit -n 1024
+ nbenvfile=/tmp/nbenv.581
+ rm -f /tmp/nbenv.581
+ [ -f /tmp/nbenv.581 ]
+ [ -r /proc/self/environ ]
+ [ -x /usr/bin/env ]
+ /usr/bin/env
+ nbenvnullsep=false
+ trap rm -f '/tmp/nbenv.581' EXIT
+ restart=yes
+ first_time_starting=yes
+ [ yes ]
+ cp=
+ updatercp=
+ build_cp /usr/local/NetBeans3.6Beta
+ base=/usr/local/NetBeans3.6Beta
+ append_jars_to_cp /usr/local/NetBeans3.6Beta/lib/ext
+ dir=/usr/local/NetBeans3.6Beta/lib/ext
+ echo /usr/local/NetBeans3.6Beta/lib/ext/boot.jar
+ [ /usr/local/NetBeans3.6Beta/lib/ext/boot.jar !=
/usr/local/NetBeans3.6Beta/lib/ext/*.jar ]
+ [ ! -z  ]
+ cp=/usr/local/NetBeans3.6Beta/lib/ext/boot.jar
+ echo /usr/local/NetBeans3.6Beta/lib/ext/*.zip
+ [ /usr/local/NetBeans3.6Beta/lib/ext/*.zip !=
/usr/local/NetBeans3.6Beta/lib/ext/*.zip ]
+ append_jars_to_cp /usr/local/NetBeans3.6Beta/lib/ext/locale
+ dir=/usr/local/NetBeans3.6Beta/lib/ext/locale
+ echo /usr/local/NetBeans3.6Beta/lib/ext/locale/*.jar
+ [ /usr/local/NetBeans3.6Beta/lib/ext/locale/*.jar !=
/usr/local/NetBeans3.6Beta/lib/ext/locale/*.jar ]
+ echo /usr/local/NetBeans3.6Beta/lib/ext/locale/*.zip
+ [ /usr/local/NetBeans3.6Beta/lib/ext/locale/*.zip !=
/usr/local/NetBeans3.6Beta/lib/ext/locale/*.zip ]
+ [ -f /usr/local/NetBeans3.6Beta/lib/updater.jar ]
+ updatercp=/usr/local/NetBeans3.6Beta/lib/updater.jar
+ echo /usr/local/jdk1.4.2/lib/dt.jar
/usr/local/jdk1.4.2/lib/htmlconverter.jar
/usr/local/jdk1.4.2/lib/tools.jar
+ [ /usr/local/jdk1.4.2/lib/dt.jar
/usr/local/jdk1.4.2/lib/htmlconverter.jar
/usr/local/jdk1.4.2/lib/tools.jar != /usr/local/jdk1.4.2/lib/*.jar ]
+ [ ! -z /usr/local/NetBeans3.6Beta/lib/ext/boot.jar ]
+ cp=/usr/local/NetBeans3.6Beta/lib/ext/boot.jar:
+
cp=/usr/local/NetBeans3.6Beta/lib/ext/boot.jar:/usr/local/jdk1.4.2/lib/dt.jar
+ [ ! -z
/usr/local/NetBeans3.6Beta/lib/ext/boot.jar:/usr/local/jdk1.4.2/lib/dt.jar
]
+
cp=/usr/local/NetBeans3.6Beta/lib/ext/boot.jar:/usr/local/jdk1.4.2/lib/dt.jar:
+
cp=/usr/local/NetBeans3.6Beta/lib/ext/boot.jar:/usr/local/jdk1.4.2/lib/dt.jar:/usr/local/jdk1.4.2/lib/htmlconverter.jar
+ [ ! -z
/usr/local/NetBeans3.6Beta/lib/ext/boot.jar:/usr/local/jdk1.4.2/lib/dt.jar:/usr/local/jdk1.4.2/lib/htmlconverter.jar
]
+
cp=/usr/local/NetBeans3.6Beta/lib/ext/boot.jar:/usr/local/jdk1.4.2/lib/dt.jar:/usr/local/jdk1.4.2/lib/htmlconverter.jar:
+
cp=/usr/local/NetBeans3.6Beta/lib/ext/boot.jar:/usr/local/jdk1.4.2/lib/dt.jar:/usr/local/jdk1.4.2/lib/htmlconverter.jar:/usr/local/jdk1.4.2/lib/tools.jar
+ echo /usr/local/jdk1.4.2/lib/*.zip
+ [ /usr/local/jdk1.4.2/lib/*.zip != /usr/local/jdk1.4.2/lib/*.zip ]
+ [ ! -z  ]
+ [ ! -z  ]
+ [ ! -z /usr/local/NetBeans3.6Beta/lib/updater.jar ]
+
updatercp=/usr/local/NetBeans3.6Beta/lib/ext/boot.jar:/usr/local/jdk1.4.2/lib/dt.jar:/usr/local/jdk1.4.2/lib/htmlconverter.jar:/usr/local/jdk1.4.2/lib/tools.jar:/usr/local/NetBeans3.6Beta/lib/updater.jar
+ [ yes ]
+ run_updater=
+ look_for_pre_runs /usr/local/NetBeans3.6Beta
+ base=/usr/local/NetBeans3.6Beta
+ dir=/usr/local/NetBeans3.6Beta/update/download
+ echo /usr/local/NetBeans3.6Beta/update/download/*.nbm
+ [ -f /usr/local/NetBeans3.6Beta/update/download/install_later.xml -a
/usr/local/NetBeans3.6Beta/update/download/*.nbm !=
/usr/local/NetBeans3.6Beta/update/download/*.nbm ]
+ look_for_pre_runs /home/markus/.netbeans/3.6_Beta
+ base=/home/markus/.netbeans/3.6_Beta
+ dir=/home/markus/.netbeans/3.6_Beta/update/download
+ echo /home/markus/.netbeans/3.6_Beta/update/download/*.nbm
+ [ -f
/home/markus/.netbeans/3.6_Beta/update/download/install_later.xml -a
/home/markus/.netbeans/3.6_Beta/update/download/*.nbm !=
/home/markus/.netbeans/3.6_Beta/update/download/*.nbm ]
+ [  ]
+ first_time_starting=
+ eval "/usr/local/jdk1.4.2/bin/java" -Djdk.home="/usr/local/jdk1.4.2"
-classpath
"/usr/local/NetBeans3.6Beta/lib/ext/boot.jar:/usr/local/jdk1.4.2/lib/dt.jar:/usr/local/jdk1.4.2/lib/htmlconverter.jar:/usr/local/jdk1.4.2/lib/tools.jar"
-Dnetbeans.osenv=/tmp/nbenv.581 -Dnetbeans.osenv.nullsep=false
-Dnetbeans.home="/usr/local/NetBeans3.6Beta"
-Djava.security.policy="/usr/local/NetBeans3.6Beta/bin/ide.policy" ""
"" "" "" org.netbeans.Main --userdir "/home/markus/.netbeans/3.6_Beta"
+ /usr/local/jdk1.4.2/bin/java -Djdk.home=/usr/local/jdk1.4.2
-classpath
/usr/local/NetBeans3.6Beta/lib/ext/boot.jar:/usr/local/jdk1.4.2/lib/dt.jar:/usr/local/jdk1.4.2/lib/htmlconverter.jar:/usr/local/jdk1.4.2/lib/tools.jar
-Dnetbeans.osenv=/tmp/nbenv.581 -Dnetbeans.osenv.nullsep=false
-Dnetbeans.home=/usr/local/NetBeans3.6Beta
-Djava.security.policy=/usr/local/NetBeans3.6Beta/bin/ide.policy    
org.netbeans.Main --userdir /home/markus/.netbeans/3.6_Beta
Exception in thread "main" java.lang.NoClassDefFoundError: 
+ exitcode=1
+ run_updater=
+ look_for_post_runs /usr/local/NetBeans3.6Beta
+ base=/usr/local/NetBeans3.6Beta
+ dir=/usr/local/NetBeans3.6Beta/update/download
+ echo /usr/local/NetBeans3.6Beta/update/download/*.nbm
+ [ ! -f /usr/local/NetBeans3.6Beta/update/download/install_later.xml
-a /usr/local/NetBeans3.6Beta/update/download/*.nbm !=
/usr/local/NetBeans3.6Beta/update/download/*.nbm ]
+ look_for_post_runs /home/markus/.netbeans/3.6_Beta
+ base=/home/markus/.netbeans/3.6_Beta
+ dir=/home/markus/.netbeans/3.6_Beta/update/download
+ echo /home/markus/.netbeans/3.6_Beta/update/download/*.nbm
+ [ ! -f
/home/markus/.netbeans/3.6_Beta/update/download/install_later.xml -a
/home/markus/.netbeans/3.6_Beta/update/download/*.nbm !=
/home/markus/.netbeans/3.6_Beta/update/download/*.nbm ]
+ [  ]
+ restart=
+ [  ]
+ exit 1
+ rm -f /tmp/nbenv.581
Comment 4 Jaroslav Tulach 2004-02-11 09:16:51 UTC
Created attachment 13366 [details]
Improved version that should work
Comment 5 malakim 2004-02-11 15:24:10 UTC
I just tested your new script, and I can confirm that it is indeed
working.
Comment 6 Jaroslav Tulach 2004-02-11 16:34:57 UTC
/cvs/core/release/bin/runide.sh,v  <--  runide.sh
new revision: 1.54; previous revision: 1.53
Comment 7 Marian Mirilovic 2004-02-11 19:48:53 UTC
Yarda , thanks :)

Malakim, can you try new dev build and cofirm working version of
runide.sh in Development build , and please verify this issue, 
thanks in advace ;)
Comment 8 malakim 2004-02-11 19:55:19 UTC
Is it on the download page of the Netbeans.org site?
You mean doing a fresh install of the dev version and making sure 
that a working runide.sh is installed, right? ;-)
Comment 9 Marian Mirilovic 2004-02-11 20:08:58 UTC
Right, it will be on download page (today in 3-4 hours or wait until
tomorrow) .....

Don't hurry, I am asking for verification because we haven't FreeBSD
in our site, so we cannot verify the fix :(

Just reminder to verify it by yourself, if I can ask for that ;) 
Thanks...

Comment 10 malakim 2004-02-11 20:17:12 UTC
No problemo! 
I'll do it first thing in the morning.
Always happy to help. :)
Comment 11 malakim 2004-02-12 05:40:20 UTC
Just tested it on my FreeBSD box, and the new runide.sh is working.
Good work, guys!
Comment 12 Marian Mirilovic 2004-02-12 07:15:57 UTC
verified by reporter - thank you very much ;)
Comment 13 _ tboudreau 2004-02-12 16:51:45 UTC
expr -- -J-Xms24m : '-J\(.*\)'

is not legal syntax on Mac OS-X - NetBeans now can't start on OS-X.
Comment 14 Jaroslav Tulach 2004-02-12 16:56:32 UTC
Seems I will have to rollback the change. Before I do that, I'd like
to know how various expressions behave on FreeBSD5.2R (btw. is that
stable release?). Please try to modify 

expr -J-Xms24m : '-J\(.*\)'

to print -Xms24m. Use ", ', \, etc. If you find some format that
succeed  and will work on osx I will use it, otherwise, the script
will be broken on freebsd, I am affraid.
Comment 15 malakim 2004-02-12 17:29:06 UTC
Too bad. Oh, well, guess there aren't that many crazy people doing 
Java work on FreeBSD. :)

FreeBSD 5.2-RELEASE is a 'sort-of stable' release, that is, it is 
not as bleeding edge as a CURRENT system, and not as "stable" as a 
4.X system. It is deemed stable enough for daily use, though not in 
a buisness critical server, for example.

If you want me to, I can post a note to the FreeBSD-Java mailing 
list, asking someone on a 4.X system to try the Dev-build of 
NetBeans.
Comment 16 malakim 2004-02-12 18:07:45 UTC
Just another idea, coludn't you provide tow launcher scripts? Let 
the Mac people have runide.sh and let the new one live as, for 
example, runideBSD.sh?
After all, there are separate launchers for a few other OS's aren't 
there?
Comment 17 _ cliffwd 2004-02-12 19:25:25 UTC
FYI, revision 1.54 made it so that I cannot run runide.sh on my linux
box anymore either.  I get the following:
% runide.sh
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
Exception in thread "main" java.lang.NoClassDefFoundError: 

Apparently, the double dash in `expr -- ...` isn't supported here. 
This is Debian GNU/Linux 3.0.
Comment 18 Jaroslav Tulach 2004-02-13 08:57:05 UTC
Due to issue 40017 I had to revert the patch. 

Also I am closing this as won't fix because the simple way (adding --)
will not work.

As written in previous post: try to modify 

expr -J-Xms24m : '-J\(.*\)'

to print -Xms24m. If you find a way how to do it we can try the fixing
once more. Btw. one of my suggestions would be 

expr match "-J-Xms24m"  '-J\(.*\)'

Another solution is to ask guys from FreeBSD to fix their expr program...
Comment 19 Jaroslav Tulach 2004-02-13 08:58:22 UTC
Jirka, as you are said to be freebsder, can you please check this
issue? Thanks.
Comment 20 malakim 2004-02-13 18:05:22 UTC
I've notified the FreeBSD Java developers about this issue. 
Hopefully they will look into it.
Comment 21 malakim 2004-02-14 11:27:43 UTC
I got hhis reply from Greg Lewis, one of the FreeBSD Java developers:
<QUOTE>
I read the bug, and it doesn't look like it has anything to do with 
the JDKs using different parameters.  It looks like it has 
everything to do with different syntaxes for the expr utility.

Here is the issue (from expr(1)):

Unless FreeBSD 4.x compatibility is enabled, this version of expr 
adheres to the POSIX Utility Syntax Guidelines, which require that a 
leading argument beginning with a minus sign be considered an option 
to the program.  The standard -- syntax may be used to prevent this 
interpretation.

e.g.

> expr -J-Xms24m : '-J\(.*\)'
expr: illegal option -- J
usage: expr [-e] expression

However, note the first part of the quote from the man page!  So, a 
possibly solution is for runide.sh to set the EXPR_COMPAT 
environment variable.  Then things will work, e.g.:

> env EXPR_COMPAT=1 expr -J-Xms24m : '-J\(.*\)'
-Xms24m

So, I would suggest adding these two lines to the script:

EXPR_COMPAT=1
export EXPR_COMPAT

Then it will (hopefully) work on FreeBSD.

I will note strongly that its Linux and OSX which are broken in this 
respect though.  FreeBSD is POSIX compliant, they are not.
</QUOTE>

And this from Marc van Kempen:
<QUOTE>
Another possible solution, that also works on Mac OSX and Linux is:

expr X-J-Xms24m : 'X-J\(.*\)'
</QUOTE>

Could you guys try this approach? :)
Comment 22 Jesse Glick 2004-02-15 21:14:46 UTC
Should I think be reconsidered based on info from last comment.
Comment 23 Jaroslav Tulach 2004-02-16 09:00:44 UTC
And I wondered why shell programers always use "X-$VAR" and not just
"$VAR"! I'll fix it.
Comment 24 Jaroslav Tulach 2004-02-16 09:38:39 UTC
Created attachment 13444 [details]
Version of the launcher using prefix
Comment 25 Jaroslav Tulach 2004-02-16 09:40:41 UTC
Thanks for a lesson in shell programming. I am convinced that the
variant with X- prefix is the right one. It has been commited as
version 1.56. But in order not to break anything I've just attached
the new version of the launcher script, so we can test the behaviour
sooner than the daily build is produced.
Comment 26 Martin Grebac 2004-02-16 09:52:43 UTC
I tried on JDS - works OK.
Comment 27 malakim 2004-02-16 14:04:56 UTC
Works great here on FreeBSD 5.2R. Hope the Linux and MacOS X crowd are
happy too. ;-)
Comment 28 Lukas Hasik 2004-02-23 15:49:28 UTC
see last comment -> verified