• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to set up Java environment as in Head First Java?  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made the changes to my path but when i write a code it shows always shows 'file not found'. How do i set it up? I'm confused.
 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please explain the full details, including where you are putting your code, how you are invoking it at the command line, etc. Please copy and paste all the commands and error messages. When we know all that information, then we can help.
 
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please be careful when you change your path. You can break all kinds of things if you don't do it right.

on you command line, type this:

echo %path%

and look to see if the directory to your java install is there. If you are not sure, paste what you get from that here.
 
Nissim Nabh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@fred: Ya its in my path.
@campbell: I edited my path file, after installing jdk 1.8, to its bin directory. Then i make an app from notepad and save it as 'AnyApp.java'. It gets saved as a JAVA file as it should and not as a text file. Then from the command line, i try to compile it with the command, 'javac AnyApp.java', but it shows an error saying, 'File not found'. I have saved the app on my desktop. What am I doing wrong?
java1.PNG
[Thumbnail for java1.PNG]
Code written in Notepad
java2.PNG
[Thumbnail for java2.PNG]
AnyApp has been saved correctly as a .java file
java3.PNG
[Thumbnail for java3.PNG]
The command prompt screenshot
 
Ranch Hand
Posts: 614
9
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In command prompt, change the directory to desktop. Then execute the command to compile.
Or you can do like

I presume "Desktop" directory is under "C:\Users\Praanjali"
 
Campbell Ritchie
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't use the desktop, unless you want thousands of .java files cluttering your screen.
You will find what I usually suggest in this old post.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!