• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

HelloWorld will not compile

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is what happens in the command prompt window, see below:

C:\WINDOWS\system32>javac HelloWorld.java
javac: file not found: HelloWorld.java
Usage: javac <options> <source files>
use -help for a list of possible options

This is the location of jdk on my computer:

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

HelloWorld.java is located here:

C:\Program Files\Java\HelloWorld

Please, tell me what I'm doing wrong. Thank you.

abarrettm31
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

First, you should create your own directory for your files. Do not use "Program Files\Java" because that will mix your files in with Java's installation. For example, you might create a directory called "myJava" under C (that is, C:\myJava) and put your own files there.

Next, to compile, use the cd (change directory) command so that your current directory is where your .java source file is located. For example, assuming you call your directory "myJava," then at the C prompt, type "cd myJava"...

C:\>cd myJava
C:\myJava>

Then, with myJava as your current directory, type "javac HelloWorld.java"...

C:\myJava>javac HelloWorld.java
C:\myJava>

(Note: The good news is that your system recognizes the "javac" command, so that means Java is installed and your path is updated correctly. )
 
Aaron Barrett
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you
 
What are your superhero powers? Go ahead and try them on this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic