I just finished doing the Head First HTML, XHTML, and CSS book and i also got the Head First Java 2nd edition book. i didnt have any trouble with the xhtml book but im having problems getting this java one to work. I think i have narrowed it down to not have the classpath set to the right folder/s. I have Java and the JDk installed to C:\Java\bin and the folder with my .java and .class files in C:\Users\....\Desktop\JavaWork . now i managed to get it 1 of the .java files i made from reading the HF book into a .class file by moving the folder into the Java folder. but that shouldnt be right either from what i have read on here + on the Java Sun website. Also im on 64bit vista if that makes any difference. Thanks in advance for the help!
Jason Martin wrote:I just finished doing the Head First HTML, XHTML, and CSS book and i also got the Head First Java 2nd edition book. i didnt have any trouble with the xhtml book but im having problems getting this java one to work. I think i have narrowed it down to not have the classpath set to the right folder/s. I have Java and the JDk installed to C:\Java\bin and the folder with my .java and .class files in C:\Users\....\Desktop\JavaWork . now i managed to get it 1 of the .java files i made from reading the HF book into a .class file by moving the folder into the Java folder. but that shouldnt be right either from what i have read on here + on the Java Sun website. Also im on 64bit vista if that makes any difference. Thanks in advance for the help!
first you don't have to set the classpath for your source files. in a dos window go to the directory which has your .java files run javac file.java I am guessing you don't have your files in a package?? next run your execute the class file accordingly java -cp . filename
mk so i run CMD as an admin than set the directory to the javac file? and package such as inside a folder? and to run the .class file i have to type in java -cp(do i just type -cp in? or the C:\etc\etc than the actual file?) . HelloWorldApp ? first time trying to learn programing so sorry if i dont understand it all.
you can say java -cp . classname or you can put java -cp c:\whatever.classes classname the '.' refers to the current directory in which you are located so if you type cd .. at the dos prompt you will go up a directory if you type cd . then you stay in the same directory
Adam LaFaye wrote:you have to type set path=%PATH%;.;c:\java\bin 'enter'
ah k that makes it work! /cheer 6 days of trying to fix this on my own and something as simple as that fixes it Hmm they should think about adding that to the Head First Java book or put it in a read me with the downloadable files for the book. Couldnt find it on Java's site either. they just say you need to change the path but dont tell you how to change it
Adam LaFaye wrote:recommend download eclipse ganymede and create java applications in it. then choose server runas applications it will do all the pathing for you
:O where can i find it? also is it free? Iv got Adobe Creative Suite 4 btw if theres any programs in it that work with this.