Results 1 to 8 of 8
  1. #1
    ma903rh is offline Member
    Join Date
    Mar 2010
    Posts
    10
    Rep Power
    0

    Default Question about using ready codes

    Hi,
    I am trying to use Java for first time, and I need help in the following questions:

    + I want to use ready code for accessing and searching in WordNet, it is easy,I think, but because it is the first time for me to be in Java I could not do it.
    it is clearly stated on this page Java API for WordNet Searching (JAWS)

    I did all steps, but my apps did not work

    Could anyone help in this?

    Thanks

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Did you comes with any error? Can you post it here if any? Otherwise how we know where you stuck with.

  3. #3
    ma903rh is offline Member
    Join Date
    Mar 2010
    Posts
    10
    Rep Power
    0

    Default

    Thanks for your reply.
    Below are my code and error:

    Code:
    import edu.smu.tspell.wordnet.*;

    public class JavaApplication9

    {

    public static void main(String[] args)
    {
    String[] args2 = {"fly"};
    if (args2.length > 0)
    {
    // Concatenate the command-line arguments
    StringBuffer buffer = new StringBuffer();

    System.setProperty("wordnet.database.dir", "C:/Program Files (x86)/WordNet/2.1/dic/");
    for (int i = 0; i < args.length; i++)
    {
    buffer.append((i > 0 ? " " : "") + args[i]);
    }
    String wordForm = "fly";
    // Get the synsets containing the wrod form
    WordNetDatabase database = WordNetDatabase.getFileInstance();
    Synset[] synsets = database.getSynsets(wordForm, SynsetType.NOUN);
    // Display the word forms and definitions for synsets retrieved
    if (synsets.length > 0)
    {
    System.out.println("The following synsets contain '" +
    wordForm + "' or a possible base form " +
    "of that text:");
    for (int i = 0; i < synsets.length; i++)
    {
    System.out.println("");
    String[] wordForms = synsets[i].getWordForms();
    for (int j = 0; j < wordForms.length; j++)
    {
    System.out.print((j > 0 ? ", " : "") +
    wordForms[j]);
    }
    System.out.println(": " + synsets[i].getDefinition());
    }
    }
    else
    {
    System.err.println("No synsets exist that contain " +
    "the word form '" + wordForm + "'");
    }
    }
    else
    {
    System.err.println("You must specify " +
    "a word form for which to retrieve synsets.");
    }
    }

    }



    --------------------------------
    Error:
    java.lang.ExceptionInInitializerError
    Caused by: java.lang.RuntimeException: Uncompilable source code - class TestJAWS is public, should be declared in a file named TestJAWS.java
    at TestJAWS.<clinit>(Main.java:11)
    Could not find the main class: TestJAWS. Program will exit.
    Exception in thread "main" Java Result: 1
    BUILD SUCCESSFUL (total time: 0 seconds)
    ------

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    What's you file name? Is it JavaApplication9.java? That's all about the error message you comes with.

  5. #5
    ma903rh is offline Member
    Join Date
    Mar 2010
    Posts
    10
    Rep Power
    0

    Default

    Thanks Eranga, Thats what I did and I got the job done !!!!
    Thanks for your help

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  7. #7
    ma903rh is offline Member
    Join Date
    Mar 2010
    Posts
    10
    Rep Power
    0

    Default

    thanks for your note, but how can I do that so i ca do it next posts.

    waiting you :)

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Ready To Program, Images in HSA Console?
    By habbah in forum New To Java
    Replies: 2
    Last Post: 01-17-2010, 04:50 AM
  2. [SOLVED] Ready to Program Java IDE
    By Starr29 in forum New To Java
    Replies: 9
    Last Post: 07-24-2009, 06:21 PM
  3. Replies: 3
    Last Post: 07-18-2009, 02:26 PM
  4. Ready to Program Java IDE Problem #4
    By Starr29 in forum New To Java
    Replies: 5
    Last Post: 01-06-2009, 04:38 PM
  5. [SOLVED] Ready to Program Java IDE Problem #2
    By Starr29 in forum New To Java
    Replies: 2
    Last Post: 01-03-2009, 02:02 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
  •