Search in Java Documenation
Is there a program that can find info in java api documentation. For example, I input a name of class and this program gives me links to all files of documentation that have links to this class. Like MSDN documentation does.
Is there a program that can find info in java api
documentation. For example, I input a name of class
and this program gives me links to all files of
documentation that have links to this class. Like
MSDN documentation does.you mean, kind of a search tool ? that displays all possible results in links?
Similar Messages
-
How to search using java? SearchControl or SearchResult ?
Can anyone help me how to do search in Java? The application i develop is having search field for user.
what do you mean? is it an application with a database? is the user data in the database? then just perform a SQL query like
select * from user_table where name like 'john%' -
How to do exact word search using Java API
Hi,
Can someone tell me how can I write a search query using Ultra Search Java API to return data containing a full word that is sent as a search
parameter. e.g. If I want to search for a word 'Dictionary' I need to get all the results conatining full word Dictionary for example if I
have following 4 records
1. Dictionary
2. English Dictionary
3. French Dictionary
4. AllDictionary
How can I write a query that returns me first 3 records only as they contain the word 'Dictionary' and not the fourth record as it's not a word.
Here is what I need to get back and ordered in that way as the 'Dictionary' needs to be first record because the search is on Dictionary.
1. Dictionary
2. English Dictionary
3. French Dictionary
Any help is appreciated.
ThanksLooks like we can not do an exact word search using Java API.
-
How to search inside java code?
How to search for pattern in Java code from NWDS? For example, I want to search for "wdThis" in java code. Where to look for find or search button?
Hi,
You can also use CTRL+H key for searching any Java or non-Java code across all projects you have opened in your workspace.
Just go to Project Explorer View and select any project, then press CTRL+H, a set of search option will show up.
Hope it helps.
Best regards,
David. -
Incremental search in java files
Hi,
i m supposed to write an application for Incremental Search in the Java Files.
it is such that, u type a word, then go on hitting any spl key as F3..it should take u to the every next occurance of the word in the current file and highlight it....
any one who has done b4, doing or knows abt this ......
plzzzz hlp me..
thanx in adv
SKHi,
Just giving you an idea to solve this, but implementation of this depends on your hardwork.
We can use Threads concept here. Use a integer variable, which is a global and is used later.
Now TWO java threads are activated.
One of the thread will constantly pool the Standard Input device for desired key value. Once it gets the desired key press value it will increment the integer variable.
The Second thread will serve as the searching thread. This will contantly check the value of the integer variable and the search string variable. If the integer value is more than 0, then this thread will run a methos which will point to the next occurance of the search word. After this it will decrement the value of the integer variable.
You may need to use Synchronization concept also in this when it comes to integer variable.
Hope this idea helps.
Do let me know once u implement the solution.
Cheers. -
Hi, i want to create a search facility in java. What I want is to have a facility of entering a word to search(it will read a dictionary). and secondly I want the user to be able to click on a letter so that all the corresponding words appear. for example A,B,C,D,E,F,G,H.....
can anyone tell me how this is done in Java please. thank you for your time.Make what you wants with a JTextField and a JList below :
// The container
JPanel panel = new JPanel(new BorderLayout());
// The list of words available
String[] words = ...
JList list = null;
JTextField field = new JTextField();
field.addKeyListener(
new KeyAdapter()
public void keyPressed(KeyEvent e)
String value = (String)list.getSelectedValue();
if (e.getKeyCode()==KeyEvent.VK_ENTER)
// Set the field value to the list selection when enter is pressed
field.setText(value);
else if (e.getKeyCode()==KeyEvent.VK_UP && list.getSelectedIndex()>0)
// Set the field value to the list upper value
String newValue = (String)list.getModel()
.getElementAt(list.getSelectedIndex()-1);
field.setText(newValue);
// Select upper element
list.setSelectedValue(newValue,true);
else if (e.getKeyCode()==KeyEvent.VK_DOWN
&& list.getSelectedIndex()<list.getModel().getSize()-1)
// Set the field value to the list next value
String newValue = (String)list.getModel()
.getElementAt(list.getSelectedIndex()+1);
field.setText(newValue);
// Select next element
list.setSelectedValue(newValue,true);
// Add field to panel
panel.add(field,BorderLayout.NORTH);
// Creation of the JList
this.list = new JList(words);
// Add a mouse listener
list.addMouseListener(
new MouseAdapter()
public void mouseClicked(MouseEvent e)
String value = (String)list.getSelectedValue();
if (e.getClickCount()>=2 && value!=null)
field.setText(value);
// Add a key listener
list.addKeyListener(
new KeyAdapter()
public void keyPressed(KeyEvent e)
String value = (String)list.getSelectedValue();
if (e.getKeyCode()==KeyEvent.VK_ENTER)
// Set the field's value to list selected element
field.setText(value);
else
// When a char is typed in the JList, we add it to the field
field.setText(locationField.getText()+e.getKeyChar());
field.requestFocus();
// Insert the list into a scrollpane
JScrollPane scrollpane =
new JScrollPane(list,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
panel.add(scrollpane); -
Unable to search within .java files on windows xp
windows Search can't seem to find things in my .java files (like grep) on my Windows XP machine.
Here's what I do: In the windows explorer, I select a folder which has some .java files beneath it, and I select Search off the folder's popup menu. That brings up a dialog that lets me name to file to search for, and also a word or phrase in the file. I enter filename of "*.java" and it finds all the *.java files OK, but if I also enter a value in the "word or phrase in the file" field and do a search, then it always says "0 files found" (I enter a word that I know is in some of the java files). Search finds words OK in .html or .txt files, but not in .java files. Weird.
Is there some setting in the windows registry that affects how searches are done in .java files?Follow the instructions in this article. I've runinto
the same thing, and the solution works.
http://support.microsoft.com/default.aspx?scid=kb;EN-US
Q309173Thank you. It now works for me too.
PC�Great! Glad at least someone (ok, 2) stopped by to say thanks. OP, hello? Geez, you even put up the 10 dukies as if this is important to you. -
Implement a greedy search in java
Implement a greedy serch in java for the map of romania .goal state is bucharest.
1.not to visit the same city twice
2.give the search trees
3.try 3 initial statesNo. Do it yourself. This is a help forum, not a "here's my requirements do it for me" forum.
-
CREATING A SEARCH IN JAVA USING MYSQL QUERY
How do i create a seach in java using mysql queries. The search need to be like a good type one, whereby a category is typed and the results obtained via the search system using jtable.
Thank you.Read the tutorial on [url http://java.sun.com/docs/books/tutorial/]JDBC Database Access.
Read the tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/table.html]How to Use Tables.
Put the two together and you come up with something like [url http://forum.java.sun.com/thread.jsp?forum=57&thread=497641]this. -
Hi,
I keep getting a java.lang.ClassCastException with these two classes when I try to perform a binary search. Any tips?
Phonebook class:
=============
import java.util.*;
public class Phonebook
private static long comparisons = 0;
private static long exchanges = 0;
public static void main (String[] args)
// Create an array of Phonebook records
PhoneRecord[] records = new PhoneRecord[10];
records[0] = new PhoneRecord("Smith","Bob", 1234367);
records[1] = new PhoneRecord("Jones","Will", 1234548);
records[2] = new PhoneRecord("Johnson","Frank", 1234569);
records[3] = new PhoneRecord("Mc John","Pete", 1234560);
records[4] = new PhoneRecord("OBrien","Frank", 1234571);
records[5] = new PhoneRecord("OConnor","Joe", 1234572);
records[6] = new PhoneRecord("Bloggs","Ricky", 1233570);
records[7] = new PhoneRecord("empty","empty", 8888888);
records[8] = new PhoneRecord("empty","empty", 9999999);
records[9] = new PhoneRecord("Van Vliet","Margreet", 1244570);
// call menu
Menu(records);
} // end main
//================================================
// menu
//================================================
static void Menu(PhoneRecord[] records)
int option;
// menu options
System.out.println("===========Menu==============================");
System.out.println("=============================================");
System.out.println(" ");
System.out.println("1. Find record (Advanced Search) ");
System.out.println("2. Quick Search ");
System.out.println("3. Add a record ");
System.out.println("4. Show database ");
System.out.println("5. Sort database ");
System.out.println("6. Exit ");
System.out.println(" ");
System.out.println("=============================================");
System.out.println("=============================================");
System.out.println(" ");
System.out.println("Choose a number ");
option = Console.readInt();
// every menu option has its own method
if (option == 1)
FindRecord(records);
if (option == 2)
QuickSearch(records);
else if (option == 3)
AddRecord(records);
else if (option == 4)
ShowDatabase(records);
else if (option == 5)
quickSort(records, 0, 9);
ShowDatabase(records);
// if 6 then terminate the program
else
System.out.println("Goodbye!");
} // end of menu
//=================================================
// menu option 1: Find a record - using linear search
//=================================================
static void FindRecord(PhoneRecord[] records)
int option;
do
// the user can search based on first name or last name
System.out.println("Do you want to search for:");
System.out.println("1. First Name");
System.out.println("2. Last Name");
System.out.println("3. End search");
option = Console.readInt();
// option 1 is search based on first name
if (option == 1)
System.out.println("Enter First Name");
String first = Console.readString();
int notthere = -1;
for (int i=0; i < 10; i++)
if (first.equals(records.first_Name))
System.out.println("----------------------------------");
System.out.println(records[i].last_Name + ", " + records[i].first_Name);
System.out.println(records[i].phonenumber);
System.out.println("----------------------------------\n\n");
// if a record is found, the variable notthere will be > -1
notthere = i;
} // end search array
// if notthere is -1, then there is no record available
if (notthere < 0)
System.out.println("------------------------------");
System.out.println("No record available");
System.out.println("------------------------------\n\n");
} // end option 1 First Name
// option 2 allows the user to search based on last name
else if (option == 2)
System.out.println("Enter Last Name");
String last = Console.readString();
int notthere = -1;
for (int i=0; i < 10; i++)
if (last.equals(records[i].last_Name))
System.out.println("----------------------------------");
System.out.println(records[i].last_Name + ", " + records[i].first_Name);
System.out.println(records[i].phonenumber);
System.out.println("----------------------------------\n\n");
notthere = i;
// if notthere is -1 then there is no record available
// if notthere is > -1 then there is a record available
} // end search array
if (notthere < 0)
System.out.println("------------------------------");
System.out.println("No record available");
System.out.println("------------------------------\n\n");
} // end option 2 Last Name
else
// if the user types in a wrong number, he or she returns to the menu
Menu(records);
while (option != 3);
} // end FindRecord
//=================================================
// menu option 2: Quick Search - using binary search
//=================================================
static void QuickSearch(PhoneRecord[] records)
// Sort array - Using Quicksort
quickSort(records, 0, 9);
// allow user to enter the last name
System.out.println("Enter Last Name");
String last = Console.readString();
// use binary search to find the target
int index = binarySearch(records, last);
// -1 means that there are no records
if (index == -1)
System.out.println("------------------------------");
System.out.println("No record available");
System.out.println("------------------------------\n\n");
// print out the record
System.out.println("----------------------------------");
System.out.println(records[index].last_Name + ", " + records[index].first_Name);
System.out.println(records[index].phonenumber);
System.out.println("----------------------------------\n\n");
// return to menu
Menu(records);
} // end QuickSearch
public static int binarySearch( Comparable [ ] a, Comparable x )
int low = 0;
int high = 9;
int mid;
while( low <= high )
mid = ( low + high ) / 2;
if( a[ mid ].compareTo( x ) < 0 )
low = mid + 1;
else if( a[ mid ].compareTo( x ) > 0 )
high = mid - 1;
else
return mid;
return -1; // not found
//=================================================
// menu option 3: Add a record
//=================================================
static void AddRecord(PhoneRecord[] records)
int option;
int index = 0;
// enter details
do
// to say that the array is not full yet, I use the variable filled
int filled = 0;
System.out.println("Enter the First Name");
String frst = Console.readString();
System.out.println("Enter the Last Name");
String lst = Console.readString();
System.out.println("Enter the phone number");
int phn = Console.readInt();
// search the array for the empty slot
for (int i=0; i < 10; i++)
if (records[i].first_Name.equals("empty") && filled == 0)
records[i].first_Name = frst;
records[i].last_Name = lst;
records[i].phonenumber = phn;
filled = 1;
// Sort array - Using Quicksort
quickSort(records, 0, 9);
// Print out sorted values
for(int i = 0; i < records.length; i++)
System.out.println("----------------------------------");
System.out.println(records[i].last_Name + ", " + records[i].first_Name);
System.out.println(records[i].phonenumber);
System.out.println("----------------------------------\n\n");
System.out.println("Do you want to add more records?");
System.out.println("1. Yes");
System.out.println("2. No");
option = Console.readInt();
if (option == 2)
Menu(records);
// sets the database to full
int empty = 0;
for (int i=0; i < 10; i++)
// empty = 1 means that there is an empty slot
if (records[i].first_Name.equals("empty"))
empty = 1;
// if the system didn't find an empty slot, the database must be full
if (empty == 0)
System.out.println("Database is full");
option = 2;
Menu(records);
while (option != 2);
} // end AddRecord
//=================================================
// menu option 4: Show database
//=================================================
static void ShowDatabase(PhoneRecord[] records)
// shows the entire database
for (int i=0; i < 10; i++)
System.out.println("----------------------------------");
System.out.println(records[i].last_Name + ", " + records[i].first_Name);
System.out.println(records[i].phonenumber);
System.out.println("----------------------------------");
Menu(records);
//===============================================
// Sort array
//=============================================
public static void quickSort (Comparable[] a, int left, int right)
// Sort a[left?right] into ascending order.
if (left < right) {
int p = partition(a, left, right);
quickSort(a, left, p-1);
quickSort(a, p+1, right);
static int partition (Comparable[] a, int left, int right)
// Partition a[left?right] such that
// a[left?p-1] are all less than or equal to a[p], and
// a[p+1?right] are all greater than or equal to a[p].
// Return p.
Comparable pivot = a[left];
int p = left;
for (int r = left+1; r <= right; r++) {
int comp = a[r].compareTo(pivot);
if (comp < 0) {
a[p] = a[r]; a[r] = a[p+1];
a[p+1] = pivot; p++; }
return p;
} // end class PhoneBook
PhoneRecord class:
================
public class PhoneRecord implements Comparable
public int phonenumber;
public String last_Name;
public String first_Name;
public PhoneRecord(String last_Name, String first_Name, int phonenumber)
this.last_Name = last_Name;
this.phonenumber = phonenumber;
this.first_Name = first_Name;
/* Overload compareTo method */
public int compareTo(Object obj)
PhoneRecord tmp = (PhoneRecord)obj;
// sorting based on last name
String string1 = this.last_Name;
String string2 = tmp.last_Name;
int result = string1.compareTo(string2);
if(result < 0)
/* instance lt received */
return -1;
else if(result > 0)
/* instance gt received */
return 1;
/* instance == received */
return 0;JosAH wrote:
prometheuzz wrote:
bats wrote:
Hi,
I keep getting a java.lang.ClassCastException with these two classes when I try to perform a binary search. Any tips?
...Looking at your binary search method:
public static int binarySearch( Comparable [ ] a, Comparable x)I see it expects to be fed Comparable objects. So, whatever you're feeding it, it's not a Comparable (ie: it doesn't implement Comparable), hence the CCE.It's even worse: if an A is a B it doesn't make an A[] a B[].
kind regards,
JosMy post didn't make much sense: if there were no Comparables provided as an argument, it would have thrown a compile time error. The problem lies in the compareTo(...) method. -
Create Named Search with Java API
Hi,
is it possible to create or modify a named search with the Java API?
Best regards,
RomanHi Olof,
You can use the below code for searching a value in lookup table:
ResultDefinition objResultDefinition = new ResultDefinition(Lookup Table Id);
objResultDefinition.addSelectField(Lookup Field ID);
StringValue [] objStringValue = new StringValue[1];
objStringValue[0] = new StringValue("Value to search");
RetrieveRecordsByValueCommand objRetrieveRecordsByValueCommand = new RetrieveRecordsByValueCommand(objConnectionAccessor);
objRetrieveRecordsByValueCommand.setSession(strUserSessionID);
objRetrieveRecordsByValueCommand.setResultDefinition(objResultDefinition);
objRetrieveRecordsByValueCommand.setFieldId(lookup field id);
objRetrieveRecordsByValueCommand.setFieldValues(objStringValue);
objRetrieveRecordsByValueCommand.execute();
RecordResultSet objRecordResultSet = objRetrieveRecordsByValueCommand.getRecords();
Now using the objRecordResultset in a loop you can get the record id by calling the getRecord(i).getId() method.
Hope this helps!!
Cheers,
Arafat -
Hi All,
Does anyone know if its possible to execute Named Searches using the Java API? If so, how would you set up that call?
Best Regards,
MarkHello Mark,
SAP does provide with some methods related to Named Searches just have a look at these links
1. <a href="https://help.sap.com/javadocs/MDM/current/com/sap/mdm/search/SearchDimension.html#NAMED_SEARCH">Named search</a>
2. <a href="https://help.sap.com/javadocs/MDM/current/com/sap/mdm/security/AccessPermission.html#NAMED_SEARCH_OBJECT">Named Search Object</a>
3. <a href="https://help.sap.com/javadocs/MDM/current/com/sap/mdm/search/NamedSearchSearchDimension.html#NAMED_SEARCH_SEARCH_DIMENSION">Named Search Search Dimension</a>
I hope this solves ur problem.
Regards Dollar Man -
hey all I'm glad to be back in school because i get a chance to learn new things about programming. And with that comes annoying questions i usually post for the senior members.
Here is what i dont understand about serching in java. What is better a linear search or a binary search? Also can you explain why it is better to use logofn to do searches?
Thanks,
MShey all I'm glad to be back in school because i get a
chance to learn new things about programming. And
with that comes annoying questions i usually post for
the senior members.
Here is what i dont understand about serching in
java. What is better a linear search or a binary
search? Did you try googling for linear search and binary search? They are general CS concepts and not specific to Java.
Also can you explain why it is better to use
logofn to do searches?You mean O(log n)? Better than what? Certainly not better than O(1), but better than O(n! ^ 99). If you don't know why, google for big o notation. -
Hi all,
Do you know any program written in Java that go on the internet
and search for data that we specify. What kinda of java package
am I supposed to look at if I want to write one.
Thanks,
TCLet's boil this down to the requirements:
> Do you know any program written in Java that go on the
internet
1) So you need some way to access the internet from Java.
> and search for data that we specify.
2) and you need to be able to search for data specified.
Okay, well I'll assume you already know how to write a simple Java command line program that lets you input data (say, as an argument). If not, you're going to want to tackle that before you go on to do internet-based programming.
The two requirements are that you can access the internet, and that you can search for certain data. Well, to search for certain data, you are going to need to write a spider/crawler that traverses across the web and records the information it finds, reporting back when it finds the target data. Why bother doing all of this when there are plenty of search engines already that will do this for you. One of the best search engines is Google, and Google is accessible via HTTP (world wide web).
So, really all you need to be able to do is access the internet and talk to Google. This isn't too hard. To access the internet through HTTP (letting you get in touch with Google), you may wish to investigate the java.net package as well as the org.apache.commons.HttpClient package.
http://java.sun.com/j2se/1.4.1/docs/api/java/net/package-summary.html
http://jakarta.apache.org/commons/httpclient/ -
In search of java class dependency utility
Folks,
We have developed a J2EE application where the "client" is a java
application. In other words, we have created a JAR file that a user
uses to launch our application. The manifest for this JAR file has a
"Main-Class" attribute, so the following command is used to launch the
(client side of) the application:
java -jar our.jarOur entire application (both client-side and server-side) consists of
several hundred classes. Our problem is that we don't have an accurate
list of which classes are client-side only, which classes are
server-side only, and which classes are required by both (client-side
and server-side). I want our client-side JAR to only contain classes
required by the client. Currently, we are simply bundling all the
classes into "our.jar".
I have found (and tried) several utilities, including:
http://depfind.sourceforge.net/
http://www.clarkware.com/software/JDepend.html
http://www.horstmann.com/articles/BetterCleaner.html
However, I don't think these are suitable. You need to supply a class
name, and they only tell you the classes that either depend on the
given class, or that the given class depends on. What I want is a
"recursive" dependency finder.
For example, let's say I have class "A". Class "A" depends on class "B"
(in other words, class "A" needs to import class "B"). Now class "B"
depends on class "C" and class "C" depends on class "D". Also, we have
class "E" that depends on class "A" (in other words, class "E" needs to
import class "A").
The tools I mentioned above will only return (at most), classes "B" and
"E" (when I supply them with class "A"), but what I really need them to
return is classes "B","C" and "D" (and not necessarily class "E").
Does anyone know how I can achieve this?
Thanks (in advance),
Avi.ClassDep from jini provides the same functionality as GenJar but I have found it better to work with. You do not need ant to run it although it does come with an ant task. ClassDep.java has a public static void main (String[] args ).
http://java.sun.com/products/jini/2.0/doc/api/com/sun/jini/tool/ClassDep.html provides the documentation on how to use it.
Maybe you are looking for
-
Problems creating a disk image on an external hard drive
Hiya, I've been trying to create a disk image on my dad's external hard drive to hold my back-ups all day with no luck. I've managed small ones, e.g. a few MB, but when trying to create images 20 or 40 GB in size (which is what I need), it isn't work
-
Hello, I'm stuck with a complex mapping issue that I can't figure out. I'm trying to pull 0..N Variant Configuration segments from the ORDERS IDOC and map it into a 0..N XML segment. The inbound ORDERS IDOC is structured like this: IDOC ...E1EDP01
-
Function Keys in Third Party Keyboards
My alluminum extended Mac keyboard went on the fritz after three years, though I admit I may have been cleaning it incorrectly. Anyway, I bought a third party generic keyboard that is more Mac like than Windows like, and it's working pretty well exce
-
Hi, my query : select table_name, tablespace_name from all_tables where table_name='TMP$PLAN'; returns : TABLE_NAME TABLESPACE_NAME TMP$PLAN TMP$PLAN then there is no tablespace for TMP$PLAN. What does it mean ? PS : I have this error message also :
-
Increase internet speed when DNS and ISP are good
How do you increase your internet performance when? 1. Your ISP is great. I have Verizon blast. 2. download and upload are not bad 3. You do not want to be attached to ethernet cord. 4. namebench says your current DNS servers are the "fastest". 5. I