Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 497
  • Last Modified:

Java Beans NMake file

I'm following the Java Tutorial, section: Writing a Simple Bean
 
In this the following is included:


# nmake file
CLASSFILES= simplebean.class
JARFILE= simplebean.jar
all: $(JARFILE)
# Create a JAR file with a suitable manifest.
$(JARFILE): $(CLASSFILES) $(DATAFILES)
        jar cfm $(JARFILE) <<manifest.tmp *.class
Name: SimpleBean.class
Java-Bean: True
.SUFFIXES: .java .class
{sunw\demo\simple}.java{sunw\demo\simple}.class :
        set CLASSPATH=.
        javac $<
clean:
        -del sunw\demo\simple\*.class
        -del $(JARFILE)


How is this nmake file included into your bean - or otherwise used ?
I have problems loading a serialised bean into the bean box and I think it's because I didn't to anything with the nmake file??
Tom
0
tcompex3
Asked:
tcompex3
1 Solution
 
Jim CakalicSenior Developer/ArchitectCommented:
An nmake file defines rules for building a software component. This file is used by the nmake utility. The rules in the file indicate the steps that need to be taken to transform one kind of file into another kind of file. For instance, what needs to be done to transform a file with extension '.java' into a file with extension '.class'. The nmake file can also document dependencies and define substitution macros.

These lines are macros:
    CLASSFILES= simplebean.class
    JARFILE= simplebean.jar

When nmake processes this rule file, everywhere in the file that $(CLASSFILES) is encountered, 'simplebean.class' will be substituted. Ditto for JARFILE.

The following lines define a dependency and a transformation rule:

    $(JARFILE): $(CLASSFILES) $(DATAFILES)
        jar cfm $(JARFILE) <<manifest.tmp *.class
Name: SimpleBean.class
Java-Bean: True

The first line says that $(JARFILE), actually 'simplebean.jar', is dependent on the expanded value of $(CLASSFILES) and $(DATAFILES). When nmake runs, if it determines that any of the files in the expanded values of one of these macros is newer than the expanded value of JARFILE, then it will execute the commands specified by this rule. That means running the jar command as described.

These lines are another transformation rule that describe how to convert java files that follow a specific naming convention to corresponding class files.
    {sunw\demo\simple}.java{sunw\demo\simple}.class :
        set CLASSPATH=.
        javac $<

From this description you can see that the nmake file isn't included in your bean but describes how to build the source for your bean into a machine-executable target. In this case, a jar file with an appropriate bean manifest.

Of course, if you don't have the nmake utility, this thing doesn't do you much good, does it?

If you would like more documentation on nmake, look here:
    http://www.bell-labs.com/project/nmake/tutorial/

If you are looking for nmake for Windows, this page indicates that a version is available in Microsoft's SDK for Java:
    http://www.microsoft.com/java/sdk/40/start.htm?http://www.microsoft.com/Java/sdk/40/pg/tools_cmpdbg.htm

You can download Microsoft's SKD here:
    http://www.microsoft.com/java/default.htm?MSCOMTB=ICP_Technologies%20for%20Java%20Home

Since nmake is not a Java-specific technology, I am guessing that you should be able to use it independently of the MS SDK for Java. I have no experience with that however.

Best regards,
Jim Cakalic
0
 
tcompex3Author Commented:
Comment accepted as answer
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now