Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2010
    Location
    Singapore
    Posts
    3
    Rep Power
    0

    Default Confusion here @@' Help!

    My assignment requires me to write a Java computer program that plays a word game called FindYourWords via eclipse

    So far my codes are progressing pretty well, but I am stuck in one of ther criteria given here: :(

    To check that a word is valid, the computer program must read and store a list of valid words from a text file. The Java code to read words from a text file into string array is given in dictionary.jar. The computer program will use it for comparing with words formed by each player.

    The assignment also provides this for me:
    Java codes
    String dict[] = FileUtil.readDictFromFile("words.txt");


    However I have no idea which file to import my Class's src =( and when I import the file that was provided in the assignment there is error in it.. like this: "Source not found, etc etc etc"

    Any kind souls out there can help me understanding what's the criteria all about to check if the input word is valid :(?

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,379
    Blog Entries
    7
    Rep Power
    20

    Default

    You have to put that dictionary.jar file on your classpath; both for your compiler and java.exe itself so your compiler won't whine when it sees the class name FileUtil and your java virtual machine won't protest when it has to execute a method from that class.

    kind regards,

    Jos

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    "Source not found
    Is that message from the eclipse program or from javac?

    Please copy and paste full text of any error messages here.

  4. #4
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    5

    Default

    Quote Originally Posted by pleasurelyours View Post
    The assignment also provides this for me:
    Java codes
    String dict[] = FileUtil.readDictFromFile("words.txt");

    never seen the class FileUtil nor the method readDictFromFile but what you can try to call the method with path + file, example for windows systems "c:\\mydirs\\mysubdirs\\word.txt"

  5. #5
    Join Date
    Jun 2010
    Location
    Singapore
    Posts
    3
    Rep Power
    0

    Default

    I was provided with these files during my assignment:

    FileUtil.class (CLASS File)
    words (Text Document)
    dictionarry (.jar)

    I imported both FileUtil.class (CLASS File) & dictionarry (.jar) into my Eclispe Assignment src and I am stucked at there.

    For the error in opening the FileUtil.class (CLASS File) in Eclipse is:

    Source not found
    There is no source file attached to the class file FileUtil.class.

  6. #6
    Join Date
    Jun 2010
    Location
    Singapore
    Posts
    3
    Rep Power
    0

    Default

    Hi all,

    I managed to successfully imported my Jar file in Eclipse via this helpful website here:

    http://www.cs.umd.edu/class/fall2005.../advanced.html

    However I am still stuck at the error via opening the FileUtil.class (CLASS File) in Eclipse is:

    Source not found
    There is no source file attached to the class file FileUtil.class.

    Is there anything wrong? :(

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    opening the FileUtil.class (CLASS File) in Eclipse
    Have you tried asking this on an eclipse forum?
    I have no idea why an IDE would try to open a .class file.
    The IDE can't require source for all the .class files that you can use in a program. There are many packages distributed in only .class form.

  8. #8
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,379
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Norm View Post
    Have you tried asking this on an eclipse forum?
    I have no idea why an IDE would try to open a .class file.
    The IDE can't require source for all the .class files that you can use in a program. There are many packages distributed in only .class form.
    I think the OP selected that class name and tried to open its definition. Eclipse tries to find the source for that class and when it can't find it it protests and offers the opportunity to link a file or whatever resource for the source.

    I also think that the .jar came with a bit of installation instructions ...

    kind regards,

    Jos

Similar Threads

  1. Boolean confusion
    By KM88 in forum New To Java
    Replies: 13
    Last Post: 11-02-2009, 12:44 PM
  2. Confusion in line
    By JavaJunkie in forum New To Java
    Replies: 1
    Last Post: 06-13-2009, 10:46 PM
  3. confusion in paragraph
    By JavaJunkie in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 05-19-2009, 03:02 PM
  4. Tic Tac Toe confusion
    By jigglywiggly in forum New To Java
    Replies: 15
    Last Post: 04-12-2009, 01:47 AM
  5. bracket confusion...?
    By gallimaufry in forum New To Java
    Replies: 4
    Last Post: 10-28-2008, 11:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •