INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Starting out with Java

Problems getting basic Java programs to compile and run by ackka
Posted: 19 Nov 00 (Edited 29 Apr 05)

Problems Compiling Java Programs, Applets and Applications using Sun Microsystems JDK1.1 Specific for Windows 9x systems

In tek-tips i have seen a large number of problems with simply trying to compile java programs.  I think this is simply because alot of people do not understand basic dos commands which the JDK is written in.

Starting from the Installation

Download the JDK1.3 from java.sun.com
Go through the process of installing the JDK
    It will install defalty to c:\jdk1.3
In Windows Explorer or Dos go to the c:\
Find c:\autoexec.bat
In windows, right click and left click on "edit"
In DOS, type edit c:\autoexec.bat

Find the line of text that says something like this
SET PATH = etc...

type at the end of this line ";c:\jdk1.3\bin" -
MUST LEAVE END OF LINE BLANK OR YOU MAY HAVE PROBLEMS

This basically adds all the executables in the c:\jdk1.3\bin to your windows or dos paths

Restart your computer-

To Compile a Program

make a simple java program - using a text editor such as notepad

ex...

class Test
{
public static void main( String args[] )
    {
    System.out.println("Java is a very neat language");
    }    
}

To get this program to compile correctely do.....
File ->Save As->

Your .java file has to be saved with the same name as your class
In the previous example the class was named Test, so when you type in the filename in notepad
you must save as  Test.java  ->>>  To save correctely in notepad you must put quotes "" around the file name.  This tells windows to save exactely as a .java file extension not the .txt you will get defaulty.

So where it says
File Name:    type in exactly, with quotes--->>> "Test.java"

Then save.........

Next load DOS by typeing in Command at the run prompt
go to the directory where your file is stored

type
javac Test.java
    if this goes okay and no error messages type
java Test

And on the screen should appear

Java is a very neat language

*******************************************
Here is how to do this in Windows 2000, same concept, Microsoft just changed the GUI a bit.
*******************************************
Hi i received your email about the Java FAQ i wrote, in Windows 2000 go to

the desktop->right click on "My Computer"-> go down to Properties

A Dialog Box called "System Properties" should appear, click on the

"Advanced" tab.  Click on the button that says "Environment Variables".
Under "System Variables" if you scroll down you should see an item called

"Path", highlight it and click the "Edit" button.  Then add the Java path to

that line.
ex.
E:\Perl\bin\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
;c:\jdk1.3\bin  

This is what my path looks like, between each directory, you must place a ;  

But make sure to leave the end of the path open.

*******************************************
*******************************************
You can also do this from the MS-DOS command line, except you will have to redo it each time you open a command prompt.

set path=%path%;c:\jdk1.3\bin
*******************************************
*******************************************


Well good luck , java is an excellent programming language, you can create some really neat things.....  if you have more questions my email is thomas.moses@gmail.com

later

tom

Back to Java FAQ Index
Back to Java Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close