File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes how do I find out what version? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how do I find out what version?" Watch "how do I find out what version?" New topic
Author

how do I find out what version?

Davy Kelly
Ranch Hand

Joined: Jan 12, 2004
Posts: 384
Hey there everyone,

God I have not been here in ages. probably because I was working and trying to learn some new skills, but hey, I am back.

I have not played with java in a while, and I have a new computer, becasue old one blew up.

I am trying to get back into it, and make a portfolio up.

anyway, because I needed to install java, I decided to go for the jdk1.5.0 but I was wanting to get the PATH varaible set on my windows XP machine, but the Sun website says to include the <version> e.g.

C:\Program Files\Java\jdk1.5.0_<version>\bin

how do I find this out?

All my files like bin, demo, include,lib etc are in folder
C:\Program Files\Java\jdk1.5.0

I want to set this cause I am having a bad time compiling even thet most basic of programs, "HelloWorld.java"

Davy


How simple does it have to be???
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
there is nothing you need to add. It's 1.5.0, nothing more nothing less.
The _xx are added for maintenance releases too small to warrant a change in minor version number (other companies would call them a.b.c.xx instead of Sun's a.b.c_xx).


42
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
What problems are you encountering when trying to compile HelloWorld.java ?
Is your PATH variable set up to point at C:\Program Files\Java\jdk1.5.0\bin ?

There is no need to rename your jdk1.5.0 directory, but if you really want to know which build you are using type java -version on the command prompt
Davy Kelly
Ranch Hand

Joined: Jan 12, 2004
Posts: 384
thanks,

I got some information from this page
http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html
in the error part half way down the page.

Basically, I cannot compile any java source file but I can run class files.

Do I have to put my code files in the bin folder?
The last version of java I had was 1.3 and it worked fine, I did not have to have the files in the bin folder.

Davy

Edited
this is my path:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Progam Files\java\jdk1.5.0\bin;

Do I have to change C to %SystemRoot% ?

[ October 05, 2004: Message edited by: Davy Kelly ]
[ October 05, 2004: Message edited by: Davy Kelly ]
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
No, your code can be anywhere you want it to be stored on the system.
I noticed a misspelling of the word program in your path:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Progam Files\java\jdk1.5.0\bin;

If you correct the spelling and reset your path can you compile your code?
Once your path is correct you should be able to call javac -version to ensure that you can communicate with the compiler.
Davy Kelly
Ranch Hand

Joined: Jan 12, 2004
Posts: 384
nigel,

thaks, but it did not work, it was just a typo on my part for this site only.

I have noticed that I have to put the java source code file in the bin file, compile it then I can move it to where I want I can run it from anywhere, but I need to compile it in the bin.

this is more hassel than the old 1.3

I get the error:
'javac' is not recognized as an internal or external command, operable program or batch file.

or if I got the command prompt in the bin, but source file is not, then it cannot read the file.

any ideas.

Davy
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
I still don't think you PATH variable is set correctly what is the output when you type: echo %PATH% in the command prompt ?
How are you setting the PATH variable ? The easiest way in windows is to go:
Control Panel : System : Advanced tab : Environment Variables and then edit the System variable PATH.
Once the variable is set start a new command prompt and type javac -version
to test that everything is set up correctly.
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 805
You can also navigate in Windows Explorer to your JDK's bin path, copy the location from the address box, then paste it into the environment variable editor in your System control panel, either by editing the path statement or by adding your own path statement. Using this method removes the possibility of hard-to-see typos.

Good luck!


Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
Davy Kelly
Ranch Hand

Joined: Jan 12, 2004
Posts: 384
I used Jeff Bosch's solution, which worked a treat.
quote from Sun Microsystems java 1.5.0 installation notes:

Microsoft Windows NT, 2000, and XP - To set the PATH permanently:

1. Choose Start, Settings, Control Panel, and double-click System. On Microsoft Windows NT, select the Environment tab; on Microsoft Windows 2000 select the Advanced tab and then Environment Variables. Look for "Path" in the User Variables and System Variables. If you're not sure where to add the path, add it to the right end of the "Path" in the User Variables. A typical value for PATH is:

C:\Program Files\Java\jdk1.5.0_<version>\bin

Capitalization doesn't matter. Click "Set", "OK" or "Apply".

The PATH can be a series of directories separated by semi-colons ( . Microsoft Windows looks for programs in the PATH directories in order, from left to right. You should only have one bin directory for a JDK in the path at a time (those following the first are ignored), so if one is already present, you can update it to jdk1.5.0_<version>\bin.

2. The new path takes effect in each new Command Prompt window you open after setting the PATH variable.


I found out that the problem was the fact that I did not use a capital J in the for the folder Java, this is my new path:
C:\Program Files\Java\jdk1.5.0\bin

It works now, the only problem I have now, is that some of my old programs, are deprecated, because I learned java 1.2.

So I guess it's back to the drawing board and get my bum in ghear and start to read the 1.5 documentation.

cheers guys

Davy
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 805
Your welcome!

You can also compile your old programs to a specific version level and disable depracation warnings. Rewriting to meet the new specs would be good practice though!
Davy Kelly
Ranch Hand

Joined: Jan 12, 2004
Posts: 384
I will maybe upgrade the coding some other time, I am going to write a program for my brother , if he uses it is another matter, but it can be put on a portfolio, and I will go through the API and documentation of 1.5

cheers again.

Davy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how do I find out what version?