Java From Unix

How to Connect to ECS UNIX:

1. Locate the hyperterminal within your computer

Recommend you to use Start Find File and Folder

Try to locate the file hypertrm.exe

2. Fill out the information:

name: csun

phone: 6776700

select the proper modem

click dial

3. you will receive the message with a prompt.

CSUN Net Acct#:

Password:

Successful login will receive the full page message

Welcome to the Remote Access Facility

at

California State University, Northridge

Use of CSUN computing facilities is reserved

for authorized University users only.

For additional information or technical support call (818) 677-3966.

To report problems or failures with this service call (818) 677-1400.

------Select resource by number: ------

1. Huey (HP-UX host)

2. Louie (HP-UX host)

3. GEAC (Library-Login as 'opac')

Enter Selection (1-3,q)

Wed Nov 17 13:52:16 PST 1999

hp9k2 21: telnet 130.166.2.13

C o l l e g e o f E n g i n e e r i n g

a n d

C o m p u t e r S c i e n c e

Access restricted to authorized users only!

[HP Release B.11.00] (jem)

login: spham

Password:

Last successful login for spham: Mon Jul 26 12:39:28 PST8PDT 1999

Last unsuccessful login for spham: NEVER

Please wait...checking for disk quotas

You have mail.

$

If you are at school, you don’t have to go through all the steps because the school computers are in a networks.

  1. Go to Taskbar, click Start  Run,
  2. Enter in the box: telnet 130.166.2.13.

Then you will continue from the beginning of this page.

If your computer at home is on an ethernet such as Netzero, AOL, or a like. You need to do the following steps:

  1. Go to Taskbar, click Start  Run,
  2. Enter in the box: telnet 130.166.1.7

This will connect to CSUN after you enter your CSUN account and password.

  1. Then you type: telnet 130.166.2.13.

After that you will be asked to enter ECS account and password as at the beginning of this page.

Some Basic Unix Commands

  1. To list the directory:ls

For example, you will see my directory as follows:

$ ls

homes index.html public_html

dead.letter

$

  1. To list the directory in a long form:ls -l

For example, you will see my directory as follows:

$ ls -l

total 56

-rw------1 spham fac 344 Nov 13 15:05 dead.letter

drwxrwxrwx 2 spham fac 4096 Nov 17 13:17 homes

-rw-rw-rw- 1 spham fac 45 Nov 13 15:05 index.html

drwxr-xr-x 7 spham fac 4096 Nov 13 15:05 public_html

3. To create a new directorymkdir labs

Then use ls -l to see this new sub-directory entry

$ mkdir labs

$ ls -l

total 56

-rw------1 spham fac 344 Nov 13 15:05 dead.letter

drwxrwxrwx 2 spham fac 4096 Nov 17 13:17 homes

-rw-rw-rw- 1 spham fac 45 Nov 13 15:05 index.html

drwx------2 spham fac 96 Nov 17 23:25 labs

drwxr-xr-x 7 spham fac 4096 Nov 13 15:05 public_html

$

4. To enter a sub-directory:cd labs//cd means change directory

5. To ask the current directorypwd//pwd means print working directory

$ cd labs

$ pwd

/home/users1/fac/sonpham/labs

$

List again to see the files and sub-directory of the current directory:ls -l

$ pwd

/home/users1/fac/sonpham/labs

$ ls -l

total 0

$

Edit, Compile and Execute a Java Program

6. To create a new file using pico:pico test.java

copy from net the foloowing program and paste it into pico

import java.io.*;

class Test

{

public static void main(String[] args) throws IOException

{

System.out.println(“This is a test.”);

System.out.println(“This is an output.”);

}

}

Type control-O to save the file

Type control-X to exit pico

Type to see the file entry: ls -l

$ ls -l

total 8

-rw------1 spham fac 392 Nov 17 23:37 test.java

$

7. To compile the file:javac test.java

Only $ is responded. That means that compilation is successful--no errors.

8. To run the object codejava <className>

$ javac test.java

$ java test

Can't find class test

$ ls -l

total 16

-rw------1 spham fac 534 Nov 17 23:47 Test.class

-rw------1 spham fac 222 Nov 17 23:46 test.java

$ java Test

This is a test.

This is an output.

$

9. To exit Unix:exit

$ exit

logout

Connection closed by foreign host.

Spham (Connect to UNIX)Page 110/30/2018