• Post Reply Bookmark Topic Watch Topic
  • New Topic

Trying to reinstall JDK on new laptop  RSS feed

 
Jessica Stensrud
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks in advance.
I did install the JDK appropriate for my windows 7 64 bit laptop and put the required info in PATH and CLASSPATH but when I try to do javac program.java, I get 'javac' is not recognized as an internal or external command, operable program or batch file.
Please help - no time.
 
Swastik Dey
Rancher
Posts: 1815
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you set the path environment variable properly?
 
Jessica Stensrud
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did this: (to quote the trail boss)

On my windows machine, my PATH includes

"C:\jdk6\BIN;C:\jdk6\JRE\BIN".and my CLASSPATH is set to

".;C:\JAVA" (notice the dot before the first semicolon)
 
Swastik Dey
Rancher
Posts: 1815
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Classpath has got nothing to do with this error. Are you sure you have installed java in c:\ because your path is set like C:\jdk6\BIN?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so find the javac.exe file. Is there one in the C:\jdk6\BIN directory?

On my work PC, the javac.exe is in my C:\Program files (x86)\java\jdk1.7.0\bin directory.

The path in your PATH variable should be the one that gets you to that exectable program.
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you still using Java6?
There has been no need to set a system CLASSPATH for ages; you might as well delete that variable while you are at it.
 
Jessica Stensrud
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK - I have jdk7 (SEVEN) installed and put the javac.exe in a folder C:\jdk7\bin but now it's saying I'm missing jli.dll so I copied THAT from program files\java\jdk1.6.0_20 (thought I selected jdk7 from appropriate site)\bin
THEN the error said: Could not find or load main class com.sun.tools.javac.Main
Do I just copy EVERYTHING from the program files bin folder into the C:\jdk7\bin folder???
I go rid of the entries in the PATH and CLASSPATH.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jessica Stensrud wrote:Do I just copy EVERYTHING from the program files bin folder into the C:\jdk7\bin folder???

No. You don't copy anything from the program files bin folder.
Delete the c:\jdk7 directory and all its contents and then add the program files bin directory to your PATH environment variable.

I don't know which instructions you were following, but they were probably just using c:\JDK6\bin as an example. Wherever they use that you should replace it with the bin directory from your Java installation e.g Fred would have replaced it with C:\Program files (x86)\java\jdk1.7.0\bin
 
Jessica Stensrud
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did as you explained, Joanne, but I am back to : "'javac' is not recognized as an internal or external command, etc." I have no entry for this in my classpath and everything is specific to the install in my path environment variables:
C:\Program Files\Java\jdk1.7.0_45\bin

now what?
thanks - ugh
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jessica Stensrud wrote:now what?

Open a command prompt and type
echo %PATH%
and copy and paste the output here.
 
sai rama krishna
Ranch Hand
Posts: 536
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
some times restarting the command window or laptop could fix the issue.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sai rama krishna wrote:some times restarting the command window or laptop could fix the issue.

Good point. You don't need to restart the laptop, but you do need to open a new command window after changing any environment variables.
 
Jessica Stensrud
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

when I did echo %PATH% I saw some references to C:\jdk6\bin and C:\jdk7\bin - so got rid of those - had to restart for it to be removed from PATH.
Now those are gone - here's the echo:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

Z:\>echo %PATH%
c:\Program Files (x86)\ATI Stream\bin\x86_64;c:\Program Files (x86)\ATI Stream\b
in\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System
32\WindowsPowerShell\v1.0\;C:\windows\des_tools;c:\Program Files (x86)\ATI Techn
ologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Attachmate\RSecure\;C:\PROGRA
~2\IBM\SQLLIB\BIN;C:\PROGRA~2\IBM\SQLLIB\FUNCTION;C:\PROGRA~2\IBM\SQLLIB\SAMPLES
\REPL;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Fil
es\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\10
0\DTS\Binn\;C:\Program Files\TortoiseSVN\bin; C:\Program Files\Java\jdk1.7.0_45\
bin

Z:\>C:

C:\>cd \Practical Java\Lesson 1\src

C:\Practical Java\Lesson 1\src>javac Queue.java
'javac' is not recognized as an internal or external command,
operable program or batch file.

C:\Practical Java\Lesson 1\src> thanks for your help . . . .
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would appear to have a JDK at the end of your PATH. It is better to have the JDK at the beginning of your PATH, otherwise there is a risk of using a newer version of javac than java.
Please confirm that you have a directory called C:\Program Files\Java\jdk1.7.0_45\bin and that it all appears on one line and that there are a java.exe and javac.exe files in that directory.

And please upgrade to this version of Java7. There may be serious security problems which the updates have corrected. And yes, you will have to set that PATH anew, I am afraid.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you just check that there is a javac.exe in C:\Program Files\Java\jdk1.7.0_45\bin ?

The only other thing I can see is that there is a space between the last ; and the directory name in your PATH. I don't think that should matter but assuming javac.exe exists then it might be worth getting rid of the space. Don't forget to start a new command propmpt after doing it.
 
Jessica Stensrud
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK - I did the update to jdk1.7.0_67 and moved the C:\Program Files\Java\jdk1.7.0_67\bin to the beginning of the PATH, however, I now also have the jdk1.7.0_45 folder as well.
Both have both javac.exe and java.exe in them.

Here's the latest echo:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

Z:\>c:

C:\>cd \Practical Java\Lesson 1\src

C:\Practical Java\Lesson 1\src>javac Queue.java
'javac' is not recognized as an internal or external command,
operable program or batch file.

C:\Practical Java\Lesson 1\src>echo %PATH%
C:\Program Files\Java\jdk1.7.0_45\bin; C:\Program Files\Java\jdk1.7.0_67\bin; c
:\Program Files (x86)\ATI Stream\bin\x86_64;c:\Program Files (x86)\ATI Stream\bi
n\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System3
2\WindowsPowerShell\v1.0\;C:\windows\des_tools;c:\Program Files (x86)\ATI Techno
logies\ATI.ACE\Core-Static;C:\Program Files (x86)\Attachmate\RSecure\;C:\PROGRA~
2\IBM\SQLLIB\BIN;C:\PROGRA~2\IBM\SQLLIB\FUNCTION;C:\PROGRA~2\IBM\SQLLIB\SAMPLES\
REPL;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program File
s\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100
\DTS\Binn\;C:\Program Files\TortoiseSVN\bin

C:\Practical Java\Lesson 1\src>
 
Jessica Stensrud
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
removed the spaces before C:\ in PATH as recommended by Joanne - now it works. wow :p thanks everyone!
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jessica Stensrud wrote:removed the spaces before C:\ in PATH as recommended by Joanne - now it works. wow :p thanks everyone!

Cool. That was just a guess on my part, but I couldn't see anything else wrong, so thought it might be worth suggesting.
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please remove the reference to Java7u45 from your PATH. If you have that first, the OS will find the 7u45 folder first and ignore the update to 67.

And well done Joanne seeing that space
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!