Click to See Complete Forum and Search --> : Java Help Please!!!


Dr1ft3r
12-27-2002, 09:29 AM
HOW THE %#&$*_%&$&#!_$ DO YOU COMPILE JAVA!!! I know I need a compiler. I have the book "Java 2: The Complete Reference" and in there it says all you have to do is make an Example.java file(which they give the code for) and then go to the DOS command prompt and type in "javac Example.java" this is what it looked like in the book:

C:\>javac Example.java

and then it says to run the program, type this:

C:\>java Example

and then it says the output of the program will be:

This is a simple Java program

I cant even get past step 1!!! When I go to do the first step (javac Example.java) it says:

'javac' is not recognized as an internal or external command, operable program or batch file.

The book says that these steps are taken with the Java 2 SDK (Software Development Kit) and i downloaded it and tried it and messed around with it for a while but i just couldnt find anything that would compile java so i deleted it ..... please i need to know where to get a good compiler or how to compile java easily ..... thanks in advance

khalidali63
12-27-2002, 09:51 AM
First of all you did not mention that what are the errors you ger? very crucial to determine a solution.
Second it seems that if your machine is not properly set to run Java programs you may have some problems.
By this I meat that
1.You must have installed Java Runtime Environment on your machine.
for this go to
http://java.sun.com/j2se/1.4.1/download.html
the link above and download the second item from the list.
Remember you must download and install items from the column title "SDK".
2.you'd need to set your environment variables,
By that I mean that your computers OS will have to know that what will it do when you write a "javac test.java" and "java test"
Environment variables do just that.
3. Keeping that in mind go to the following link
http://java.sun.com/docs/books/tutorial/uiswing/start/_envVariables.htm

there is a tone of information out there just do a google search with this string "set environment variables for java"

It could be frustration some times.

Let me know if you need further help
k_ali@shaw.ca

blufive
12-27-2002, 01:44 PM
To clarify a couple of points:

You need the Java SDK (software development kit). The Java Runtime Environment is only the software libraries needed to run compiled java (the SDK includes a JRE).

Once you've got that, and got it installed, you need to make sure that javac.exe is on your execution path, which is controlled by an environment variable named PATH. javac.exe normally lives in [SDK install directory]\bin.

khalidali63
12-27-2002, 01:53 PM
By the way blufive, did u event read my post...just a thought....cus if u did ,then u did not have to clarify...:-)

cheers

Khalid

blufive
12-27-2002, 04:22 PM
khalidali63:
Yes, I did read your post, and it needed clarifying. So I did.

khalidali63
12-27-2002, 08:54 PM
Originally posted by blufive
khalidali63:
Yes, I did read your post, and it needed clarifying. So I did. .
:-)
Lets see hunmm.
From my first post

the link above and download the second item from the list.
Remember you must download and install items from the column title "SDK".

Blufive responds .

To clarify a couple of points:

You need the Java SDK (software development kit).

Geee thats different..take alook at the other point.

2.you'd need to set your environment variables,
By that I mean that your computers OS will have to know that what will it do when you write a "javac test.java" and "java test"
Environment variables do just that.
3. Keeping that in mind go to the following link
http://java.sun.com/docs/books/tuto...nvVariables.htm

there is a tone of information out there just do a google search with this string "set environment variables for java"

blufive responds

Once you've got that, and got it installed, you need to make sure that javac.exe is on your execution path, which is controlled by an environment variable named PATH. javac.exe normally lives in [SDK install directory]\bin.

Just think about it it.( i seriously doubt that you can though)

Man I am impressed....

Khalid

Zach Elfers
12-27-2002, 09:39 PM
I have the Sun Developer Kit that uses the javac command. If you can't get passed step 1, it sounds like you don't have the compiler installed on your system. I think you can download it for free at http://java.sun.com . If you DO have the compiler, then maybe the computer can't find that file that you want javaced. Try typing the full path.

blufive
12-28-2002, 03:28 AM
Just think about it it.( i seriously doubt that you can though)
Man I am impressed.... Well, if you're going to be rude...

Your first post had poor grammar and spelling, left out relevant information (the name of the environment variable to be altered) and included information ("you need a Java Runtime Environment") that could mislead the reader. So I attempted to clarify those points.

Now, all this arguing is getting seriously off-topic, and not helping Dr1ft3r one jot. So why don't we wait and see if s/he has any more questions, and just try to answer them, rather than hurling insults at one another?

khalidali63
12-28-2002, 11:41 AM
I agree....I appologies if u think I was trying to be rude..
my appology...

I was just clearing it a bit more..:-)

Khalid