javac command in Windows is not working

javac path is not changing

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 3968 Views - Last Post: 25 December 2010 - 08:12 PM Rate Topic: -----

#1 nquadr  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 120
  • Joined: 30-October 10

javac command in Windows is not working

Posted 25 December 2010 - 05:43 PM

I have installed Java 6 update 23. I am trying to code in Java for the first time. I have used the command prompt to run a program using the java command. However, I cannot get the javac command to work. I think it's a path issue, but I cannot solve it. I have tried to change paths in the runtime environment, but it does not take the change. I have two partitions on my hard drive. A c:\ where the update file jdk1.6_23 is located and a D:\ where the jre6 folder is located. My path is currently listed to the D:\ folder, but the javac.exe file is located in the c:\ folder.

Any help will be greatly appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: javac command in Windows is not working

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: javac command in Windows is not working

Posted 25 December 2010 - 06:00 PM

at the console do

echo %path%

it should show your your path like this
Microsoft Windows [Version 6.0.6002]
Copyright © 2006 Microsoft Corporation. All rights reserved.

C:\Users\pbl>echo %path%
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\PROGRA~2\COMMON~1\ULEADS~1\MPEG;C:\Program Files (x86)\Java\jdk1.5.0_06\bin;C:\Program Files (x86)\UltraEdit;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;c:\Progr
am Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Fil
es\Microsoft SQL Server\100\DTS\Binn\

C:\Users\pbl>

note the Java path in bold
Was This Post Helpful? 1
  • +
  • -

#3 nquadr  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 120
  • Joined: 30-October 10

Re: javac command in Windows is not working

Posted 25 December 2010 - 06:07 PM

View Postpbl, on 25 December 2010 - 05:00 PM, said:

at the console do

echo %path%

it should show your your path like this
Microsoft Windows [Version 6.0.6002]
Copyright © 2006 Microsoft Corporation. All rights reserved.

C:\Users\pbl>echo %path%
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\PROGRA~2\COMMON~1\ULEADS~1\MPEG;C:\Program Files (x86)\Java\jdk1.5.0_06\bin;C:\Program Files (x86)\UltraEdit;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;c:\Progr
am Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Fil
es\Microsoft SQL Server\100\DTS\Binn\

C:\Users\pbl>

note the Java path in bold



I have tried that in both the c:\ and d:\ drive and it is not displaying any Java path.
Was This Post Helpful? 0
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: javac command in Windows is not working

Posted 25 December 2010 - 06:14 PM

View Postnquadr, on 25 December 2010 - 07:07 PM, said:

I have tried that in both the c:\ and d:\ drive and it is not displaying any Java path.

You can't "try C and D" there is just one PATH variable
If
> echo %path%
does not show the Java /bin directory into it you will have to edit your PATH variable to add it to it
Was This Post Helpful? 1
  • +
  • -

#5 nquadr  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 120
  • Joined: 30-October 10

Re: javac command in Windows is not working

Posted 25 December 2010 - 06:17 PM

View Postpbl, on 25 December 2010 - 05:14 PM, said:

View Postnquadr, on 25 December 2010 - 07:07 PM, said:

I have tried that in both the c:\ and d:\ drive and it is not displaying any Java path.

You can't "try C and D" there is just one PATH variable
If
> echo %path%
does not show the Java /bin directory into it you will have to edit your PATH variable to add it to it


Can you tell me how to add it? Thanks
Was This Post Helpful? 0
  • +
  • -

#6 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: javac command in Windows is not working

Posted 25 December 2010 - 06:26 PM

Depends of your flavor of Windows... but usually it is something like:
-- Control Panel
---- System
------ Advanced System Settings
-------- Environment Variables
select PATH then click on "edit"
add a ; to the end of the string and then append your Java bin path something like
C:\Program Files (x86)\Java\jdk1.6.0_23\bin
Was This Post Helpful? 1
  • +
  • -

#7 nquadr  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 120
  • Joined: 30-October 10

Re: javac command in Windows is not working

Posted 25 December 2010 - 06:37 PM

I am assuming it is system variables that I have to edit, but I believe I should just create a variable because there is no variable there for Java but what would I name the variable?

Is there a way to do it from the command prompt?
Was This Post Helpful? 0
  • +
  • -

#8 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: javac command in Windows is not working

Posted 25 December 2010 - 06:46 PM

It is the PATH system variable that you have to edit
There is no "special" variable for Java

If you want (and are masochist) you can always type the full path (with " dues to the space)
> "C:\Program Files (x86)\Java\JDK......\bin\javac" myClass.java

or you can put your .java file in the \bin directory and then just type > javac myClass.java
just make sure you do not use a filename already existing
Was This Post Helpful? 0
  • +
  • -

#9 nquadr  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 120
  • Joined: 30-October 10

Re: javac command in Windows is not working

Posted 25 December 2010 - 06:53 PM

C:\Program Files\Java\jdk1.60_23\bin\


I added this to the path and ran the command prompt echo %path%.

It shows the line now in the path, however it is still not recognizing the javac command. Any thoughts?
Was This Post Helpful? 0
  • +
  • -

#10 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: javac command in Windows is not working

Posted 25 December 2010 - 07:00 PM

View Postnquadr, on 25 December 2010 - 07:53 PM, said:

C:\Program Files\Java\jdk1.60_23\bin\


I added this to the path and ran the command prompt echo %path%.

It shows the line now in the path, however it is still not recognizing the javac command. Any thoughts?

Your sure it is \jdk1.60_23\ your actual one ?
I was just giving an example
And once it is done, you have to log off and re log in
And show us the output of > echo %path%
Was This Post Helpful? 1
  • +
  • -

#11 nquadr  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 120
  • Joined: 30-October 10

Re: javac command in Windows is not working

Posted 25 December 2010 - 07:02 PM

Yes it is the actual one. I will reboot and see if that works.
Was This Post Helpful? 0
  • +
  • -

#12 nquadr  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 120
  • Joined: 30-October 10

Re: javac command in Windows is not working

Posted 25 December 2010 - 07:10 PM

No it still is not working.
Was This Post Helpful? 0
  • +
  • -

#13 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: javac command in Windows is not working

Posted 25 December 2010 - 07:16 PM

It should :)
You must have a typo in your path

>cd to your java /bin directory
> echo %PATH%

post your window

we will see if both match
Was This Post Helpful? 1
  • +
  • -

#14 nquadr  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 120
  • Joined: 30-October 10

Re: javac command in Windows is not working

Posted 25 December 2010 - 07:29 PM

View Postpbl, on 25 December 2010 - 06:16 PM, said:

It should :)
You must have a typo in your path

>cd to your java /bin directory
> echo %PATH%

post your window

we will see if both match


I was not able to navigate to bin directory, but I have posted this for you in the attachment.

Attached File(s)

  • Attached File  Doc1.doc (207K)
    Number of downloads: 80

Was This Post Helpful? 0
  • +
  • -

#15 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: javac command in Windows is not working

Posted 25 December 2010 - 07:35 PM

View Postnquadr, on 25 December 2010 - 08:29 PM, said:

I was not able to navigate to bin directory, but I have posted this for you in the attachment.

What do you mean you couldn't navigate to that directory ? You sure it exists ?
Was This Post Helpful? 1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2