• Post Reply Bookmark Topic Watch Topic
  • New Topic

Path Variable problems  RSS feed

 
Zach Christian
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I am new here.

I need some help figuring out why 1) I can't run my code and 2) the javac does not work in CMD.

I set the PATH and variables, so I don't know what I missing, or doing wrong, or both. I would really like to start programming ASAP, but this issue is throwing a wrench into my progress.

Here is my Variable setup:
Name: PATHEXT
Value: %Path%\bin;.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

I have also created another path called "Path" which contains the \bin\ location for javac.exe.
C:\Program Files\Java\jdk1.7.0_25\bin

These are all under System Variables

I am running Windows 7 64 bit.


Also, since I new to the Java language (I have experience with Python) I need to know specifics on the whole "javac" thing (which directory can it be run from in cmd, etc).

Thank you so much.
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure which tool you're using, but do you mean in your setup where you have Value: , the Path there is defined as C:\Program Files\Java\jdk1.7.0_25\bin? If so, you have an extra /bin in your path.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

Look in this part of the FAQ for how to setup your PATH variable: http://www.coderanch.com/how-to/java/how-to-create-java-program

Remember: if you set the environment variable you will have to close and re-open the command line to see the change.

Zach Christian wrote:Also, since I new to the Java language (I have experience with Python) I need to know specifics on the whole "javac" thing (which directory can it be run from in cmd, etc).

I am not sure what you are asking. If you have set the environment variable, you will be able to run it from any directory. If not, you will need to specify the path to where the executable is. And i am not at all sure what questions are in the etc... part. But maybe the Java Beginners FAQ will help: http://www.coderanch.com/how-to/java/JavaBeginnersFaq
 
Zach Christian
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been using the FAQ section with no avail.

What I was asking is what you answered: "Can the javac be run from any directory?". Now to just get my path set correctly. This is where the issue lies.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zach Christian wrote:I have been using the FAQ section with no avail.

The directions there are pretty specific and work. I don't see why you set PATHEXT, that is not in the FAQ. If you follow the FAQ then you will get it right. Just do exactly what it says. The only deviation should be where you find the actual path you installed the JDK to.
 
Zach Christian
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keith Lynn wrote:I'm not sure which tool you're using, but do you mean in your setup where you have Value: , the Path there is defined as C:\Program Files\Java\jdk1.7.0_25\bin? If so, you have an extra /bin in your path.


Tool? I am just using the Windows System Properties > Environment Variables.

 
Zach Christian
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zach Christian wrote:
Keith Lynn wrote:I'm not sure which tool you're using, but do you mean in your setup where you have Value: , the Path there is defined as C:\Program Files\Java\jdk1.7.0_25\bin? If so, you have an extra /bin in your path.


Tool? I am just using the Windows System Properties > Environment Variables.



This may be my problem, but when I went to setup the variables, there was no "Path" or "PATH". I tried creating a new one as well.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
make sure you are opening a new cmd window after updating the path variable. any cmd window already open will NOT pick up the changes.

having said that...

open a new cmd window. type "echo %path%" see if the directory is in there.
 
Zach Christian
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Figured out the problem.

Using the %JAVA_HOME%\bin was not working so I created a new variable called "Path" and just put "JAVA_HOME\bin"..

javac now works.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!