Path problem

hi, I installed jdk1.6.0 on my daughter's laptop (windows vista) using the online installer, which put it in Program files.

So far, so good.

Set Path and Classpath, everything seemed fine. My daughter compiled and ran 'hello world' no probs.

I created a new directory for her java progs, and moved the .java and .class over.

The next day, we tried a new prog ('Ihatejava.java', heh), and suddenly it couldn't find javac....

After some messing about, discovered the new env. variables were missing (?)-at first i thought it was because of the new directory, but maybe not.

I have tried and tried to set the path variable BUT CAN'T GET IT TO WORK AGAIN. The original helloworld runs fine.

2 things i have noticed- i don't know the 'version' of jdk1.6.0 (this site advises you to put that in, do i need it? How do i find out what version?)

also, after searching and searching, javac.exe only seems to exist in another folder- c:\Program Files\Common Files\Update\Base Images\jdk1.6.0.b105\tools.zip\bin\javac.exe

update? what update? eh?

what is going on? a simple answer would be appreciated- I am NOT a programmer, just the only person around here who can ever manage to install stuff like this for some reason.....(well, up till now)

thanks

[1323 byte] By [monalisaaa] at [2007-11-26 22:23:10]
# 1

You would run this to get the current Java Versiom (JDK or JRE)

java -version

You JDK installed path should be something like

C:\Program Files\java\jdk1.6.0_XX (where XX is the update version)

You would find java.exe and javac.exe in

C:\Program Files\java\jdk1.6.0_XX\bin

Where is the last directory that your previous HelloWorld working ?

Where is the new directory that your new Java application not working ?

You javac not working because you probably have not set the environment setting probably.

Your last program worked because you put the program where the java and javac located or you temporarily set the environment setting.

Find out the java and javac located and set the environment setting in

Control Panel > System > Advanced > Environment Variable

You would find path

You should insert something like C:\j2sdk1.4.1_06\bin;

depends on the location of java and javac

rym82a at 2007-7-10 11:22:19 > top of Java-index,Java Essentials,New To Java...
# 2

hi,

thanks

ran java -version -I did try this before but maybe didn't understand

I get java version "1.6.0"

java <TM> SE Runtime Environment <build 1.6.0-b105>

etc

now i take it from your answer that i should be entering

C:\...\...\j2sdk1.4.1_06\bin;

not (as i have been) C:\....\...\jdk1.6.0\bin;

I assumed that j2sdk1.4.1 was a previous version, and didn't understand why it kept coming up on google searches about this problem.....

originally the .java and .class files were in 'documents', and the new file i made is C:\Users\....\boringstuff (sic), at the same level as documents, desktop etc.

cd boringstuff works fine, and dir always shows the files are there

I think the first time I didn't restart so the changes didn't stick (?), but repeating what i did (from a book) strangely gets no results. I have tried all sorts of alternatives found on the internet. Will try yours now and get back if it works or not.

oh, btw it confuses things that for some reason the bin file dosn't show up in the file list- i managed to find it with 'search' though (but no javac.exe?)

i wont worry about that if it works, tho.

monalisaaa at 2007-7-10 11:22:19 > top of Java-index,Java Essentials,New To Java...
# 3
well that didn't work:jdk1.6.0_06 mebbe?
monalisaaa at 2007-7-10 11:22:19 > top of Java-index,Java Essentials,New To Java...
# 4

tried that, and jdk1.6.0_01

no luck at all with any of these

I can't remember all the variations i have tried

on the sun installation instructions page it says <version> is the update version, and definately says jdk1.6.0_<version>

any more ideas would be welcome. I have to go to college soon, but will check again later.

(I managed to install version 5 on 2 different operating systems without much trouble, but there's a lot more info about that available cos its not so new)

monalisaaa at 2007-7-10 11:22:19 > top of Java-index,Java Essentials,New To Java...
# 5
First: Are you trying to compile or run the class?Second: Could you please copy and paste your environment variable (Path) for both user and system.
invokeLatera at 2007-7-10 11:22:19 > top of Java-index,Java Essentials,New To Java...
# 6

trying to compile (javac)

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Java\jdk1.6.0_06\bin

is what i have at the moment for 'path', although i originally had it at the beginning, and have tried several variations.

there are only 2 lines in user variables, and i havn't touched that, although i did wonder about it. There is no 'path' at all. Just 'temp' and 'tmp'.

i am thinking maybe i need to extract files from tools.zip, but i am confused as i did the online install and there don't seem to be any instructions about that (javac.exe is definately in there, but i don't seem to have it in Program Files\Java\jdk1.6.0....)

i just hit 'extract', and it wouldn't let me, so i thought i'd better ask before i do something *really* stupid. Perhaps extracting this stuff from the updates folder to eg c:\java\tools and setting path to c:\java\tools\bin might work

but i am hesitant because this dosn't explain why it worked in the first place, with just C:\...\...\java\jdk1.0.6\bin

MUST go to college now, thanks for your patience. back in a few hrs.

monalisaaa at 2007-7-10 11:22:19 > top of Java-index,Java Essentials,New To Java...
# 7

hi,

1 - Go to control panel and remove all JDKs (and JREs),

2 - Download JDK 1.6 from http://java.sun.com/javase/downloads/index.jsp

3 - Install the JDK. It's very simple. You have to click next when needed.

http://java.sun.com/javase/6/webnotes/install/jdk/install-windows.html

4 - Try the sample helloWrold example;

java_2006a at 2007-7-10 11:22:19 > top of Java-index,Java Essentials,New To Java...
# 8
as java_2006 said be sure you uninstall all the JDKs other than 1.6 if exist. then, please create a new path in the for the user and type:C:\Program Files\Java\jdk1.6.0_06\binthen log of computer and relogin and try again hope this works fine.
invokeLatera at 2007-7-10 11:22:19 > top of Java-index,Java Essentials,New To Java...
# 9

phew it's working again at last- thankyou all for your help.

for the benefit of anyone else who is stuck:

i think the problem was caused by my having installed JRE separately as well.

JDK definately had not installed properly, and the tools were missing. I took ALL of the java off, installed SE6, and (after trial and error) found that

PATH= C:\Program Files\Java\jdk1.6.0\bin;

works.

there was no need to put _06 and that didn't work. Red Herring.

There was also no need to put it in user variables- just system variables, at the beginning.

Thanks everybody : )

ps i would give out more stars, but i don't know how!

Message was edited by:

monalisaa

monalisaaa at 2007-7-10 11:22:19 > top of Java-index,Java Essentials,New To Java...