 |
| Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 23rd, 2006, 01:11 PM
|
|
Registered User
|
|
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
JDK, newbie questions =D
I realize this question has been asked probably ten thousand times, and when I did a search, my question was partially answered. So here goes nothing:
I have a Java 2 book by Herbert Schlidt. It says that I should download the JDK (done) from sun microsystem's website. Now, I just found out during my search that the JDK is not a windowed application, which I just realized is also written in the book, but is at the very bottom. Now, I am in the command prompt, and have tried to write the program that is in the book as the first sample. I then get the standard error command something like ....is not a recognizable internal/external command.....I then tried execute:javac.exe, that also didn't work. However java.exe (without the execute: in front of it) came up with a whole bunch of writing that basically filled the compiler. Does anyone know how I can get the command prompt to use JDK source rather than Dos source?
I'm very lost and any help is greatly appreciated, i have done a very little bit of programming experience in liberty basic which is very similar to qbasic as I'm told.
He was twitching because he's got my axe embedded in his nervous system!- Gimli;Lord of the Rings,The Two Towers
|
|

February 24th, 2006, 05:38 AM
|
|
Authorized User
|
|
Join Date: Jan 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sound like your PATH is not pointing to your JDK. One way to find out if your PATH environment variable is set to point to your JDK is type the following at the DOS prompt:
echo %PATH%
If the result showed that your PATH is not set to point to your JDK, then you would need to set it by the following:
set PATH=%PATH%;<YourJDKPath>\bin
where <YourJDKPath> is the path of where you installed your JDK. For instance, if you have installed your JDK at C:\jdk1.5_06, then it should be:
set PATH=%PATH%;C:\jdk1.5_06\bin
|
|

February 24th, 2006, 11:12 AM
|
|
Registered User
|
|
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok, thanks, I think I understand. Would this be the PATH? I did a search on my computer because I'm not positive what I saved it under and it came up with like 10 files, most of them are just folders, this one actually had what looked like the JDK icon on it, JDK-1_0_06-windows-i586-p? Also, after I have set the path does dos just follow java code? or do I have to execute a program?
He was twitching because he's got my axe embedded in his nervous system!- Gimli, Two Towers
|
|

February 24th, 2006, 09:13 PM
|
|
Authorized User
|
|
Join Date: Jan 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You need to install the JDK that you had downloaded by running the .exe file. To run it just double click on the file.
After you have installed your JDK, you would need to set the PATH environment variable to point to the bin directory of the JDK.
For instance, let's say you had installed the JDK under C:\jdk1.5_6 directory. You would need to set do the following to set up your environment:
set JAVA_HOME=C:\jdk1.5_6
set PATH=%PATH%;%JAVA_HOME%\bin
|
|

February 27th, 2006, 05:59 PM
|
|
Registered User
|
|
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks very much, I have set the PATH. In order to start typing the code out and compiling it what do I do? I tried typing a comment /* in the cmd, but it gave me that error message again, not a recognizable internal or external command.
He was twitching because he's got my axe embedded in his nervous system!- Gimli, Two Towers
|
|

March 12th, 2006, 04:53 AM
|
|
Registered User
|
|
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
c:\> edit c:\autoexec.bat
in autoexec.bat file u have to only wirte
set path="c:\jdk1.5_6\bin\";
then save the file and run it from command prompt
c:\>autoexec.bat
anand
|
|
 |