patson lawrence
,
Greenhorn
Aug 12, 2017 04:47:39
hello "the ranch"
i can't bypass compiling the "my first java progrom. ie MooseGreetings.java
please improve my skills; regards.
java.PNG
thats my screen view of the file. created by notepad
cmd.PNG
thats what i get on the prompt cmd
fred rosenberger
,
lowercase baba
staff
Aug 12, 2017 05:34:15
don't type the path...just type:
javac MooseGreetings.java
patson lawrence
,
Greenhorn
Aug 12, 2017 06:17:56
its deep.
i have done so; typed "javac MooseGreetings.java" without quotes in the cmd prompt. the result is not
consoling enough.
cmd.PNG
result on the prompt
O Shea
,
Ranch Hand
Aug 12, 2017 06:58:46
Your jdk path is not set.
Just do following->
1) go to your folder where java is installed (mostly in C/Program files) then go to Java->then jdk-> then bin and then copy the path of current directory.
2) Then just search for environmental variables(in type to search here) and then click on it-> then there below you find path-> there edit-> then new-> and then paste that copied path.->Ok->Ok.
Now compile the program.
Alejandro Rosa
,
Greenhorn
Aug 12, 2017 07:21:12
patson lawrence wrote: its deep.
i have done so; typed "javac MooseGreetings.java" without quotes in the cmd prompt. the result is not
consoling enough.
The problem here is that you are not in the right path. Your terminal is in C:\Windows\system32, but MooseGreetings.java is located in C:\java\src.
The solution is to locate the terminal in the cool path, try this:
> cd C:\java\src
> javac MooseGreetings.java
Knute Snortum
,
Sheriff
staff
Aug 12, 2017 07:25:09
O Shea wrote: Your jdk path is not set.
No, the system found javac, but javac didn't find the Java file.
patson lawrence
,
Greenhorn
Aug 12, 2017 07:26:09
i will never forget my first;
so far this is how the variables field looks like..
apparently the cmd prompt is telling me this (see attached)
thank you.
variable.PNG
env. variable settings
cmd.PNG
executing in the above variables gives me that result
patson lawrence
,
Greenhorn
Aug 12, 2017 07:28:47
Knute Snortum wrote:
O Shea wrote: Your jdk path is not set.
No, the system found javac, but javac didn't find the Java file.
please direct me on how to locate the terminal from sysyt 32.
thanks.
Norm Radder
,
Rancher
Aug 12, 2017 07:32:41
Use the cd (change directory) command to change to the directory holding the java source file.
To see what the PATH contains, enter the command: PATH
in a command prompt window
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'
Paste here.
Knute Snortum
,
Sheriff
staff
Aug 12, 2017 07:37:01
You may have missed Alejandro Rosa's post, which first explained this.
In your first picture above, I can see that your Java file is in C:\java\src. So the first thing is to change directory (cd) into that directory (also called a folder).
cd c:\java\src
Now you call compile the file without a path to it.
javac MooseGreetings.java
Knute Snortum
,
Sheriff
staff
Aug 12, 2017 07:39:54
To see what the PATH contains, enter the command: PATH
in a command prompt window
The OP's PATH seems to be okay. Notice that the error message is from javac and that it prints the usage underneath.
patson lawrence
,
Greenhorn
Aug 12, 2017 07:40:43
Alejandro Rosa wrote:
patson lawrence wrote: its deep.
i have done so; typed "javac MooseGreetings.java" without quotes in the cmd prompt. the result is not
consoling enough.
The problem here is that you are not in the right path. Your terminal is in C:\Windows\system32, but MooseGreetings.java is located in C:\java\src.
The solution is to locate the terminal in the cool path, try this:
> cd C:\java\src
> javac MooseGreetings.java
Hello; please guide me changing to path of my file. how to remove that windows/syst 32 path.
patson lawrence
,
Greenhorn
Aug 12, 2017 07:43:37
Knute Snortum wrote:
To see what the PATH contains, enter the command: PATH
in a command prompt window
The OP's PATH seems to be okay. Notice that the error message is from javac and that it prints the usage underneath.
this is my current path;
cmd.PNG
when i run path on the cmd prompt
Knute Snortum
,
Sheriff
staff
Aug 12, 2017 07:43:38
Please read all of the posts before you ask a question. Several people (including me) have already told you how to do this.
Alejandro Rosa
,
Greenhorn
Aug 12, 2017 07:45:28
patson lawrence wrote:
Knute Snortum wrote:
To see what the PATH contains, enter the command: PATH
in a command prompt window
The OP's PATH seems to be okay. Notice that the error message is from javac and that it prints the usage underneath.
this is my current path;
Write cd C:\src\java in the terminal.
Norm Radder
,
Rancher
Aug 12, 2017 07:54:06
Please copy the contents of the command prompt window and paste it here. Images are no good because text can't be copied from an image to include in a response.
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'
Paste here.
patson lawrence
,
Greenhorn
Aug 12, 2017 08:01:44
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>cd C:\java\src
C:\java\src>javac MooseGreetings.java
'javac' is not recognized as an internal or external command,
operable program or batch file.
C:\java\src>
the above is my result. not any easy
Norm Radder
,
Rancher
Aug 12, 2017 08:06:58
'javac' is not recognized as an internal or external command,
Double Check that the PATH has the correct value. Look at the value shown in the command prompt window when the PATH command was entered.
Knute Snortum
,
Sheriff
staff
Aug 12, 2017 08:10:23
Okay, I was wrong. Your JAVA_HOME environment variable may not be set correctly. At the command prompt, type:
echo %JAVA_HOME%
Copy and paste the output here.
patson lawrence
,
Greenhorn
Aug 12, 2017 08:21:39
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_144\bin
C:\Windows\system32>
and beofre i forget, i now know how to copy from cmd prompt. thank you.
Pete Letkeman
,
Bartender
staff
Aug 12, 2017 08:28:01
Looking at the screen shot of the PATH output, the path does not seem to be correct.
Path=C:\Program Files\Java\jdk1\8.0_144\bin\bin
There appears to be one too many "bin "s in the path. The path should point to the directory where javac is located.
patson lawrence
,
Greenhorn
Aug 12, 2017 08:30:32
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>path
PATH=C:\Program Files\Java\jdk1.8.0_144\bin\bin;C:\ProgramData\Oracle\Java\javap
ath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\
WindowsPowerShell\v1.0\
C:\Windows\system32>
thats true; i can notice _144\bin\bin;
screen shot on variable settings attached
variable.PNG
Pete Letkeman
,
Bartender
staff
Aug 12, 2017 08:33:06
So if you remove the extra "bin" does you get and better/different results?
You may have to close the command prompt and open up a new one for the change to take affect.
patson lawrence
,
Greenhorn
Aug 12, 2017 08:45:26
thanks on that but
i have checked all the THREE fields; i cant find the double bin\bin...
variable.PNG
Pete Letkeman
,
Bartender
staff
Aug 12, 2017 08:51:18
I have
echo %JAVA_HOME%
C:\Program Files\Java\jre1.8.0_131\
You have
echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_144\bin
What if you change your JAVA_HOME value to remove the bin so that is looks like mine?
patson lawrence
,
Greenhorn
Aug 12, 2017 08:53:42
i change on user variables or system?
because i have %JAVA_HOME% in both fields.
thanks
Pete Letkeman
,
Bartender
staff
Aug 12, 2017 08:55:50
As soon as you update %JAVA_HOME% and remove "bin" all places that use that will be updated, you still may need to close the command prompt and open a new one.
Pete Letkeman
,
Bartender
staff
Aug 12, 2017 08:56:50
It's probably best to change all references as it only takes a few moments to do.
patson lawrence
,
Greenhorn
Aug 12, 2017 09:22:57
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>path
PATH=C:\Program Files\Java\jdk1.8.0_144\bin;C:\ProgramData\Oracle\Java\javapath;
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Wind
owsPowerShell\v1.0\
C:\Windows\system32>
path looks like this after removind the \bins on all the fields. thanks.. and then now am moving onto the
> cd C:\java\src
> javac MooseGreetings.java
patson lawrence
,
Greenhorn
Aug 12, 2017 09:27:49
CONGS!!!
thank you so much;
i appreciate the persistence; big ups.
in that folder i have now 5 files. am sure thats what i need to keep on track.
appreciated::
Pete Letkeman
,
Bartender
staff
Aug 12, 2017 09:31:51
Well I'm glad that you got this working and now you can get onto the "fun" and the "hard" parts with programming in Java.
patson lawrence
,
Greenhorn
Aug 12, 2017 09:39:07
I now got where to run to. thanks
But how did the elephant get like that? What did you do? I think all we can do now is read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com