Joe Wibbs wrote:Hi, I recently installed Java JDK 7 on my PC running Windows 7 and I'm looking to solve an issue with an error message I'm receiving.
Installation seemed to go just fine. javac.exe and java.exe are installed in C:\Program Files\Java\jdk1.7.0_40\bin
I added that exact address to the beginning of the System Variable "Path" in Environment Variables and I added a semi-colon to the end:
C:\Program Files\Java\jdk1.7.0_40\bin;
I opened a command prompt and java -version returns:
java version "1.7.0_40" etc. etc.
javac -version returns:
javac 1.7.0_40
path returns:
PATH=C:\Program Files\Java\jdk1.7.0_40\bin; etc. etc.
I have a file "Example.java" located in C:\Program Files\Java\jdk1.7.0_40\bin
So when I try to compile the file at the C:\> by typing "javac Example.java" I receive the following error message back:
javac: file not found: Example.java
If I navigate to the directory though by typing cd\Program Files\Java\jdk1.7.0_40\bin and then typing "javac Example.java" the Example.class file is created as expected.
Please advise!
Joe Wibbs wrote:Ok that is strange because it complains only when I try to run javac Example.java from the C:\>.
When I navigate to the \bin directory using cd\ and type javac Example.java the Example.class file is created as expected.
Then running "java Example" returns the expected output.
Using Windows Explorer, I also see the Example.java file in the bin directory and it shows "JAVA File" for the file attribute "Type". I created the Example.java file in Microsoft's WordPad program.
Joe Wibbs wrote:But I still am searching for a solution that allows me to run javac from the C:\ prompt so I don't have to navigate to the bin directory (or the project directory) each time.
There are hundreds of posts that suggest putting the bin directory at the beginning of the path variable is the solution--but no luck for me.
So I'm definitely confused at this point.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I have a file "Example.java" located in C:\Program Files\Java\jdk1.7.0_40\bin
Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
|