Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

 

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

 

and many more ....

 

Receive Java & Developer job alerts in your Area

I have read and agree to the terms & conditions

 

Create Lucene Index

package com.javacodegeeks.lucene; import java.io.File; import java.io.FileReader; import java.io.IOException; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.store.FSDirectory; public class SimpleFileIndexer { public static void main(String[] args) throws Exception { File indexDir = new File("C:/index/"); File dataDir = new File("C:/programs/eclipse/workspace/"); String suffix = "java"; SimpleFileIndexer indexer = new SimpleFileIndexer(); int numIndex = indexer.index(indexDir, dataDir, suffix); System.out.println("Total files indexed " + ...

Read More »

Did you mean feature with Apache Lucene Spell-Checker

package com.javacodegeeks.lucene.spellcheck; import java.io.File; import org.apache.lucene.search.spell.PlainTextDictionary; import org.apache.lucene.search.spell.SpellChecker; import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; public class SimpleSuggestionService { public static void main(String[] args) throws Exception { File dir = new File("c:/spellchecker/"); Directory directory = FSDirectory.open(dir); SpellChecker spellChecker = new SpellChecker(directory); spellChecker.indexDictionary( new PlainTextDictionary(new File("c:/fulldictionary00.txt"))); String wordForSuggestions = "hwllo"; int suggestionsNumber = 5; String[] suggestions = spellChecker. suggestSimilar(wordForSuggestions, suggestionsNumber); if (suggestions!=null && suggestions.length>0) ...

Read More »

Play audio in Applet

Bipartite Graph

In this example we shall show you how to play audio in an Applet. A Java applet is a special kind of Java program that a browser enabled with Java technology can download from the internet and run. An applet is typically embedded inside a web page and runs in the context of a browser. An applet must be a ...

Read More »

Draw Image in Applet

Bipartite Graph

With this example we are going to demonstrate how to draw an image in an Applet. A Java applet is a special kind of Java program that a browser enabled with Java technology can download from the internet and run. An applet is typically embedded inside a web page and runs in the context of a browser. An applet must ...

Read More »

Get an applet parameter

Bipartite Graph

This is an example of how to get an Applet parameter. A Java applet is a special kind of Java program that a browser enabled with Java technology can download from the internet and run. An applet is typically embedded inside a web page and runs in the context of a browser. An applet must be a subclass of the ...

Read More »

Applet lifecycle methods

Bipartite Graph

In this example we shall show you the Applet lifecycle methods. A Java applet is a special kind of Java program that a browser enabled with Java technology can download from the internet and run. An applet is typically embedded inside a web page and runs in the context of a browser. An applet must be a subclass of the ...

Read More »

Bean XML deserialization

Bipartite Graph

With this example we are going to demonstrate how to deserialize a java Bean using the XMLDecoder. The XMLDecoder class is used to read XML documents created using the XMLEncoder and is used just like the ObjectInputStream. In short, to deserialize a java Bean using the XMLDecoder you should: Create an xml representation of the java bean. Create a simple ...

Read More »

Bean XML serialization

Bipartite Graph

This is an example of how to serialize a java Bean using the XMLEncoder. The XMLEncoder class is a complementary alternative to the ObjectOutputStream and can used to generate a textual representation of a JavaBean in the same way that the ObjectOutputStream can be used to create binary representation of Serializable objects. Serializing a java Bean using the XMLEncoder implies ...

Read More »

Bean property change event listener

Bipartite Graph

In this example we shall show you how to change a Bean’s property using an event listener. We will use the PropertyChangeListener interface. This interface can be registered with a bean so as to be notified of any bound property updates. We are also using the PropertyChangeSupport class. This is a utility class that can be used by beans that ...

Read More »

List bean property names

Bipartite Graph

With this example we are going to demonstrate how to list the names of a bean’s properties. We are using the PropertyDescriptor, a class that describes one property that a Java Bean exports via a pair of accessor methods. We are also using the Introspector class, that provides a standard way for tools to learn about the properties, events, and ...

Read More »