File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Java-5 does not allow me to create a class file-why? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java-5 does not allow me to create a class file-why?" Watch "Java-5 does not allow me to create a class file-why?" New topic
Author

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

Charles Keller
Greenhorn

Joined: Jan 31, 2004
Posts: 24
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

Joined: Apr 08, 2004
Posts: 130
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

Joined: Jul 22, 2000
Posts: 9044
    
  10
Moving to Java in General (beginner)


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
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 ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
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 ]

Java API Documentation
The Java Tutorial
Charles Keller
Greenhorn

Joined: Jan 31, 2004
Posts: 24
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

Joined: Dec 06, 2001
Posts: 3061
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java-5 does not allow me to create a class file-why?