I am thinking about making some sort of word game… I don't know if you have played games like scrabble or word whomp or word mole or something like them, but some how they have a way of verifying the word given is a real word. Does anyone know how to do this? I was thinking it might be some sort of API… or is it a dictionary list in a database somewhere that is queried during game play? Any help would be appreciated.
Generally, there is an included (updatable) word database, check this link to give you an idea:
http://wordnet.princeton.edu/ (it has a C api though…)
That looks like what I probably want, is there one for Java? How would I use something like that with Java?
Did a quick scan at their FAQ, they mention about API's, in the link above they list a java API (JAWS), as well as interfaces for plenty other languages.
Thanks. I think that might be what I was looking for. I will see if I am able to use it.
Well, the instructions for using JAWS given at http://lyle.smu.edu/~tspell/jaws/index.html#get_started are kinda confusing and I am wondering if there is an easier way to do this… If I have the noun, verb, adverb, and adjective .txt files from the WordNet program I downloaded, is there some way I can utilize that?
yes, those are pretty vague (note in the top part of that page it says it was written for a school project, so who knows…)
But there are several Java implementations out there, http://wordnet.princeton.edu/ that is the source; it is an old (20 year) endeavor to create a powerful dictionary ‘engine’ (I even see some cool AI potential with it). Check out http://en.wikipedia.org/wiki/WordNet for more info. (I have never used this system before, and it does look very complex; but its definitely a mature product with a large user base).
As I started looking through wordnet, I was afraid it would be too complicated for what I wanted to do with it, but thanks to basixs, I found this API called JawBone at http://mfwallace.googlepages.com/jawbone.html and I think it is just what I am looking for. I think this API will allow for me to easily check the user given word against the words in the dictionary files of WordNet.
My only problem now, is that I don't have much experience with using peoples APIs, for instance, the first time I have ever downloaded and used an API is with jME and the documentation for downloading with specific IDEs was very helpful. So, I have downloaded the jawbone files, but I don't really know how to go about making them available to use with my program. Can anyone help with this?
probably VERY similar to jME: create new project in your IDE, include the appropriate JAR files (I don't think wordnet needs any natives), then just start coding (probably find an easy tutorial to get your feet wet)…
The file that I downloaded wasn't a jar file… it was just a zip file containing an XML build file and a folder called src that contains the .java files.
You can either use the build file that came with the source to build your own jar, or on the same page you downloaded the source from in the following link you can also download the jar. Add the jar to the build path of your project that you want to use it in.
Okay, I downloaded the jar and I went to the properties of my project, do I just include the jar file in the compile time libraries of this project or where exactly do I put the jar file?
It doesn’t help you as much if I just give you the answers!
I use netbeans, not eclipes, but I think I figured out the equivalent steps to take. I went to the properties of my project and went to libraries and added the jar file to the compile time libraries.
I am having a different problem though, I get this error at run time and I have never seen anything like it before…
java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.security.AccessController.doPrivileged(Native Method)
Exception in thread "main"
Exception in thread "main" Java Result: 1
Usually when I get errors, it has to do with my own code, so I don't know why it is yelling at me about the java.lang stuff.
That means that you are trying to run the jar with a different Java version (major version, ie 1.5-1.6) than it was compiled with…
1) Figure out what version of Java it was using and use it
2) re-compile the source into the version you are using (my preferred solution, but generally a little more difficult)
Is the best way to do #2 to just open up all the .java files contained in the src and then recompile them and make a new jar with the recompiled files?
Yes. The build file should have a target that creates a jar for you. If that doesn't then NetBeans can surely do it.
Well, since my last post, I have abandoned jawbone because I found a word list online that didn't require me to use someone else API because it was a line by line .txt file.
Also, since then I have written some classes that used JDBC to create a table and load the words into the database. However, now I am trying to retrieve information from the database and I keep getting an error thrown and I don't know what the problem is. Does anyone have any experience with JDBC?
* The other two WordDBTester classes aren't working because I keep
* getting an SQLException, so I am going to follow the code from Java 2
* Primer Plus almost exactly, to see if I can get this working at all.
* @author Josh Branchaud
* @version 12/31/2008
public class WordDBTester3 implements java.io.Serializable
// information about the word
private String word;
private int points;
private int length;
private int vowels;
private int consonants;
public String toString()
outString = "
outString += "Word = " + this.word + "n";
outString += "Points = " + this.points + "n";
outString += "Length = " + this.length + "n";
outString += "Vowels = " + this.vowels + "n";
outString += "Consonants = " + this.consonants + "n";
outString += "
public String retrieveFromDB()
java.sql.Connection DBConnection = null;
Statement s1 = null;
String sourceURL = "jdbc:odbc:WordList1";
DBConnection = DriverManager.getConnection(sourceURL);
System.out.println("Connection to system successful!");
s1 = DBConnection.createStatement();
word = "pig";
String queryString = "SELECT * FROM WordList1 WHERE Word = " + word;
ResultSet rs = s1.executeQuery(queryString);
word = rs.getString("Word");
points = rs.getInt("Points");
length = rs.getInt("Length");
vowels = rs.getInt("Vowels");
consonants = rs.getInt("Consonants");
return "Successful Retrieval";
System.out.println("Exception was thrown: " + e.getMessage());
return "UnSuccessful Retrieval";
if(s1 != null)
if(DBConnection != null)
System.out.println("SQLException during close(): " + SQLE.getMessage());
public static void main(String args)
WordDBTester3 WDBT3 = new WordDBTester3();
That is my code and it keeps throwing this exception...
Exception was thrown: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
Any help would be greatly appreciated!
there something wrong with the sql statement, either missing ' ' around word or something like that.
That was exactly it, thank you! I haven't used SQL in a while