Java Help

airbornflghtairbornflght Houston, TX Icrontian
edited July 2006 in Internet & Media
Ok, I am taking AP comp sci, and she gave us some homework to do over the summer. Now, I am trying to code these two redicuosly easy programs, but my computer will not compile them.:honoes:


I have sent an email to my instructor, but it may be a few days before she checks her email. anyway, I have attached the same pdf here that I sent her. Hopefully we can figure this out. I thought these two would be 2 minutes of typing, compile, execute, done.:sad2:

Comments

  • airbornflghtairbornflght Houston, TX Icrontian
    edited July 2006
    No java gurus?
  • edited July 2006
    looks like a classpath problem. where do you have all these files stored? what are you using to compile? are you usig a big ide or notepad and command line? what do your environment variables look like?
  • airbornflghtairbornflght Houston, TX Icrontian
    edited July 2006
    I am using JCreator IDE, other than that, I have no f'ing clue, it is just the program she said to download, because it is what we will use in class, and she wanted us to get used to it/be able to code at home on the same intergace.

    I installed everything like she said to, I installed the sdk, then the ide. that is all I did, it installed in the default directory.
  • edited July 2006
    i'm not entirely familiar with jcreator, i use eclipse or vi depending on what i'm doing. if they had a mac version of jcreator i'd d/l it and look it over.... but anyways, there are some things that you'll need to do to get your stuff to compile.

    from java.sun.com:
    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.


    also make sure the current directory is on the path, so after you put in an entry for your java installation put in a semi-colon followed by a period.

    you'll also want to set a JAVA_HOME variable while you are there. set it to the install directory of the jdk, for instance if i installed java in c:\j2sdk1.5
    i'd set JAVA_HOME=c:\j2sdk1.5

    set these env variables and give it another shot. if they still wont compile, you might have used the 'import' declaration improperly.


    usually you have to put the full package and class name, like if i had a class called com.lightnin.io.FileReader, i'd have to say 'import com.lightnin.io.FileReader;' in order to use it. i'd also have to have that class either on my classpath or residing in a folder called ./com/lightnin/io/

    your stuff wont compile because the compiler isn't 'seeing' the files you want to import. so either you have a classpath problem, or your files arent located in the right place.

    you might want to read over this brief tutorial:
    http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html
  • edited July 2006
    any luck?
  • airbornflghtairbornflght Houston, TX Icrontian
    edited July 2006
    yeh, my teacher emailed me last night, she gave me a link to our book publishers site with all the includes that I will need, she said she forgot to put it on the handout. So now Im all good, it was what you said it was.
Sign In or Register to comment.