kimble home

NeXTStep/Java Introduction

This page is a collection of information about Java on the NeXTStep platform.

NeXT Java Mailing List

Bill Bumgarner has set up a mailing list for collaboration on NeXT java projects, in particular the port of Sun's JVM

NeXT Interface Builder Palette

Ralf Suckow has developed an Interface Builder palette for Java called aCupOfCoffee. This enables developers to generate Java code directly from the Interface Builder using familiar 'drag and drop' techniques rather than messing around with all those nasty layout managers. The latest 'pro' version adds the target:action paradigm.

It's availabe as a quadruple-fat binary via anonymous ftp from the german peanuts archive at: ftp://ftp.informatik.uni-muenchen.de/pub/comp/platforms/next/Developer/ resources/palettes
and in the U.S.A. from ftp://next-ftp.peak.org/pub/next/submissions/aCupOfCoffee.1.0.NIHS.tar. gz

NeXTStep/Sun JDK 1.0.2

The effort to port Sun's JDK to the NeXT platform is ongoing. The project began late in '95 with an intial port made by Dave Griffiths of the alpha release. This did not include the AWT (Abstract Window Toolkit) but got as far as being able to self-compile. The port built entirely as a Project Builder project, largely because Sun had done some horrible proprietory make things. The beta release saw Sun move to the standard gnu make (gmake) and Bill Bumgarner migrated Dave's work to this release.

A number of people have been working on Java recently. Dave Griffiths has certain parts of the AWT working and Domagoj Cosic has integrated these changes and made a release of 1.0.2,.

Note that this is just a set of patches, you will first have to obtain a source license and source from Sun and then put in some effort to patch and build these sources. The AWT is still incomplete.

NeXTStep Native Java Compiler

I've recently built a Native Java compiler using the j2c tranlator. This is based on Sun's 1.0.2 class library and enables users to build classes quickly on the NeXT platform. Of course you will still have to something like Navigator 2.0 to test the classes.

Source and binaries are provided for javac and a binary for the j2c translator. The binaries are for Motorola only and you will need a recent version of gcc to build it, for example 2.7.2.

The release is available from ftp://ftp.demon.co.uk/pub/NeXT.

Java to C translator

What is j2c

J2c is a java class to 'C' translator. It currently supports release 1.0.1 of the JDK and enables all non-AWT and Network applications to be turned into native 'C' code.

More details and the source code are available from the Web site: http://www.webcity.co.jp/info/andoh/java/j2c.html

j2c and NeXTStep

I've ported j2c to the NeXTStep 3.x platform. Not too much work involved, here are the details:
  1. The normal NeXTStep 3.2 compiler:
    NeXT Computer, Inc. version cc-216.obj~13, gcc version 2.2.2

    Can't be used. It doesn't understand long long properly and can't compile the generated code for other reasons. You have to download gcc 2.7.2 and build it. The NeXT platform is well supported.

    The NeXTStep 3.3 compiler may work.

  2. The -posix flag is needed. Add this to the DEBUG field in the various j2c Makefiles

    You will also need to add it to the line:

        $(CC) -posix -O2 -o cpl cpl.c read.c xmalloc.c version.c
    
    In the file cb/makefile.

  3. In cb/makefile use the standard awk, not nawk .

  4. In cb/makefile add the object: strdup.o and in the same directory add the file strdup.c:
    	char *strdup (char *s)
    	{
    	  int l = strlen (s);
    	  char *p = xmalloc(l + 1);
    	  return memcpy (p, s, l + 1);
    	}
    
  5. The NeXT ranlib can't cope with empty object files, add the line:
    	#if defined(NeXT)
    	missing(){};
    	#endif /* NeXT */
    
    to missing.c in the rt/src directory.

  6. Add this line to the file rt/src/property.h
    	#elif defined (NeXT)
    	#define PROPERTY_OS_NAME "NeXT"
    	#if defined (m68k)
    
  7. In the file io.c add the line:
    	#if defined(NeXT)
    	#include 
    	#endif /* NeXT */
    
  8. In the file include/common.h add the line:
    	#if ! defined(NeXT)
    	#define alloca(x)      malloc(x)
    	#define alloca_free(x) free(x)
    	#else
    	#define alloca_free(x)
    	#endif
    

Building using javac from JDK release 1.0.2

This is a snip, there is one new interface java/lang/ClassLoader.class, three new routines are defined for which there are no stubs. These are:
	_Java_java_lang_ClassLoader_defineClass0_stub
	_Java_java_lang_ClassLoader_resolveClass0_stub
	_Java_java_lang_ClassLoader_findSystemClass0_stub
I havn't checked the source, but presumably these are special versions introduced for security fixes? Is class0, Object?

Anyway simply copy an older 1.0.1. or 1.0.0 ClassLoader.class in its place (make sure you save the 1.0.2 version) and all will be well.

Some Notes

Build time for javac is 37 minutes including translation.

The above changes are available in the javac release mentioned earlier: ftp://ftp.demon.co.uk/pub/NeXT.

David Harvey-George, email: david@threewiz.demon.co.uk
31st May, 1996


kimble home
©1996 Kimble Consultancy Services Ltd.
Last Updated: 7th June 1996
http://www.kimble.co.uk/nextstep/nextjava.html