File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Larry O'duntan
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 327
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
K. Tsang
Bartender
Pie
Posts: 3223
12
Android Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Yasser Shaikh
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Campbell Ritchie
Sheriff
Pie
Posts: 47288
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Larry O'duntan
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 327
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 47288
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never heard "Windows Vista Ultimatum" but anyway.. you could put



instead of
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic