Teething Trouble getting RetRexx to run on OSX.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Teething Trouble getting RetRexx to run on OSX.

FreeFall
Hi,

Teething Trouble getting RetRexx to run on OSX.

I'm trying to use NetRexx on a mac running OSX 10.5.8 which comes with Java 1.5.0_16 ready installed (though apple puts java files in nonstandard places).   

While following Mike's User Guide, I tried the following commands to run hello world:

TRY
java -classpath aaMain/Programming/NetRexx/NetRexxSystem/lib/NetRexxC.jar:
PowerBook_G4/Applications/Utilities/Java/JavaTools.jar 
COM.ibm.netrexx.process.NetRexxC 
aaMain/Programming/NetRexx/TestPrograms/hello.nrx

and
java -classpath aaMain/Programming/NetRexx/NetRexxSystem/lib/NetRexxC.jar COM.ibm.netrexx.process.NetRexxC 
aaMain/Programming/NetRexx/TestPrograms/hello.nrx

and
java -classpath aaMain/Programming/NetRexx/NetRexxSystem/lib/NetRexxC.jar:
PowerBook_G4/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries 
COM.ibm.netrexx.process.NetRexxC 
aaMain/Programming/NetRexx/TestPrograms/hello.nrx

and
java -classpath aaMain/Programming/NetRexx/NetRexxSystem/lib/NetRexxC.jar:PowerBook_G4/Library/Java COM.ibm.netrexx.process.NetRexxC
 aaMain/Programming/NetRexx/TestPrograms/hello.nrx

They all give the Result
NetRexx portable processor, version 2.05
Copyright (c) IBM Corporation, 2005.  All rights reserved.
Program hello.nrx
   +++ Error: The class 'java.lang.Object' cannot be found
Compilation of 'hello.nrx' failed [one error]

As you can see, I've tried a few places to try and put java.lang.Object (I think this is the top level object) on the classpath.   However, I know nothing of java or unix, so I am in the dark.   I cant find a file called Object on the mac, so I guess it must reside in a .jar file.

I'm sure the solution is really trivial, I just need someone in the know to provide it.   Thanks.

Regards,

Connor (former Hursley programmer). 

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Teething Trouble getting RetRexx to run on OSX.

Bruce Skelly
Having just done this, I guess it is my turn to pass on the knowledge.

My goal was to get NetRexx running in the most "Apple" like way.

I put both NetRexxC.jar and NetRexxR.jar in /Library/Java/Extensions.  You could also use $HOME/Library/Java/Extensions

I then modified the NetRexxC.sh script to the following:



A CLASSPATH is only needed during the compile process.  Your compiled Netrexx program can then be run by typing 'java  my_program'


Bruce
On Feb 19, 2010, at 7:45 AM, Connor Birch wrote:

Hi,

Teething Trouble getting RetRexx to run on OSX.

I'm trying to use NetRexx on a mac running OSX 10.5.8 which comes with Java 1.5.0_16 ready installed (though apple puts java files in nonstandard places).   

While following Mike's User Guide, I tried the following commands to run hello world:

TRY
java -classpath aaMain/Programming/NetRexx/NetRexxSystem/lib/NetRexxC.jar:
PowerBook_G4/Applications/Utilities/Java/JavaTools.jar 
COM.ibm.netrexx.process.NetRexxC 
aaMain/Programming/NetRexx/TestPrograms/hello.nrx

and
java -classpath aaMain/Programming/NetRexx/NetRexxSystem/lib/NetRexxC.jar COM.ibm.netrexx.process.NetRexxC 
aaMain/Programming/NetRexx/TestPrograms/hello.nrx

and
java -classpath aaMain/Programming/NetRexx/NetRexxSystem/lib/NetRexxC.jar:
PowerBook_G4/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries 
COM.ibm.netrexx.process.NetRexxC 
aaMain/Programming/NetRexx/TestPrograms/hello.nrx

and
java -classpath aaMain/Programming/NetRexx/NetRexxSystem/lib/NetRexxC.jar:PowerBook_G4/Library/Java COM.ibm.netrexx.process.NetRexxC
 aaMain/Programming/NetRexx/TestPrograms/hello.nrx

They all give the Result
NetRexx portable processor, version 2.05
Copyright (c) IBM Corporation, 2005.  All rights reserved.
Program hello.nrx
   +++ Error: The class 'java.lang.Object' cannot be found
Compilation of 'hello.nrx' failed [one error]

As you can see, I've tried a few places to try and put java.lang.Object (I think this is the top level object) on the classpath.   However, I know nothing of java or unix, so I am in the dark.   I cant find a file called Object on the mac, so I guess it must reside in a .jar file.

I'm sure the solution is really trivial, I just need someone in the know to provide it.   Thanks.

Regards,

Connor (former Hursley programmer). 
_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________
Ibm-netrexx mailing list
[hidden email]


NetRexxC.sh (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Teething Trouble getting RetRexx to run on OSX.

alansam
Hi,

On 19 February 2010 08:14, Bruce Skelly <[hidden email]> wrote:
Having just done this, I guess it is my turn to pass on the knowledge.

My goal was to get NetRexx running in the most "Apple" like way.

I put both NetRexxC.jar and NetRexxR.jar in /Library/Java/Extensions.  You could also use $HOME/Library/Java/Extensions

I then modified the NetRexxC.sh script to the following:



A CLASSPATH is only needed during the compile process.  Your compiled Netrexx program can then be run by typing 'java  my_program'


Bruce
On Feb 19, 2010, at 7:45 AM, Connor Birch wrote:

Hi,

Teething Trouble getting RetRexx to run on OSX.


As a new convert to Mac I've done this too on my shiny new MacBook (OS X 10.6.2).  No being as daring as Bruce I put the NetRexxC.jar in
~/Library/Java/Extensions then modified the NetRexxC.sh as follows:


#!/bin/sh
#  BASH script to translate and compile a NetRexx program, and
#  optionally run the resulting class file
# -----------------------------------------------------------------
#  use as:  NetRexxC hello
#
#     which will use the NetRexx translator to translate the
#     source file hello.nrx to hello.java
#     then will use javac to compile hello.java
#
#  OPTIONS keywords may be added (with a -) before or after
#  the file specification, along with the extra flags known
#  to NetRexxC (such as -keep).   For example:
#
#     NetRexxC -keep -format -comments hello
#
#  Invoke with no parameters for a full list of flags.
#
#  To run the class after compilation, specify -run as the
#  first word of the command arguments and the name of the
#  class as the second word.  Note that the case of the
#  letters must be exactly correct for this to work, and do not
#  specify the .nrx extension.  For example:
#
#     NetRexxC -run hello
#
#  For a more flexible script for this, see NetRexxC.cmd
#  Reminder: to make this executable: chmod 751 NetRexxC.sh
# -----------------------------------------------------------------
#  2000.08.20 -- initial version derived from NetRexxC.bat
#  2010.02.17 -- Fixup for Mac OS X - add classes.jar & NetRexxD.jar to classpath

# --- 2010.02.17 -- Update/Add CLASSPATH
cpMunge () {
    if ! echo $CLASSPATH | egrep -q "(^|:)$1($|:)"
    then
        if [ "$2" = "after" ]
        then
            CLASSPATH="$CLASSPATH:$1"
        else
            CLASSPATH="$1:$CLASSPATH"
        fi
    fi
}

XOSNAME=`uname -s`

case $XOSNAME in
    Darwin)
        if [ -z "$JAVA_HOME" -a -x /usr/libexec/java_home ]
        then
            JAVA_HOME=`/usr/libexec/java_home`

            export JAVA_HOME
        fi

        if [ "$JAVA_HOME" ]
        then
            # The NetRexx compiler needs to search it's own JAR file and
            # the Java runtime JAR to successfully compile a program.

            # It is assumed that the NetRexx compiler's JAR is installed in
            # the user's Java extensions directory.  If this is not the case
            # then the following manifest will need to be modified to properly
            # reflect the environment.
            XNETREXXJAR="$HOME/Library/Java/Extensions/NetRexxC.jar"

            # The current location of the Java runtime on Mac OS X
            XCLASSESJAR="$JAVA_HOME/bundle/Classes/classes.jar"

            if [ -z "$CLASSPATH" ]
            then
                CLASSPATH="$XNETREXXJAR:$XCLASSESJAR"
            else
                cpMunge "$XCLASSESJAR"
                cpMunge "$XNETREXXJAR"
            fi

            export CLASSPATH
        else
            echo "$0 can't establish a viable JAVA_HOME.  Check your environment."
        fi
        ;;

    *)
        true # nop
        ;;
esac
# --- 2010.02.17 -- Update/Add CLASSPATH

if test $# -eq 0; then
  echo 'Usage:' $0 '[-run] [other options] filename'
  echo ' '
  # Drop through to display flags list
fi

if test "$1"  = "-run"; then
  shift 1
  netrexx_run=yes
fi

java -ms4M $NETREXX_JAVA COM.ibm.netrexx.process.NetRexxC $*
if test $? -eq 0; then
  if test "$netrexx_run" = "yes"; then
    echo "Running $1..."
    java $1
  fi
fi



From what I understand an important clue to finding the Java run-time classes is the /usr/libexec/java_home utility which gives you the location of your Java home directory and as has been mentioned in other posts you need to locate that to find the Java run-time JAR file (classes.jar in my environment but I've also seen rt.jar in other Java implementations. - Trust but verify...)

Regards,
Alan.

--
Needs more cow-bell!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Alan

--
Needs more cowbell.