• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Compiling prob

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just cant compile for some reason, path seems ok
PATH=C:\Windows\system32;......;C:\Program Files\java\jdk1.6.0_10\bin

, but get this

C:\Users\Steve> Javac Hello.java

Javac: file not found: Hello.java
Usage: javac <options><source files>
use -help for a list of possible solutions

just got new computer, maybe its administartor probs?

This is driving me up the wall lol, any help would be much appreciated

cheers
 
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
I think your PATH is okay, because otherwise you would get a message "javac is not recognized..."

Are you certain that your current directory contains that file (Hello.java)? Try typing the "dir" command for a list of what's in the directory.
 
Marshal
Posts: 72416
315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your PATH appears to be correct because otherwise it would give an error message starting "javac is not recognized . . ."
Which directory have you got your Hello.java file in? I presume you are in the same directory; on Windows you can verify its presence with "dir" and on *nix you would use "ls".

[diversion]So far, so good; I have told you more or less the same as Marc, who seems to have beaten me by a few seconds. And I see he has passed 10000. Congratulations, Marc.[/diversion]

Once you have found your Hello.java file, try inserting " -cp . " between "javac" and "Hello.java" (minus the quotes). Several people have posted in the last few weeks with the problem of not having a CLASSPATH set.
You can set a CLASSPATH for the lifetime of your present terminal window by writing something like set classpath=.;%CLASSPATH% See this link.

You will see all sorts of things on the net telling you to put this that and the other in your system CLASSPATH; there is only one thing you really need on Windows, which is a dot. It can appear as . or .; or ;. or ;.; and it doesn't seem to matter if it appears twice. You can set up your CLASSPATH by a similar process to setting the PATH; if there is no CLASSPATH at all, you can create one by writing CLASSPATH (it is probably not case-sensitive) in the box and . in the next box.
Close your command line window; the CLASSPATH will only work in a new terminal.
I usually use Linux, where it seems to work with no CLASSPATH set at all.
 
j patrick
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ahhh i got it, cheers, i was having problems saving files in the right directory, if that makes sense. The smallest problems can have you pulling your hair out.

Much appreciated!
 
Campbell Ritchie
Marshal
Posts: 72416
315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by j patrick:
ahhh i got it, cheers . . . The smallest problems can have you pulling your hair out.

Much appreciated!



You're welcome ( ). And I remember spending weeks failing to get anything to compile when I first started. I know exactly how it feels.

And you have obviously now got your CLASSPATH sorted out.
 
marc weber
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

Originally posted by Campbell Ritchie:
...I see he has passed 10000. Congratulations, Marc...


Thanks! Time for a nap.
 
I'm THIS CLOSE to ruling the world! Right after reading this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic