Problem in compiling a program

i am using an API, and have a problem in executing a program which uses the API
the source code is here
import java.io.*;
import org.apache.lucene.document.*;
import org.apache.lucene.index.*;
import org.apache.lucene.analysis.*;
import org.apache.lucene.analysis.standard.*;
import java.util.*;
import java.io.IOException;
public class Indexer {
public static void main(String[] args) throws Exception {
if (args.length != 2) {
throw new Exception("Usage: java " + Indexer.class.getName()
+ " <index dir> <data dir>");
File indexDir = new File(args[0]);
File dataDir = new File(args[1]);
long start = new Date().getTime();
int numIndexed = index(indexDir, dataDir);
long end = new Date().getTime();
System.out.println("Indexing " + numIndexed + " files took "
+ (end - start) + " milliseconds");
// open an index and start file directory traversal
public static int index(File indexDir, File dataDir)
throws IOException {
        if (!dataDir.exists() || !dataDir.isDirectory()) {
throw new IOException(dataDir
+ " does not exist or is not a directory");
IndexWriter writer = new IndexWriter(indexDir,
new StandardAnalyzer(), true);
writer.setUseCompoundFile(false);
indexDirectory(writer, dataDir);
int numIndexed = writer.docCount();
writer.optimize();
writer.close();
return numIndexed;
// recursive method that calls itself when it finds a directory
private static void indexDirectory(IndexWriter writer, File dir)
throws IOException {
File[] files = dir.listFiles();
for (int i = 0; i < files.length; i++) {
File f = files;
if (f.isDirectory()) {
indexDirectory(writer, f);
} else if (f.getName().endsWith(".txt")) {
indexFile(writer, f);
// method to actually index a file using Lucene
private static void indexFile(IndexWriter writer, File f)
throws IOException {
if (f.isHidden() || !f.exists() || !f.canRead()) {
return;
System.out.println("Indexing " + f.getCanonicalPath());
Document doc = new Document();
doc.add(Field.Text("contents", new FileReader(f)));
doc.add(Field.Keyword("filename", f.getCanonicalPath()));
writer.addDocument(doc);
and the errors are C:\Documents and Settings\Sumit\Desktop\db>javac Indexer.java
Indexer.java:60: cannot find symbol
symbol : method Text(java.lang.String,java.io.FileReader)
location: class org.apache.lucene.document.Field
doc.add(Field.Text("contents", new FileReader(f)));
^
Indexer.java:61: cannot find symbol
symbol : method Keyword(java.lang.String,java.lang.String)
location: class org.apache.lucene.document.Field
doc.add(Field.Keyword("filename", f.getCanonicalPath()));
^
2 errors
this program came with the API, but i dont know why it is not executing, ask me if you need any other file of API.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

ping.sumit wrote:
i am using an API, and have a problem in executing a program which uses the API and you will likely need to find a forum or other source which supports this API. Much luck.

Similar Messages

  • JAAS - problem in compiling the program

    Hi,
    I am working on JAAS .
    I tried the Authorization example given in this link of sun site.
    http://java.sun.com/javase/6/docs/technotes/guides/security/jaas/tutorials/GeneralAcnAndAzn.html
    I was trying to compile that program but SamplAzn.java..is not compiling.
    when I try it given the error below :
    --------------------Configurat
    ion: <Default>--------------------
    D:\AZN\sample\SampleAzn.java:135: cannot find symbol
    symbol : class SampleAction
    location: class sample.SampleAzn
    PrivilegedAction action = new SampleAction();
    ^
    Note: D:\AZN\sample\SampleAzn.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 error
    Process completed.
    --------------------------------------------------------------------------------So,What should I do ?
    Thankx..

    Yes , I created the directory structure as given in the link.
    I can compile all other ".java" file.
    But I don't know why I can't compile SampleAzn.java file.

  • Problem when compiling C program from RFC SDK with Unicode on AIX 5.3

    hi friends.
    I try RFC with UNICODE.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/90313271-2311-2a10-c495-c20199d1d821
    This simple code compiled.
    #include <saprfc.h>
    #include <sapuc.h>
    #include <sapucx.h>
    int mainU(int argc, SAP_UC* argv[] )
        const SAP_UC* s1 = cU("Hello");
        SAP_UC s2[100];
        strcpyU( s2, s1);
        printfU(cU("%s
    "),s2);
        return 0;
    The compiling command is
    cc -DSAPwithUNICODE -I ../rfcsdkU/include -L ../rfcsdkU/lib sample.c -o sample -lrfcu -lC
    to compile.
    Then the error information comed:
    "sample.c", line 7.24: 1506-045 (S) Undeclared identifier U16LIT_cU.
    "sample.c", line 7.27: 1506-275 (S) Unexpected text string literal encountered.
    "sample.c", line 10.16: 1506-276 (S) Syntax error: possible missing ')'?
    I hope someone can tell me how I can get it through.
    Edited by: sakamoto shouichi on Apr 16, 2008 11:02 AM
    Edited by: sakamoto shouichi on Apr 16, 2008 11:03 AM

    hi friends. I'm having same problem.
    i speak english just a little.sorry.
    see this command line.
    AIX5.3
    cc -I ../rfcsdk/include -L ../saprfc/rfcsdk/lib sapinfo.c -o sapinfo -lrfc -lC
    add -lC .
    i fnish this problem. thnx!
    Edited by: sakamoto shouichi on Apr 7, 2008 5:32 AM

  • Problem with my JBuilder Program

    I have a problem to compile this program with JBuilder 8.0
    He told me, each time like what my import file not working.
    Best regards,
    Nicholas
    First Error Messages: !Class test_rectangle is public; must be declared in a file named test_rectangle.java at line 17
    Second Error Messages: "rectangle.java": Error #: 901 : package . stated in source E:\JBuilder 8\samples\Welcome\rectangle\src\rectangle\rectangle.java does not match directory .
    import java.util.*;
    import java.io.*;
    public class rectangle
    private int a;//lenght variable;
    private int b;//width variable;
    public rectangle (int x, int y){//constructor
    a=x;
    b=y;
    public int surface (int x, int y){//function (method)
    return x*y;
    public class test_rectangle
    public static void main (String[] args)
    throws java.io.IOException //degage les exeptions (rejette se qu<il ne sait pas)
    rectangle rectangle1=new rectangle (3,4);//on a donner le nom du rectangle
    System.out.println (rectangle1.surface (3,4));//on applique une methode a l objets

    Two problems.
    1) You have your rectangle class in src/rectangle which means that it needs to be declared in package 'rectangle'.
    2) You cannot have more than one public class in a file. The file has to have the same name as the class with a ".java" extension.
    You can solve (1) by adding this to the top of your file:
    package rectangle;
    or by moving the file to src.
    You can solve (2) by removing the public modifier from your internal class or moving it to it's own file (test_rectangle.java).

  • Problem in compiling aa servlet program

    I have installed jsdk1.4.2_13
    And also installed tomcat 5.0.28
    I have set
    CATALINA_HOME==C:\Program Files\Tomcat\jakarta-tomcat-5.0.28
    JAVA_HOME ==C:\j2sdk1.4.2_13
    CLASS_PATH==
    C:\Program Files\Tomcat\jakarta-tomcat-5.0.28\common\lib\servlet-api.jar;
    C:\Program Files\Tomcat\jakarta-tomcat-5.0.28\common\lib\jsp-api.jar
    PATH ==C:\j2sdk1.4.2_13\bin;C:\Program Files\Tomcat\jakarta-tomcat-5.0.28\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
    -->My java programs are compiling
    -->I can run tomcat server , And also can see starting page of "http://localhost:8080/"
    But I am not able to compile servlet program
    MY sevlet program is
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HelloServlet extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String docType =
    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
    "Transitional//EN\">\n";
    out.println(docType +
    "<HTML>\n" +
    "<HEAD><TITLE>Hello</TITLE></HEAD>\n" +
    "<BODY BGCOLOR=\"#FDF5E6\">\n" +
    "<H1>Hello</H1>\n" +
    "</BODY></HTML>");
    ERRORS are:
    Pakage javax.servlet does not exist
    Pakage javax.servlet.http does not exist
    cannot resolve symbol HttpServletRequest
    and similar errors
    can anyone guide me?
    Message was edited by:
    Learn

    it's not CLASS_PATH, it's CLASSPATH.
    Directory paths with spaces in them are problematic. Surround them with double quotes.
    I think the best thing is not a CLASSPATH environment variable. Better to use the -classpath option on javac.exe when you compile.
    So your command to compile might look something like:
    javac -classpath .;"C:\Program Files\Tomcat\jakarta-tomcat-5.0.28\common\lib\servlet-api.jar" *.java%

  • Problem in compiling pro * c program

    Hi
    Greetings ,
    I am new to proc, i wrote a small sample program while compiling this program in vc++ 6.0 i am getting the following error
    c:\proheaderfiles\database.c(24) : error C2061: syntax error : identifier 'SQL'
    c:\proheaderfiles\database.c(24) : error C2059: syntax error : ';'
    c:\proheaderfiles\database.c(24) : error C2054: expected '(' to follow 'TYPE'
    can anyone help me in this regard
    Thanks in advance

    First compile the proc programe through
    windows version proc ,generate the *.cpp file;
    Second : add the *.cpp file to visual c++ project
    Then compile with visual c++;

  • Problem compiling java programs

    when i run javc in command prompt it runs fine but when i try to compile any program through command prompt it gives following error:
    javac: file not found
    usage: java <options> <source file>
    use -help for list of attributes
    what shouls i do plz help

    yogiis wrote:
    when i run javc in command prompt it runs fine but when i try to compile any program through command prompt it gives following error:
    javac: file not found
    usage: java <options> <source file>
    use -help for list of attributes
    what shouls i do plz helpuse set path="path of java/jdk/bin folder with double quotes" then press enter
    otherwise if you are ussing windows system goto to my computer properties and use advanced tab then use environment variables, there use user/system variables and check is there any exisiting path named variable is there or not if there click on edit and use ; and paste the complete path there. press ok, apply. Then use the command.

  • Can't find (and possibly don't have) the -lglut -lGLU -lGL libraries... or at least when I try to compile a program, it returns with that error.  Any ideas (I really need to get this popgen program running on Lion)? Thx!

    Hi all,
        I'm trying to compile a population genetic software program onto my Mac Lion.  It was originally compiled to Tiger and worked beautifully.  But now I'm getting an error  'library not found for -lglut', and now I'm trying to figure out how to download the library. I've installed the command line code for Xcode, and am thinking I possibly missed installing the libraries.  I could be very wrong here... all I know is that I'm no longer near the people I would ask to help me with this so I'm asking you!  Thanks in advance for any help!  I guess my questions are: 1) where can I download the glut (potentially OpenGL) libraries (if I don't have them already)? And 2) once downloaded, how do I install it so the makefile will compile my program (in terminal, not Xcode)? Cheers,
    C

    Certain Firefox problems can be solved by performing a ''Clean reinstall''. This means you remove Firefox program files and then reinstall Firefox. Please follow these steps:
    '''Note:''' You might want to print these steps or view them in another browser.
    #Download the latest Desktop version of Firefox from http://www.mozilla.org and save the setup file to your computer.
    #After the download finishes, close all Firefox windows (click Exit from the Firefox or File menu).
    #Delete the Firefox installation folder, which is located in one of these locations, by default:
    #*'''Windows:'''
    #**C:\Program Files\Mozilla Firefox
    #**C:\Program Files (x86)\Mozilla Firefox
    #*'''Mac:''' Delete Firefox from the Applications folder.
    #*'''Linux:''' If you installed Firefox with the distro-based package manager, you should use the same way to uninstall it - see [[Installing Firefox on Linux]]. If you downloaded and installed the binary package from the [http://www.mozilla.org/firefox#desktop Firefox download page], simply remove the folder ''firefox'' in your home directory.
    #Now, go ahead and reinstall Firefox:
    ##Double-click the downloaded installation file and go through the steps of the installation wizard.
    ##Once the wizard is finished, choose to directly open Firefox after clicking the Finish button.
    Please report back to see if this helped you!

  • Problem in compiling JSP page in OC4J 10.1.3.0.0

    Dear all,
    I started the ocj4 container that came with Jdeveloper. After starting the ocj4 server, I try to test it with the Servlet and JSP example. The Servlet Example work fine but I encounter the following error when I run the JSP example.
    2006-01-12 11:08:39.379 NOTIFICATION J2EE JSP0008 Unable to dispatch JSP Page :Exception:oracle.jsp.provider.JspCompileException: <H3>Errors compiling:C:\Program Files\Oracle\j2ee\home\application-deployments\default\defaultWebApp\persist
    ence\_pages\_examples\_jsp\_jsp2\_el\_basic_2d_arithmetic_2e_jsp.java</H3><pre><
    /pre>
    I think this should be a setup problem, please kndly advise.

    After reading the theads in the forum, I am able to get the jsp running by using full path to specify the java executable.
    e.g. C:\Program Files\Java\jdk1.5.0_02\bin\java -jar oc4j.jar
    This should be a path problem. After I set the path variable correctly
    i.e. add C:\Program Files\Java\jdk1.5.0_<version>\bin to PATH environment variable. It work fine. I hope this help the newbie like me. :D
    Indeed, I wonder why we need two jdk for the oc4j. Follow the instruction, I need to install a jdk. However, I find there is another jdk under $ORACLE_HOME\jdk. This is make the situation confusing and saw quite a lot of threads are related to this problem long time ago!

  • Cannot compile servlet program

    I have recently written a servlet program. When I compile the program (let's say "HelloWorld.java"), I've got the following error message:
    package javax.servlet does not exist
    I've download the class files and set the classpath already. Have I missed anything?
    Thx! ^-^

    Maybe you should listen in at
    http://forum.java.sun.com/thread.jsp?forum=45&thread=234654
    He has a similar problem.
    Did you put the servlet.jar in your classpath?

  • Compiling a program

    hi to all !
    i have a problem when i compile a program
    the error is:
    ld: elf error: file /export/soft/linpack/hpl/lib/Sun_Ultra20/libhpl.a(HPL_dlamch.o): elf_getshdr: Request error: class file/memory mismatch
    ld: elf error: file /export/soft/linpack/hpl/lib/Sun_Ultra20/libhpl.a(HPL_dlamch.o): elf_getshdr: Request error: class file/memory mismatch
    ld: fatal: file /opt/SUNWhpc/lib/libmpi.so: wrong ELF class: ELFCLASS32
    tell me someone what does it mean and what can i do
    thanks

    This problem is happened with Solaris 10 and Sun Studio compile with 64bit. You get compile error or dbx will crash when you debug the program.
    Two correct solutions are to have all the Solaris 10 libraries affected by this bug patched or upgrade your system to Solaris 10 update 1. We have patches for our Sun Studio libraries
    SPARC platforms:
    119963-04 (Shared library patch for C++)
    120753-02 (libmtsk patch)
    x86 platforms:
    119964-05 (Shared library patch for C++)
    120754-02 (libmtsk patch)
    But We strongly suggest you to upgrade your OS system to Solaris 10 update 1 or later.
    In the mean time, if you can not do either 2 correct solutions above (means you have to stay with Solaris 10 and can't patch all the libraries), Sun Studio dbx group produced dbx patches as a work around solution for this crash problem.
    If you have Sun Studio 11, install dbx patch 121023 for SPARC and 121616 for x86
    If you have Sun Studio 10, install dbx patch 117844-04 for SPARC and 117845-04 for x86
    -Ngoc

  • Compiling Java Program thro EXEC

    hi..
    I want to compile java programs programatically. I am using exec for that. The problem is there is a error in the i am no getting any message from that Process .will u help me how to solve this
    URGENT
    pyari
    Code Snippet
              try
                                  String command = "cmd /c javac -classpath c:\\j2ee\\home\\ejb.jar -d "+
                                  "c:\\javapr~1\\WeblogicEJBComplier\\tempBuild "+
                                  "C:\\j2ee\\home\\demo\\ejb\\cart\\CartClient.java";
         System.out.println(command);
         Runtime rnt = Runtime.getRuntime();
                                  Process prs = rnt.exec(command);
                                  BufferedReader bfr = new BufferedReader(new InputStreamReader(prs.getInputStream()));
                                  String str = bfr.readLine();
                                  System.out.println(str);
                                  while(str!=null)
                                       System.out.println(str) ;
                                       str = bfr.readLine();
              }catch(Exception eo)
                   System.err.println(eo);

    javac writes the errors in stderr, not in stdout.
    So replace getInputStream() with getErrorStream()...

  • Compiling a program with i486-mingw32-g++ with a static binary[SOLVED]

    Hi,
    I need to compile a program for win with whatever open cross compiler, I tried mingw32-g++, with the following command>
    i486-mingw32-g++ main.cpp main.h `/usr/i486-mingw32/bin/wx-config --libs` `/usr/i486-mingw32/bin/wx-config --cxxflags` -o test.exe
    but now my program depends on the dll lib mingwm10.dll which kind a sucks cause my goal is to have one executable file.
    Is there any other compiler or a command switch to make a static binary ?
    Last edited by gnu_D (2009-08-10 11:07:59)

    Ok, I did searched that, and I come up with this.
    Which means I need to remove the -mthread option, there is only one problem, if I compile like this>
    i486-mingw32-g++ `/usr/i486-mingw32/bin/wx-config --libs` `/usr/i486-mingw32/bin/wx-config --cxxflags` -o test.exe
    then I have to expand the command like this>
    i486-mingw32-g++ main.cpp main.h -Wl,--subsystem,windows -mwindows /usr/i486-mingw32/lib/libwx_mswu_richtext-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_mswu_aui-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_mswu_xrc-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_mswu_qa-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_mswu_html-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_mswu_adv-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_mswu_core-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_baseu_xml-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_baseu_net-2.8-i486-mingw32.a /usr/i486-mingw32/lib/libwx_baseu-2.8-i486-mingw32.a -lwxregexu-2.8-i486-mingw32 -lwxexpat-2.8-i486-mingw32 -lwxtiff-2.8-i486-mingw32 -lwxjpeg-2.8-i486-mingw32 -lwxpng-2.8-i486-mingw32 -lwxzlib-2.8-i486-mingw32 -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 -I/usr/i486-mingw32/lib/wx/include/i486-mingw32-msw-unicode-release-static-2.8 -I/usr/i486-mingw32/include/wx-2.8 -D__WXMSW__-fno-rtti -o
    If someone can scrap me a Makefile which will do that will be lovely.

  • Can't compile Servlet program(error in setting classpath in XP)

    I encountered a similar problem as 'hereispaddy'.
    "I have recently written a servlet program. When I compile the program (let's say "HelloWorld.java"), I've got the following error message:
    package javax.servlet does not exist
    I've download the class files and set the classpath already. Have I missed anything? "
    i would like to ask, how to set the following in Windows XP:
    set CATALINE_HOME=C:\PROGRA~1\APACHE~1.0
    set CLASSPATH=.;%CATALINE_HOME%\COMMON\LIB\SERVLET.JAR;C:\JDK1.4\BIN;
    *ive tried in control panel->system->advanced->environment variables->
    variable name:CATALINE_HOME
    variable value:C:\Program Files\Apache Tomcat4.0 (and)
    variable name:CLASSPATH
    variable value:.;%CATALINE_HOME%\common\lib\servlet.jar;C:\jdk1.4\bin
    but failed!
    Could anyone kindly tell me what's wrong with my setting?
    Thx a lot!!!

    Does Tomcat work? Can run the examples on the home page?
    The only suggestion I have at this point is to get rid of the spaces in
    C:\Program Files\Apache Tomcat4.0
    But I am still in Win98 , so I am just guessing.

  • How can i compile the program?

    hi,everybody:
    I have a program which include the next statments:
    public void println(boolean flag)
    throws IOException
    Object obj = lock;
    obj;
    JVM INSTR monitorenter ;
    print(flag);
    newLine();
    obj;
    JVM INSTR monitorexit ;
    break MISSING_BLOCK_LABEL_26;
    Exception exception;
    exception;
    obj;
    JVM INSTR monitorexit ;
    throw exception;
    how can i compile the program?
    thanks

    Hi,
    I'm trying to figure out how to use this decompiler, I have downloaded it to windows 2000 platform and it unzips to 1 file with extension "1-bin" - OS doesn.'t know what to do with and neither do I ;) - I'm starting out on something here and this tool would be useful.
    Thanks for any install instructions you might have.
    mufc1999
    Hi,
    I've had a similiar problem with decompiling certain
    classes. Try the following decompiler,
    http://jrevpro.sourceforge.net, after using this one,
    the code decompiled fine, this tool is also a
    disassembler and quite a nifty one i might add. :)
    Hope this helps!
    Have Fun!

Maybe you are looking for

  • Communication problem between Cisco 3560 and Cisco SG300.

    Dear Support, I have a Cisco SG300 and Cisco 3560 switches. 3560 is my Core Switch and SG300 is access switch. From 3560 VLAN information is not passed to SG300. 3560 Configuration: interface GigabitEthernet0/23 switchport trunk encapsulation dot1q s

  • Multiple touches on one itunes account

    I have a Ipod touch and my husband wants to get one. I have a few questions. 1. Can both touches uses 1 itune account? 2. Can each touch select certain items to sync or is it all of the apps? 3. If each had a separate account can each snyc to the oth

  • Add a legend or control group to set different settings based on different user scenarios on a button click

    In the settings page of my application, I want to add a group of settings pertaining to a particular setting requirement. So when a user clicks an "Add" button, a legend type control should come up with required set of controls like text boxes and/or

  • Fustrating equality problem, pls help

    Hello ppl. Im here with a rather silly but fustrating problem... I have a conditional like this: String host = request.getRemoteHost(); if(host != "localhost"){ // code... Im the localhost and the value of host is localhost but java thinks otherwise,

  • HR-XML Erecruit mapping error

    Hi, I'm trying to use XI to publish my job offerings. I've imported the HR-XML (1.0/2.0) and ERECRUIT 600 SCs in all their versions. When I open the 'JobPositionPublication2PositionOpening', I get the following error: 'The source or target structure