• Post Reply Bookmark Topic Watch Topic
  • New Topic

The system cannot find the path specified  RSS feed

 
Devin Small
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, hope someone can help me.

I have the Java Development Kit downloaded in my C file and my book tells me to compile the program I need to open command windowand change the directory where the program is stored. I tried the command cd to change directory and received this message "The system cannot find the path specified."

I checked the Environment Variables on Windows 7 and the Path says: C:\Program Files (x86)\Java\jre1.8.0_31\bin

This is after many tries and i still can't change directory and i keep getting the same message.

The book I am using to learn Java is "Java How to Program: Tenth Edition" from Paul and Harvey Deitel. Maybe someone knows what my issue is here and can help me?

Thanks
Devin
 
Guillermo Ishi
Ranch Hand
Posts: 789
C++ Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you need to change the current directory to where your java file is? For starters the easiest thing might be to copy your java file to the root directory "c:\" and then in the window enter cd \
The compiler will look for the java file in the directory it was started from and find it there in c:\

Also from the command window, Windows sometimes doesn't like spaces in paths even though Windows creates paths with spaces. If you have a space you might try a \ or a / in front of the space, That works in linux but I haven't used Window in a long time.

 
Stefan Evans
Bartender
Posts: 1837
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In windows, putting quotes around a path should make it work.
I am paranoid enough that I take no chances, and install Java into: C:\java rather than under "C:\Program Files\Java..."

Another trick you can do with the command line is to use "auto complete"
Type the first few characters of the path, and then hit 'tab' if it finds a match it should fill in the rest of the directory name for you, and you can then type the next layer

so type: "cd c:\pro" and then 'tab' --> cd "\Program Files"
type "ja" and then 'tab' --> cd "\Program Files\Java"
...

Try just typing "java -version" at the command prompt. If prints out your java version, you know you have it installed correctly.

Then try typing "javac -version"

You listed a path to a JRE which is the java runtime. That won't let you compile java programs. For that you need a full JDK and the javac (java compiler) (check out the Beginners FAQ for an explanation



 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Devin Small wrote:I need to open command window and change the directory where the program is stored. I tried the command cd to change directory and received this message "The system cannot find the path specified."

That means you're trying to cd to a directory that doesn't exist.

Open a command prompt.
Type dir and press <Enter>
Type the cd command you've been using; you should get the same error ("The system cannot find the path specified.")
Click the icon at the top left of the Command Prompt window
Select Edit > Select All
Press <Enter>

Paste the result here (UseCodeTags <- that's a link)
 
Devin Small
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:
Devin Small wrote:I need to open command window and change the directory where the program is stored. I tried the command cd to change directory and received this message "The system cannot find the path specified."

That means you're trying to cd to a directory that doesn't exist.

Open a command prompt.
Type dir and press <Enter>
Type the cd command you've been using; you should get the same error ("The system cannot find the path specified.")
Click the icon at the top left of the Command Prompt window
Select Edit > Select All
Press <Enter>

Paste the result here (UseCodeTags <- that's a link)



 
Carey Brown
Saloon Keeper
Posts: 3328
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try

And see which command fails
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Devin Small wrote:I have the Java Development Kit ...

I checked the Environment Variables on Windows 7 and the Path says: C:\Program Files (x86)\Java\jre1.8.0_31\bin

It looks like you have only installed the Java Runtime Environment (JRE) and not the Java Development Kit (JDK).
 
Devin Small
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carey Brown wrote:Try

And see which command fails


It failed for \examples and the rest below.
 
Paul Clapham
Sheriff
Posts: 22835
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surely your book didn't expect that those directories would already be on your computer? Didn't it tell you to create them, or something like that?

Anyway the only problem you're having is that those directories don't exist. Create them and you'll be fine.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carey Brown wrote:Try

And see which command fails

You do realise that the first line won't do anything, don't you?
 
Carey Brown
Saloon Keeper
Posts: 3328
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:
Carey Brown wrote:Try

And see which command fails

You do realise that the first line won't do anything, don't you?

The first line doesn't to anything if you happen to already be on the C: drive. I put that in there to guarantee that he is in fact on the C: drive.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!