• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

downloading proper programs

 
Greenhorn
Posts: 10
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im just getting started, at the very beginning. Im 61 yr truck driver who lost work because I am now medically unable to continue as a truck driver pretty much bound to the house. My daughter suggested learning Java as something I could do from home. Without going into detail of my computer background years ago I built web sites by writing my own HTML. This was before css. I served in Iraq as a civilian truck driver who eventually took over running a 200 printer network and used MS Excel and VBA to monitor those printers. Now I did not write the VBA I used Excels MACROS to memorize my keystrokes and when I needed help making a macro do something then used Excel forums to adjust the macros. So it was all copy and paste stuff not actually writing the code that would be needed. To my credit I was able to see how I could use Excel to improve the maintenance and servicing of these printers. I eventually built a program (with the help of many Excel experts) that download every night all the information I needed every day.

The network always had about 15% of the printers going down every day. After I started using my program; over time we got 99% up and on line. So I was pretty happy with what I had put together. I pointed that out because I'm not stupid when it comes to computers and such but everything I have learned I taught myself I have no formal schooling in IT stuff.

Now on the advice of others I downloaded and installed Eclipse and Note ++, getting into those programs I could see the learning curve was going to be steep. Decided to buy Java Head First and join here. Which suggested first that I learn to write my Java on a simple text editor like Note Pad. I felt this was best in that I was writing the code line by line and that this approach would be best vs also having to learn how to use a program that writes a lot of the code for you.

That brings me to my question, I have downloaded and installed JXP, JRE SE 7.0 & JDK SE 8.0. The book Java Head First tells me I need Java 2 SDK? I am using Windows 7 64 bit and need to know do I need to go back to SUN and look for Java 2 and uninstall the java I have already installed?

Sorry about the long post but thought that since this was my first post it might help if everyone had some understanding of how much I actually know which is pretty much nothing.

Thank you.
 
Rancher
Posts: 5008
38
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The book Java Head First tells me I need Java 2 SDK?


That is the old way to describe java versions.  How old is the book?

JDK 8 is the current version.  You shouldn't need any more than that for developing java programs.  Setting the PATH environment variable to include the path to the JDK's bin folder will make using the JDK's tools easier.
Or write some batch files that have the full path to the tool you want.  For example on  my system, I use this command line to execute the javac program:
C:\Program Files\Java\jdk1.8.0_60\bin\javac.exe -cp . -Xlint -Xdiags:verbose TestCode22.java
 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

When you set your PATH, make sure the JDK8 appears first; you can get problems with a JDK having a version number more recent than the JRE. Norm is right; you only need the JDK. You might do well to get a decent text editor too; my favourite if I use Windows® is Notepad++. Don't use Microsoft NotePad.
 
Ken Logan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I went to system, advanced environmental variables and added this path:  C:\Program Files\Java\jdk1.8.0_102\bin  does this appear to be correct?
 
Norm Radder
Rancher
Posts: 5008
38
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It can be tested:  Open a command prompt window and enter: javac
See if the OS finds the program and the program responds with an info message.
Or the OS gives a message saying it can not find javac

Also enter: PATH in the command prompt window to see what values are on the PATH varible.
 
Campbell Ritchie
Marshal
Posts: 79153
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ken Logan wrote:. . .  C:\Program Files\Java\jdk1.8.0_102\bin . . .

That looks correct as part of the PATH, yes. Try the following commands and see whether you get a sensible response, with version numbers:-
java -version
javac -version

The first instruction usually produces about 3 lines of output.
 
Ken Logan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like path is correct as it returned proper version. See screen shot. Thank you, guess I am ready to learn how to write Hello World
javac-version-screenshot.jpg
[Thumbnail for javac-version-screenshot.jpg]
 
Campbell Ritchie
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ken Logan wrote:It looks like path is correct as it returned proper version. See screen shot. . . .

Please don't use screenshots, which can be difficult to read.

Unfortunately that screenshot shows you have not set your PATH correctly. You have a javac version newer than the java version, and your programs won't run. That is probably caused by there being a java installation with an older version in some part of the PATH, and if so, the solution is to move the part of the PATH which you have just set up to the beginning of the PATH.
BTW: are you helping a friend set up her computer?
 
Ken Logan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have written this comment three times and I can tell I am confused, I have a one Java folder and in that folder is the JDK and the JRE, the version numbers we are looking at here..

C:\Users\Ken>java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

C:\Users\Ken>javac -version
javac 1.8.0_102

Java and Javac are different do they need to be matching?

Learned how to copy and paste from the CDM so you won't see any more screen shots. This laptop I am using is my GF's old laptop. My 4000 custom pride and joy was stolen  when I was in Iraq, so I am using this little HP she gave me for now spent time going in and changing the profile folder name so it reads as me now, I new you saw that Tracy Buck and wondered.
 
Ken Logan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
meant to say 4000 dollar custom laptop I had built.
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Java and Javac are different do they need to be matching?  


They do.  Can you get to a command line and type

where java

I suspect you will get two entries in return, something like this:

The path that has "jdk1.8.0_112" in it is the one you want.  This means the other path (in this case, "C:\ProgramData\Oracle\Java\javapath") needs to be removed from your PATH environment variable.
 
Greenhorn
Posts: 8
1
Netscape Windows Vista Notepad
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At the beginning the many JDK and JRE versions, folders and 32/64 bit variants confused the hell out of me so I uninstalled all Java versions and installed just the latest JDK in a custom directory. In my case that was C:\java\64\<jdk-version>.

As others already have mentioned the order of the entries in PATH is important (see the screenshot). Your prefered JDK should be above the entry "Oracle\Java\javapath" and above all other Java versions, because the Windows shell (cmd and ps) looks for commands from top to bottom like in Linux until it finds a match. Its lazy and just takes the first Java it can find.

Right now you are using Java 7 to run code that you prepared with Java 8. That might cause problems because Java 7 lacks quite a few features from Java 8. Someone mentioned you could post us your PATH environment variable. That might help. Just open cmd and write "path" ("$env:path" in powershell) or press Win+PAUSE -> Advanced -> Environment Variables...
path.PNG
[Thumbnail for path.PNG]
Path order
 
Campbell Ritchie
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:. . .  This means the other path (in this case, "C:\ProgramData\Oracle\Java\javapath") needs to be removed from your PATH environment variable.

I would only remove a PATH component if I am sure there is nothing wanted in it. It safer to move the PATH with 1.8.0_102 earlier in the whole PATH environment variable.
 
Campbell Ritchie
Marshal
Posts: 79153
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mat Falk wrote:. . .  the order of the entries in PATH is important (see the screenshot). Your prefered JDK should be above the entry "Oracle\Java\javapath" and above all other Java versions . . .

Right now you are using Java 7 to run code that you prepared with Java 8. That might cause problems because Java 7 lacks quite a few features from Java 8.

There is no “might” about it. The .class files have a number towards their start which records their version number and the Java7 JVM will throw an Exception if presented with Java8 .class files.

Someone mentioned you could post us your PATH environment variable. That might help. . . .

Probably quicker to write
echo %PATH%
at the command line. Use the techniques here for copying from the command line.
 
Ken Logan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand what it is i need to do but having trouble doing it. I went back to environment variables and deleted my path, did restart. Went and got the path to my 8.0 JDK bin. Right click copy as address: C:\Program Files\Java\jdk1.8.0_102\bin. Went back to environment variables click NEW paste the path, click ok, next window click ok...NEXT Window  there is the apply button but it is not high lighted for me to APPLY, I think that is the problem. I don't understand why it is not high lighted because I added a veritable. Clicked ok anyway. Closed out did restart, but this is what I am left with, its looking at the ORACLE jre in the system32.

C:\Users\Ken>where java
C:\Windows\System32\java.exe

C:\Users\Ken>java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

C:\Users\Ken>javac -version
'javac' is not recognized as an internal or external command,
operable program or batch file.

It should have asked me to apply? In the Environment Variables you have USER and SYSTEM variables, I put it in USER. I also tried putting the path in both, and tried just placing it in SYSTEM. In the name box I am typing < java > as the name not < javac >. I can't get the system to ask me to apply.

 
Mat Falk
Greenhorn
Posts: 8
1
Netscape Windows Vista Notepad
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Uhh.. you deleted PATH? You created a new variable? You put java.exe into System32?

Better show us your "echo %PATH%" from the cmd shell before continuing. I think something went wrong.

Usually there is a PATH environment variable already and you just have to edit it. In Windows 7 you do this by adding an entry into the PATH variable list (go to Properties of Computer or press Win+PAUSE and then go to Advanced -> click on Enviroment Variables -> select PATH entry-> click Edit). The entries are separated by ';' and are loaded from left to right.

When you echo %PATH% you can see what is currently in the PATH variable. For me it looks like this:

C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\java\64\jdk1.8.0_112\bin;C:\Program Files\Docker\Docker\Resources\bin;C:\python\64\python3.5.2\Scripts\;C:\python\64\python3.5.2\;C:\ProgramData\Oracle\Java\javapath;C:\cygwin32\bin;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\php\7.0.11\;C:\lua\32\5.1.5;C:\lua\32\5.1.5\clibs;C:\nodejs\64\node-6\;C:\ProgramData\ComposerSetup\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\OpenVPN\bin;C:\Program Files (x86)\GNU\GnuPG\pub;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\wbin;C:\Program Files (x86)\Common Files\Acronis\VirtualFile\;C:\Program Files (x86)\Common Files\Acronis\VirtualFile64\;C:\Program Files (x86)\Paragon Software\Paragon ExtFS for Windows;C:\Program Files (x86)\Skype\Phone\;C:\ruby\64\ruby2.3.1\bin;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Mat\AppData\Local\Microsoft\WindowsApps;C:\Users\Mat\AppData\Roaming\Composer\vendor\bin;C:\Users\Mat\AppData\Roaming\npm



This results in:


And Java versions:

 
Ken Logan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
C:\Users\Ken>echo %PATH%
C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows
Live;C:\Program Files (x86)\HP SimplePass 2011\;C:\Program Files\Broadcom\Broadcom 802.11\Driver;;C:\Windows\system32;C
:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Share
d;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files\Bro
adcom\WHL\;C:\Program Files\Broadcom\WHL\syswow64;C:\Program Files\Broadcom\WHL\SysWow64\;C:\Program Files\Broadcom\WHL\
SysWow64\syswow64;C:\Program Files (x86)\Intel\Services\IPT\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files
(x86)\Skype\Phone\

C:\Users\Ken>

I am guessing these are all the programs set to use java?

I did not delete the Oracle path that comes with the computer it still exists, C:\ProgramData\Oracle\Java\.oracle_jre_usage, when I installed IDE it said gp get the latest JDK install that and then add the path to that bin, so when I went to Environment Variables for the first time this is what was in the USER variables:

C:\ProgramData\Oracle\Java\.oracle_jre_usage
C:\ProgramData\Oracle\Java\.oracle_jre_usage, woah nellly.... this is so confusing, I have been looking for the Oracle jre path and it does not appear in the window. What I see in the window is this. The lines say %USERPROFILE%..... I didn't know this was the Oracle jre path untill just now when I copied and pasted it, now it says C:\Program.... and I can see that is the path you have been talking about. Ok so this is what was in the window before I added my path which was    C:\Program Files\Java\jdk1.8.0_102\bin. If I go to CONTROL PANNEL and open the java Icon and then select the java tab and then view, this path will be there and there is a check box on right telling the computer use this path, when I add my path it never appears here. If it did all I would have to do is check my path and uncheck the current path and it would use the jre from my new 8.0 jdk..... I am guessing at all this because I don't know but that is the way it appears. When I try to add my path in the EV it never makes the APPLY button available.
scrrenshot-EV-pre-adding-new-path.jpg
[Thumbnail for scrrenshot-EV-pre-adding-new-path.jpg]
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ken Logan wrote:C:\Users\Ken>echo %PATH%
C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows
Live;C:\Program Files (x86)\HP SimplePass 2011\;C:\Program Files\Broadcom\Broadcom 802.11\Driver;;C:\Windows\system32;C
:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Share
d;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files\Bro
adcom\WHL\;C:\Program Files\Broadcom\WHL\syswow64;C:\Program Files\Broadcom\WHL\SysWow64\;C:\Program Files\Broadcom\WHL\
SysWow64\syswow64;C:\Program Files (x86)\Intel\Services\IPT\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files
(x86)\Skype\Phone\


I don't see anything about Java in there.


I am guessing these are all the programs set to use java?


No, PATH is a system environment variable that controls what gets executed on your entire computer.


I did not delete the Oracle path that comes with the computer it still exists, C:\ProgramData\Oracle\Java\.oracle_jre_usage, when I installed IDE it said gp get the latest JDK install that and then add the path to that bin, so when I went to Environment Variables for the first time this is what was in the USER variables:

C:\ProgramData\Oracle\Java\.oracle_jre_usage
C:\ProgramData\Oracle\Java\.oracle_jre_usage, woah nellly.... this is so confusing,


I'm confused too.  Was that in the User PATH variable?  I have no idea why.


I have been looking for the Oracle jre path and it does not appear in the window. What I see in the window is this. The lines say %USERPROFILE%..... I didn't know this was the Oracle jre path untill just now when I copied and pasted it,


USERPROFILE doesn't have anything to do with Java AFAIK.  If it has the JDK or JRE path in it, that's just coincidence.


now it says C:\Program.... and I can see that is the path you have been talking about. Ok so this is what was in the window before I added my path which was    C:\Program Files\Java\jdk1.8.0_102\bin. If I go to CONTROL PANNEL and open the java Icon and then select the java tab and then view, this path will be there and there is a check box on right telling the computer use this path, when I add my path it never appears here. If it did all I would have to do is check my path and uncheck the current path and it would use the jre from my new 8.0 jdk..... I am guessing at all this because I don't know but that is the way it appears. When I try to add my path in the EV it never makes the APPLY button available.


Please be careful when you are tweaking system settings; you can make your PC unusable.  I don't think anyone on the forum told you to go into the Java Control Panel -- you're on your own there.

Please go to this page and look for where it says "Setting the JAVA_HOME and PATH environment variables".  Follow those directions.
 
Ken Logan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok I wil do that now, I think you misunderstood. I started out downloading IDE and was using the tutorial that comes with it, that is what I was following to set the path. I was not apart of this forum. Trying to use IDE and learn java at same time I thought was too much. That's when I joined this forum and started all over.
 
Campbell Ritchie
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at the Java™ Tutorials, too.
I see you have a CLASSPATH set, too. It is usually a bad idea to set a CLASSPATH, but QuickTime appears to have done that for you. That sometimes causes problems, but you have .; (=current directory) prepended to that CLASSPATH, and the .; will probably correct any problems.
 
Ken Logan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I apologize for disappearing, I had a family emergency had to travel to fix things and it took me a month to do it. So got back yesterday. things got very screwed up, it got to the point where I could not get Java to download and install correctly. It would just hang and never finish the install. So I nuked my puter and did a fresh install of Windows 7, actually this is my GF's laptop mine was stolen its 9 years old and I have never really gone through and put everything in order. So I have done that now, its bare bones  laptop right now and I pretty plan to keep it that way. So went to download latest Java and see if I could get it to install and set the Path, here is what I have it looks to me like everything is working and installed correctly and I can begin to learn.

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Ken>where java
C:\ProgramData\Oracle\Java\javapath\java.exe
C:\Program Files\Java\jdk1.8.0_111\bin\java.exe

C:\Users\Ken>java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

C:\Users\Ken>javac -version
javac 1.8.0_111

C:\Users\Ken>javac
Usage: javac <options> <source files>
where possible options include:



Please tell me I finally have this right

 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks good to me: the java and javac commands are working, you're getting output from them. So I'd say you're good to go.
 
Ken Logan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you.
 
reply
    Bookmark Topic Watch Topic
  • New Topic