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 Installing JDK in Windows 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Installing JDK in Windows 7" Watch "Installing JDK in Windows 7" New topic
Author

Installing JDK in Windows 7

sam johnston
Greenhorn

Joined: Feb 08, 2010
Posts: 14
Hey all at Java Ranch,

I apologize in advance for my noobish question but here it goes

I am quite new to java and I have been reading my intro book and I ran into a hitch I installed the latest version of the JDK and when through the setup wizard and the process went without a hitch. Now I wish to compile and run my first java program I oped up cmd and told it to go to C:\Program Files (x86)\java\jdk1.6.0_18\bin\javac to my first program and It cannot find the javac program and no matter how many different methods I use to tell it to start the javac my computer cannot find the program any ideas?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30085
    
149

Sam,
Welcome to JavaRanch!

Do you see a file named "javac" in C:\Program Files (x86)\java\jdk1.6.0_18\bin? If so, can you post the command you are running? Or a few of them since you tried different things.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
sam johnston
Greenhorn

Joined: Feb 08, 2010
Posts: 14
Yeah I see the file there

What I have been doing is C:\Program Files (x86)\java\jdk1.6.0_18\bin\javac Program Files (x86)\java\jdk1.6.0_18\bin\javac and "C:\Program Files (x86)\java\jdk1.6.0_18\bin\javac" the last one actually worked but then I ran into trouble with it finding the .java program I wanted it to compile is there a method where I can make it where I can just issue the javac command then the directory of the .java file I saw that it could be done but I was unable to get it to work correctly and I was wondering if it was a problem with the installation or the fact that im using a 64 bit version of windows?
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Are you sure you installed the JDK and not the JRE? Because you need the JDK.

Edit: to late


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Set your path.
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1659
    
  11

Why did you install the 32 bit JDK with a 64 bit OS? You might consider uninstalling and reinstalling.

And, yes, I agree with David. You need to set your path. Right click my computer, select properties, select advanced system settings, and click the button that says "environment variables". Add a semicolon and the full directory name to the bin folder inside your JDK install to the PATH textbox.


When you do things right, people won't be sure you've done anything at all.
sam johnston
Greenhorn

Joined: Feb 08, 2010
Posts: 14
Ok I reinstalled JDK (I feel quite dumb for not looking for the 64 bit installer) and I went to set the path and I entered ;C:\Program Files\Java\jdk1.6.0_18\bin and still when I type javac into cmd windows still cannot find the command
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1659
    
  11

Did you add it to both the system and user variables? You only need it in the system, but I've seen people put it in both.

Did you reboot?
sam johnston
Greenhorn

Joined: Feb 08, 2010
Posts: 14
Yea I added it in both and restarted and still nothing
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1659
    
  11

Alright.... when you try to compile, your command prompt is in the directory of the java file?

That is to say your command looks like this:



What, exactly is in the "system variables / PATH" textbox? If windows is "not recognized command or filename" you might have a typo... copy and paste that entire textbox here
Pushkar Choudhary
Rancher

Joined: May 21, 2006
Posts: 425

Can you post here the exact error that you are getting when you try to compile a class?
sam johnston
Greenhorn

Joined: Feb 08, 2010
Posts: 14
Its just the 'javac' is not recognized as an internal or external command
sam johnston
Greenhorn

Joined: Feb 08, 2010
Posts: 14
in the system variable path I have

Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1659
    
  11

you have no other paths? Most people have paths to the root and the windows folder... get rid of the semicolon.
sam johnston
Greenhorn

Joined: Feb 08, 2010
Posts: 14
My goodness we have success!!@!!1!!!
Thanks all who helped in this simple process gone wrong!
Now if I get anywhere in java programing everyone who helped will be able to say they had a part in the magic
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1659
    
  11

You'll be back
Pushkar Choudhary
Rancher

Joined: May 21, 2006
Posts: 425

sam johnston wrote:My goodness we have success!!@!!1!!!

Good to see that. And have a good time learning Java!
sam johnston
Greenhorn

Joined: Feb 08, 2010
Posts: 14
So true you are! Im trying to compile my second app and I get a error saying an exception in the tread "main and a long list of where the eroor is and then it says it cannot find the class
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1659
    
  11

sam johnston wrote:So true you are! Im trying to compile my second app and I get a error saying an exception in the tread "main and a long list of where the eroor is and then it says it cannot find the class


Looks like you get to start a new thread!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Installing JDK in Windows 7
 
Similar Threads
can't find javac in jdk1.5.0
class 1
the compilers not computing man!
Cannot compile a java program
Help with running my first program.