• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java-5 does not allow me to create a class file-why?

 
Charles Keller
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With Java-4 (jdk2sdk1.4.1.02) I was always able to create a class file using:
C:\Java-CK\>javac �d C:\Java-CK HelloDate.java
and I would get a file called HelloDate.class.
and I would be able to run this short program.

I am trying to do the same with Java-5 (jdk1.5.0_04) and it does not work.
It always gives me the following error message:
-Javac is not recognized as an internal or external command,
operable program or batch file.

In my C:>autoexec.bat I have a line:
SET PATH=%PATH%;�C:\Program Files\Java\bin�
and another line:
SET CLASSPATH=�C:\Program Files\Java�

Ii did that, because �javac.exe� is under \bin.
What did I do wrong?

Your help would be very much appreciated.
Charles.
 
John Dell'Oso
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Charles,

Are you sure that javac.exe resides in c:\Program Files\Java\bin? This would mean that you would have installed the JDK into c:\Program Files\Java. Run a search on javac.exe and check which directory(ies) javac.exe lives in.

Regards,
JD
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Java in General (beginner)
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following on from John: are you sure there is no jdk1.5.0_04 or similar after the \Program Files\java and before the \bin? Or did you install the jdk in a non-default place?

What does echo %PATH% give you?
[ September 10, 2005: Message edited by: Barry Gaunt ]
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't an issue of what Java 5.0 allows or does not allow. The problem seems to be that Windows cannot find the javac.exe program. Make sure that the directory that contains javac is listed in the PATH variable. If you need help with this, please let us know.

Layne

p.s. The "-d <dir-name>" option is typically only used if you want to put the class file in a different directory. Since you are specifying the same directory as the current one, you can just type "javac HelloDate.java" which will save you several keystrokes.

[ September 11, 2005: Message edited by: Layne Lund ]
[ September 11, 2005: Message edited by: Layne Lund ]
 
Charles Keller
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Memo to John Dell'Oso, Barry Gaunt and Layne Lund:
Thank you very much for your valuable help. You showed me the way to find out what was wrong with my Java program; I only had
C:\Program Files\Java\bin instead of
C:\Program Files\Java\jdk1.5.0.04\bin.
So I made an instruction shteet how to download jdk1.5.0_04 and followed it religiously. And now, my Java program works like a charm!
Here it is:

Foolproof Downloading of Java Program JDK-1_5_0_04 � NB-4_1.win.exe
Into a Pentium IV Computer with Windows XP:
Log on to: http://java.sun.com/J2SE/
For J2SE-5.0

1.D/L: JDK-1_5_0_04-NB-4_1.win.exe (127 MB) D/L went fine on \\AMD)

2. Install at C: Same as under 1. (and <Enter>
gives: Welcome to the Install Wizard for Java 2- SED Kit, Update 4
and Netbeans IDE, 4.1.

This will install the above file on your computer; to
continue: choose NEXT.

3.Accept agreement

4. Installation locations will be as follows:
Netbeans:C:\Program Files\netbeans-4.1
J2SDK : C:\Program Files\Java\jdk1.5.0_04
Total size: 453 MB

5. Now installing: - Netbeans
-JDK
-Java Runtime Environment
-Building Storage
-Creating Uninstaller

6. Installation: Successful.

7.J2SE Development Kit, Update 4, Install location
C:\Program Files\Java\jdk1.5.0_04

J2SE Runtime Environment, Update 4
C:\Program Files\Java\jre1.5.0_04

Netbeans IDE 4.1
C:\Program Files\netbeans-4.1

8.To run the IDE command, launch:
C:\Program Files\netbeans-4.1\bin\netbeans.exe

To uninstall the IDE:
C:\Program files\netbeans-4.1\uninst\uninstaller.exe

To uninstall J2SE Development Kit, Update 4:
Use Add or Remove Program in Control Panel

To uninstall J2SE Runtime Environment, Update 4:
Use Add or Remove Program in Control Panel.

9. Add the following line to your Autoexec.bat file:
SET PATH=%PATH%; C:\Program Files\Java\jdk1.5.0_04\bin

For Classpath, also add to your Autoexec.bat:
SET CLASSPATH=C:\Program Files\Java

10. Finish (Netbeans 4.1 icon showed up on Desktop)

11. To print �Tutorial� , go to the same URL as mentioned above.

--- End. (Thank you for your wonderful help). Charles.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Foolproof Downloading of Java Program JDK-1_5_0_04 � NB-4_1.win.exe
Into a Pentium IV Computer with Windows XP:


As they say, if you make it foolproof, someone will make a bigger fool.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic