• Post Reply Bookmark Topic Watch Topic
  • New Topic

Update for Java (JDK) 8u11?  RSS feed

 
Neil Steinert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I'm very new to learning Java. Just started today!

I've been going through your program and I cannot get the "javac -version" to run correctly in the command prompt. I think it's because there is no 'javac.exe' in the latest JDK. Rather, there is a "javacpl.exe", but I wasn't able to get anything when typing in "javacpl -version" in the command prompt.

Could someone help me figure out the right way to do this with the current Java JDK version?

Thanks so much!!!

Neil
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what happens EXACTLY when you type "javac -version"?

 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure you installed the JDK and not the JRE ? javacpl is part of the JRE.
If you did install the JDK are you looking in the correct bin directory ? The JDK has a top level bin directory that doesn't include javacpl, but it also includes a JRE installation in the jre top level directory which also has a bin directory in it which includes javacpl.
 
Neil Steinert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Fred. Here's what happens in the command prompt.

First off, the prompt starts at "C:\Users\Neil>" when opened. I don't know how to get it to only "C:" so maybe that's a sign of super wet behind the ears? But when I type "javac -version" after that, I get:

"'javac' is not recognized as an internal or external command, operable program or batch file."

Joanne, I did download and install the "Java SE Development Kit 8u11".

Thanks for your help!

Neil
 
Neil Steinert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PS - I did also try typing into the command prompt "C:\Program Files\Java\jre8u11\bin javac -register and didn't get anything. Ah... I think I see the problem... let me check something...
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you understand the directory tree. So when you say "the prompt starts at "C:\Users\Neil>", that means you are on the C: drive, in the "Users" folder, and in the "Neil" folder under that.

To change directories on a command prompt, you can either type in the absolute directory you want to go to, or use the "relative" shortcuts. For example, you could type:

cd \Users\fred\working

and go straight there (assuming those folders exist). You have given the OS the full and complete path where you want to go. you could also use the ".." - which means "go up one level". So if you were sitting in the Neil directory, you could type:

cd ..\fred

That means "go up one level, then look for the fred folder, and go there"

if you want to get to the top level, you can just type

cd \

or from your Neil directory, you could type:

cd ..\..

which means "go up a level, then go up another level"
 
Neil Steinert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe I was pointing Environment Variables to the wrong directory. I did change those variables. I also was able to get to a C: prompt, but still I'm getting the same error with the 'javac -version'.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so...do you have a javac.exe program somewhere you want to run? That is really the first thing. On my computer, i have it here:

C:\Program Files (x86)\Java\jdk1.7.0\bin\javac.exe

once you find it, try running that:

\Program Files (x86)\Java\jdk1.7.0\bin\javac -version

If that works, then you need to look at your PATH environment variable.

edit: once you changed your environment variables, did you open a new cmd window? any open one will NOT pick up changes.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neil Steinert wrote:But when I type "javac -version" after that, I get:

"'javac' is not recognized as an internal or external command, operable program or batch file."

In that case your PATH environment variable is not set up correctly.
Type
echo %PATH%
in the command prompt and make sure your JDK bin directory appears in it correctly.

Neil Steinert wrote:PS - I did also try typing into the command prompt "C:\Program Files\Java\jre8u11\bin javac -register and didn't get anything. Ah... I think I see the problem... let me check something...

Why did you try that ? The name of the directory would suggest it's the JRE that is installed and not the JDK. What was the name of the installation program you used ?
 
Neil Steinert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My command prompt looks like this "C:\>" How do I get rid of the >?

I did type in \Program Files\Java\jdk1.8.0_11\bin\javac -version and as a reply, I received

'Program' is not recognized as an internal or external command...
 
Joanne Neal
Rancher
Posts: 3742
16
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neil Steinert wrote:My command prompt looks like this "C:\>" How do I get rid of the >?

You don't need to. It's part of the prompt.

Neil Steinert wrote:I did type in \Program Files\Java\jdk1.8.0_11\bin\javac -version and as a reply, I received

'Program' is not recognized as an internal or external command...

It's the space in the directory name that's causing that problem.
Try putting it in quotes
"\Program Files\Java\jdk1.8.0_11\bin\javac" -version

If that works (and it should), check that
C:\Program Files\Java\jdk1.8.0_11\bin
appears in the PATH environment variable as I showed you in my last post.
 
Neil Steinert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Joanne! That worked, but why the quotes??? I didn't see that tip mentioned anywhere.

The reply back I received on the command prompt was "javac 1.8.0_11"

 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neil Steinert wrote:Thanks Joanne! That worked, but why the quotes??? I didn't see that tip mentioned anywhere.

In the original version of DOS (the forerunner of Windows if you're too young to remember), all file names had a 8.3 format : 1 - 8 characters followed by a '.' followed by 0 - 3 more characters and spaces were not allowed.
When spaces were finally allowed in file names (Windows 3.1 I think), the command prompt still sometimes got confused by spaces and you had to enclose the whole name in quotes. There are still times when it gets confused.
 
Neil Steinert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again for your help. And for future reference, I have to type out the entire directory each time in the command prompt?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you just need to set up the PATH environment variable so it points to that directory: http://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html#path
 
Neil Steinert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow! Now trouble with the first lesson 'MooseGreeting.java'

I type into the command prompt (and I am typing in the quotation marks) "\Program Files\Java\JavaWork" MooseGreetings.java
and I'm getting back
'"\Program Files\Java\JavaWork"' is not recognized as an internal...

 
Neil Steinert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More clarification...
I did get the command prompt to the correct directory (Program Files\Java\JavaWork) but when I type in javac MooseGreetings.java
'javac' is not recognized...

Geeze!
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's because "\Program Files\Java\JavaWork" is not a program.

Basically, what you are typing in is a program name, and arguments to that program. So, you need to compile your file. You need to run the java compiler, which is the javac program. And you need to pass that your file name.

So, you should be able to do something like this:

"\Program Files\Java\jdk1.8.0_11\bin\javac" "\Program Files\Java\JavaWork\MooseGreetings.java"

that says "run the javac program found in the \Program Files\Java\jdk1.8.0_11\bin directory, and pass it the file MooseGreetings.java found in \Program Files\Java\JavaWork".

(Note: I think that is the correct syntax)

If this works, we can see about configuring things to make what you have to type simpler.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right - you need to set the PATH, as described in the link I posted.

You may also find this interesting: http://www.coderanch.com/how-to/java/how-to-create-java-program
 
Neil Steinert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:That's because "\Program Files\Java\JavaWork" is not a program.

Basically, what you are typing in is a program name, and arguments to that program. So, you need to compile your file. You need to run the java compiler, which is the javac program. And you need to pass that your file name.

So, you should be able to do something like this:

"\Program Files\Java\jdk1.8.0_11\bin\javac" "\Program Files\Java\JavaWork\MooseGreetings.java"

that says "run the javac program found in the \Program Files\Java\jdk1.8.0_11\bin directory, and pass it the file MooseGreetings.java found in \Program Files\Java\JavaWork".

(Note: I think that is the correct syntax)

If this works, we can see about configuring things to make what you have to type simpler.


Thanks Fred. That worked and I was able to get the next part of the lesson to work as well, i.e. the file MooseGreetings.class was created and I did get the mooooooo response in the command prompt. So yes, how to configure for simpler typing?

Also, when setting the Path, should I put the quotation marks in since it didn't recognize Program Files in the command prompt without the quotation marks? Also, should I rename Path to PATH?
 
Neil Steinert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Right - you need to set the PATH, as described in the link I posted.

You may also find this interesting: http://www.coderanch.com/how-to/java/how-to-create-java-program


Hi Ulf.

This is exactly what I'm working on, which is what is generating all of my questions
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neil Steinert wrote:Thanks Fred. That worked and I was able to get the next part of the lesson to work as well, i.e. the file MooseGreetings.class was created and I did get the mooooooo response in the command prompt. So yes, how to configure for simpler typing?

Also, when setting the Path, should I put the quotation marks in since it didn't recognize Program Files in the command prompt without the quotation marks? Also, should I rename Path to PATH?

You probably already had a PATH set. Windows is case insensitive, so it probably doesn't matter, but I"m not sure.

When you set/update the PATH environment variable, you should probably mimic how all the other directories are set. I don't believe you need quotes there, but again, I'm not sure.

Are you setting it by following the instructions in Ulf's link, or by some other method?

 
Neil Steinert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:
Neil Steinert wrote:Thanks Fred. That worked and I was able to get the next part of the lesson to work as well, i.e. the file MooseGreetings.class was created and I did get the mooooooo response in the command prompt. So yes, how to configure for simpler typing?

Also, when setting the Path, should I put the quotation marks in since it didn't recognize Program Files in the command prompt without the quotation marks? Also, should I rename Path to PATH?

You probably already had a PATH set. Windows is case insensitive, so it probably doesn't matter, but I"m not sure.

When you set/update the PATH environment variable, you should probably mimic how all the other directories are set. I don't believe you need quotes there, but again, I'm not sure.

Are you setting it by following the instructions in Ulf's link, or by some other method?



I'm following the instructions via the link Ulf posted. However, I only got the code to work when I put the quotations in as Joanne wrote below so that's why I'm wondering if I should put quotation marks in the Path.

Joanne Neal wrote:
It's the space in the directory name that's causing that problem.
Try putting it in quotes
"\Program Files\Java\jdk1.8.0_11\bin\javac" -version

If that works (and it should), check that
C:\Program Files\Java\jdk1.8.0_11\bin
appears in the PATH environment variable as I showed you in my last post.
 
Neil Steinert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry for all the back and forth, but I appreciate your help and patience!! So looks like I do not need quotation marks in the Path as no other entries have quotation marks. So how to shorten the directory part of typing in the command prompt? Thanks so much!!
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neil Steinert wrote:I'm sorry for all the back and forth, but I appreciate your help and patience!! So looks like I do not need quotation marks in the Path as no other entries have quotation marks. So how to shorten the directory part of typing in the command prompt? Thanks so much!!


If you did the PATH correctly, then you don't need to type the directory path at all. Otherwise, other options are the use of symlinks or batch files.

Regardless, all of this is related to Windows itself, and not related to Java. Perhaps, it would be a good idea to start with a good tutorial on windows? I don't have a good recommendation though.

Henry

 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At least you got it sorted out

Another thing: don't put your work in the program files directory. Make your own directory as described here.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the PATH variable is used by the operating system to find executables. When you type something like "dir" or "javac" on the command line, the OS looks in all the directories listed in your PATH variable until it finds the program, or runs out of places to look. So, if you get the "\program files\java\jdk1.8.0_11\bin" in your path, then any new cmd window you open will know that no matter what directory you are sitting in, it should look in that directory. You can then be anywhere, type "javac" and the OS should find it.

That is how you shorten part of the command.

Then, when compiling, you need to give the javac program the file you want to compile. The easiest way to do this is to cd into the directory where your .java file is:

cd "\Program Files\Java\JavaWork"

you should then be able to do a "dir MooseGreetings.java" and see your file.

IF all the above holds true, you should then be able to type

javac MooseGreetings.java

and your program should compile.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!