• Post Reply Bookmark Topic Watch Topic
  • New Topic

i have jdk download but i still can not run java code  RSS feed

 
Kevin Olisemeke
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For about a week I have been battling with the problem of running java codes on my pc even after I have downloaded java development kit and set the path variables . I am getting errors that says the file I am trying to compile can not be found and I saved it right with the usual ".java" extension. please , I need help with this .
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting errors

Can you copy the full contents of the command prompt window and paste it here so we can see what folder the command is issued in and what the text of the command and error messages was?
 
Carey Brown
Saloon Keeper
Posts: 3310
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the folder organization of your project?
Which were you in when you typed "javac ..."?
What was the complete command line you typed for "javac ...."?
 
Liutauras Vilda
Sheriff
Posts: 4917
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also please specify whether you use package statement/-s within the source file/-s.
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to worry about the contents of the source file (package statement) until after you are able to compile the source.
 
Liutauras Vilda
Sheriff
Posts: 4917
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Norm Radder wrote:You don't need to worry about the contents of the source file (package statement) until after you are able to compile the source.

As far as I'm aware, let's say if you have a class B which is in a package "com.test" and it extends class A which itself is in a package "com.test1" and you try to compile class B in regular way, you get a compile time error, which sounds like:

error from cmd wrote:B.java:3: error: cannot find...

Kevin Olisemeke wrote:I am trying to compile can not be found

Reading OP's initial post, he didn't describe error in full, so, his interpretation can be slightly inaccurate, hence was asking for more information, which may or may not be helpful.

Norm, getting back to your quote, you state that package statement and inheritance cannot prevent code from compiling issuing standard "javac ClassName.java" command, so you need to compile first and then worry about package?

Please explain as I'm clearly missing something.

 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting errors that says the file I am trying to compile can not be found

C:\Users\Norm>javac NoFile.java
javac: file not found: NoFile.java
Usage: javac <options> <source files>
use -help for a list of possible options

Until we get more information, I was assuming the above was what the OP was seeing.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!