This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes i cannot get java to run on my laptop.. help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "i cannot get java to run on my laptop.. help" Watch "i cannot get java to run on my laptop.. help" New topic
Author

i cannot get java to run on my laptop.. help

Larry O'duntan
Greenhorn

Joined: Jul 18, 2009
Posts: 4
i have just in stalled java onto my system and i tried to run a code on it but its not running..
i'm usin a window vista ultimatum, i have changed the path, it confirmed that java is there on the system. but it just wont run..
is it a vista problem, because i have dis same problem on my other computer so dats why i used a new one...


please help.
Jason Irwin
Ranch Hand

Joined: Jun 09, 2009
Posts: 327
What was the error? How did you try to run it? How did you confirm? Was the code compiled, or did you need to compile it? Did you just install the JVM or a JDK?

Need a bit more info I am afraid.


SCJP6
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2563
    
    9

welcome to the ranch.

try typing "java" at the command prompt. By default the JRE path should be set. To run "javac" you will need to set the path.

If it's not a path problem, did the program compile?


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
Yasser Shaikh
Greenhorn

Joined: Oct 01, 2008
Posts: 21
try setting the path...
here's what i think you should do....

open command prompt

type "set path=;........."

where...... will be the full path of your bin folder
for eg mine is "C:\Program Files\Java\jdk1.6.0_14\bin"

and then try compiling and running your file.....
this worked for me... lets see if it works for you

yrus


~~yr[:_:]s~~
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
The suggestion about setting the PATH from the command line is a good one; if you make a mistake, you won't cause any harm.

Try typing "java -version", then javac -version" as suggested at a command prompt, then tell us what happens. Note the java tool may run happily even if the javac tool, which you need too, won't.

You realise there is a Java™ Tutorials page which may help you?
Larry O'duntan
Greenhorn

Joined: Jul 18, 2009
Posts: 4
the error is as follows..

javac: file not found: Party.java
Usage: javac <options> <source files>

its a jdk, i'v set d path an tried what Yrus suggested, but its still givin me d same error above...

Thank peeps I really appreciate your effort...
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Larry --

"javac Party.java" will work if and only if there's a file named Party.java in the current directory -- i.e., if you can also type "dir" and see "Party.java" as one of the listed files.The error message is telling you that the file is not there. Please try the "dir" experiment, and see what you see. A common mistake is to use the "notepad" program to enter your code and accidently save it as "Party.java.txt" -- notepad makes it very easy to make this silly mistake.


[Jess in Action][AskingGoodQuestions]
Larry O'duntan
Greenhorn

Joined: Jul 18, 2009
Posts: 4
Thanks Guys, and thank you Earnest...
I have burst the bubble, it was because the file was in another folder inside C:/, so i move it directly onto C: and it compile.....
Many Appreciation and look forward to see me again soon, cuz i believe i will hit a bump again sometimes.....

Thanks for the help...
Jason Irwin
Ranch Hand

Joined: Jun 09, 2009
Posts: 327
You can also define a classpath to wherever the source code is
javac -cp /path/to/source/directory Party.java
Just be careful of spaces in the path, otherwise you'll hit problems
javac -cp "/path/to/source directory" Party.java
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
Is that the Party application from Head First Java? Beware: you can compile it, but there are "bits missing" so Party won't run in its present state.

And well done getting it sorted out.
Larry O'duntan
Greenhorn

Joined: Jul 18, 2009
Posts: 4
it is from head first and it is not working yet.....
it says access is denied while writing to class...

Error as follows:

Party.java:3: error while writing Party: Party.class <Access is denied>
class Party{
^
1 error..

what kind of error is these and what does it means..

i typed it exactly as it was in the Party Application in the Head First Java....

Thanks
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Jason Irwin wrote:You can also define a classpath to wherever the source code is
javac -cp /path/to/source/directory Party.java


Well, no. The arguments to javac are literal filesystem paths; they're not looked up along the classpath.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Larry O'duntan wrote:
Party.java:3: error while writing Party: Party.class <Access is denied>
class Party{
^
1 error..


That's very strange: it seems to mean that Windows is not letting javac write to your disk. Since you've already created the file Party.java, it's hard to imagine why this would be, unless it's an overzealous antivirus program, or perhaps "Windows Vista Ultimatum" feels that javac doesn't deserve the privilege. You said this is your laptop -- is it actually yours, or was is set up by your employer or school?
Kalabaw moo
Ranch Hand

Joined: May 26, 2009
Posts: 61
I've never heard "Windows Vista Ultimatum" but anyway.. you could put



instead of
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Kalabaw moo wrote:you could put ...


You certainly could, but of course this would have no effect whatsoever on the current problem.
Kalabaw moo
Ranch Hand

Joined: May 26, 2009
Posts: 61
Yeah, you're right. Maybe it'll fix the problem. I guess there is a thread here that provided that solution to the same problem. I just can't remember what thread it is.
Kalabaw moo
Ranch Hand

Joined: May 26, 2009
Posts: 61
I found the thread... Maybe this could fix the issue, if not, I'll leave it to the experts..

edit: I guess the solution provided in the thread I found was a different case here in this thread.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: i cannot get java to run on my laptop.. help