Lecture 1

ContentsIndexPrevNext

Lecture Topic:

Setting up the Java Environment in UNIX.

 

  1. You must be on a Sparc Station. CSE will not do. Permission will be denied if you try to run Java on CSE.
  2. You may like to telnet to any sparc 5, for example, vampire;
  3. set your path to the java directory in my home(place the following into your login-file):
    setenv PATH ${PATH}:/home/bunny/faculty/lyon/java/bin
    setenv JAVAHOME /home/bunny/faculty/lyon/java/bin
  4. then type:
    rehash
    This will enable you to type:
  5. which java
    and this should output the path of the java.
  6. For example:
  7. cat >>.login
  8. ${PATH}:/home/bunny/faculty/lyon/java/bin
    setenv JAVAHOME /home/bunny/faculty/lyon/java/bin
    ^d
    source .login
    rehash
    which java

  9. To compile:

UNIX:

    javac HelloWorldApp.java
 

DOS shell (Windows 95/NT):

    javac HelloWorldApp.java

 



Interpreting

UNIX:

java HelloWorldApp
 

DOS shell (Windows 95/NT):

java HelloWorldApp
 

Note: The argument to the Java interpreter is the name of the class, not the name of a file.


Printing directly from UNIX:


Into your .cshrc files, please place the following commands:

alias spps 'lpr -P$PRINTER -s' 
alias printer 'echo $PRINTER'
alias printer1 'setenv PRINTER hpps;echo hpps'
alias printer2 'setenv PRINTER lyon_gray; echo lyon_gray'
alias printer3 'setenv PRINTER dupascii; echo dupascii'
alias printer4 'setenv PRINTER dupps; echo dupps'
alias printers echo printers I know: hpps, lyon_gray, dupascii dupps

alias cancel 'lprm -P$PRINTER job '

alias q 'lpq -P$PRINTER'

 

Into your bin directory place and executible shell script into a file called sp:

 

#! /bin/csh -f
#
# by doug lyon 10/6/93
#
# Usage: sp <files>
 
if ($#argv == 0) then           # arguments?
        echo "Usage: $0 files"
        exit 1
endif
 
foreach file ($argv[*])         # expand argument word list
        echo spooling $file to $PRINTER
        xa2ps $file | lpr -P$PRINTER -s
end

Chmod to +x on sp, then rehash....

This should enable you to print ascii files to any printer... For printing postscript files, use the command: spps 'lpr -P$PRINTER -s '


To print sun snapshots from the sun


, use openwindows to save a screen shot as sun raster or any format file. Then use:

anytopnm - to convert a Sun raster file into a portable pixmap format...then use:

pnmtops - to convert a portable pixmap into color Encapsulated file to PostScript....then use:

spps (see above) to print the postscript to the printer of your choice.

For example, you may set a pipe alias in your .cshrc file so that a single command will print snap-shot...like this:

put the following into sp_shot:


#! /bin/csh -f

#

# by doug lyon 4/8/97

#

# Usage: sp <files>

 

if ($#argv == 0) then # arguments?

echo "Usage: $0 raster_files_in_any_format"

exit 1

endif

 

foreach file ($argv[*]) # expand argument word list

echo spooling $file to $PRINTER

anytopnm $file | pnmtops >$file.ps

lpr -P$PRINTER -s $file.ps

echo " please remember to delete $file.ps later"

end

 

 


Then type:

chmod +x sp_shot
rehash

 

A sample sp_shot is located in

/home/bunny/lyon/bin/sp_shot

 

 

What is Java?


About Java

Understanding Java

Java Objects



Java Basic



Sample Quiz

1. Applets are:
     a. little apples
     b. little applications
     c. often run from a web page
     d. stand-alone applications



homeContentsIndexPrevNext

UBLOGOLast Update: 9/07/96
Copyright © 1996 - Douglas Lyon
Lyon@cse.bridgeport.edu