Urgent: Why org.apache.tomcat.* package does not exist?

i am writing some programs about ldap
my program code has used some packages as the followings
import org.apache.tomcat.core.*;
import org.apache.tomcat.util.*;
import org.apache.tomcat.util.xml.*;
i am using apache + tomcat4.1 server, jsdk1.4
i have set the classpath that contains all the jar files in $TOMCAT_HOME\common\lib
after setting the classpath, i compiled the code
it said the above packages does not exist
where should i find those packages?
Aren't they in the tomcat i installed?
PLX HELP

for example, i want to use the class
org.apache.tomcat.core.Context to create a class
object.Then you would want to:
import org.apache.tomcat.core.Context;
-or-
import org.apache.tomcat.core.*;
Note how that is different than your original:
import org.apache.tomcat.*;i just use as an example import org.apache.tomcat
but i cannot find org.apache.tomcat.core or even any org.apache.tomcat.*
so that means i havn't include the correct jar file in the classpath or no corresponding package are stored in the tomcat4.1
i just want to know what jar file contains such stuff.
i think it should be a silly problem. So there should be someone know it.

Similar Messages

  • Package does not exist

    hi guys,
    wanted to use JavaBeans, but my java code doesn't find the package.
    i have downloaded : commons-beanutils-1.8.0.zip (from jakarta web)
    i have placed this zip file (commons-beanutils-1.8.0) inside www/tomcat/lib/ , and also set the classpath to : c:/www/tomcat/lib/commons-beanutils-1.8.0;
    but still when i compile my xxxx.java file, i get an error saying :
    package org.apache.commons.beanutils does not exist
    import org.apache.commons.beanutils.*;
    any useful idea, will be appreciated ....
    Edited by: c_skyscraper on Aug 6, 2009 8:48 PM
    inside the zip file i have the folders : org/apache/commons/beanutils/xxxx folders and in my java code i have used the import statement as follow:
    import org.apache.commons.beanutils.*;
    Edited by: c_skyscraper on Aug 6, 2009 8:49 PM

    no body could notice ??!!!
    classpath = c:/www/tomcat/lib/commons-beanutils-1.8.0.jar
    i forgot the extension (.jar) funny.

  • Package does not exist even though the package is included in .java file

    package djvusearching;
    import org.apache.lucene.analysis.cjk.CJKAnalyzer;
    import org.apache.lucene.analysis.standard.StandardAnalyzer;
    import org.apache.lucene.queryParser.ParseException;
    import org.apache.lucene.queryParser.QueryParser;
    import org.apache.lucene.search.Hits;
    import org.apache.lucene.search.IndexSearcher;
    import org.apache.lucene.search.Query;
    import org.apache.lucene.search.Sort;
    import org.apache.lucene.search.SortField;
    import org.apache.lucene.store.Directory;
    import org.apache.lucene.store.FSDirectory;
    package org.apache.lucene.analysis.cjk does not exist;
    package org.apache.lucene.queryParser does not exist;
    package org.apache.lucene.queryParser does not exist;
    package org.apache.lucene.search does not exist;
    package org.apache.lucene.search does not exist;
    package org.apache.lucene.search does not exist;
    package org.apache.lucene.search does not exist;
    package org.apache.lucene.search does not exist;
    package org.apache.lucene.store does not exist;
    package org.apache.lucene.store does not exist;
    Here the main public class name is "DjvuSearching" which is called like
    as below :
    public static void main(String args[]) throws IOException, ParseException{
              DjvuSearching search = new DjvuSearching();
              search.Searching(args);
         }

    Have you included the package in your classpath?

  • Org.apache.tomcat.TcpConnection source not found error.

    Hi,
    When I tried to remotely debug a servlet with Sun's J2EEServer, instead of stopping at the breakpoint the Jdev31 stopped at this line:
    //JDeveloper API Decompiler STUB ...
    and when I pressed F8 a messagebox appeared:
    org.apache.tomcat.TcpConnection source not found.
    I think that I have missed someting installing the JDev.
    Your prompt help is higly appreciated,
    Reza

    Hi,
    I just had the same problem and navigated to this page here in hope for a solution...
    However I've solved the problem now. On Eclipse, do the following.
    1) Right-click on the added Jar-file (which is producing the problem)
    2) On the popup-menu choose "Build Path" and "Configure Build Path..."
    3) On the opening preference window, click the checkbox of the Jar
    This is probably necessary because the jar has to be exported such that the simulator is able to execute it.
    Greets,
    Juri
    http://juri-strumpflohner.blogspot.com

  • Package org.jdesktop.jdic.browser does not exists

    I am geting error
    'package org.jdesktop.jdic.browser does not exists' after moving to JDK 1.6_27 from 1.5_06
    Which jar file do i have to add for this error to go away?
    Can anyone helpme with the file name and path to download from?
    Thanks

    Thanks for the reply.I have moved to java 6 now and I dont want to use JDIC as no documentaion or download is available .
    Is there any alternative for jdic web browser in Java 6.
    Earlier in Java 5 I was using the below code to embedd the browser in the jpanel
    org.jdesktop.jdic.Webbrowser webbrowser=new WebBrowser
    webBrowser.seturl(pdfUrl)
    Jpanel testPanel=new jPanel();
    jpanel.add(webBrowser,BorderLayout.CENTER)
    here pdfURl is the url of a pdf file which I want to open in browser which is embed in jpanel.
    How can I do the same thing without the webbrowser.
    I read the java.awt.desktop browse method but it opens in a new window ,how can I embedd it in the jpanel?
    Please help.

  • Package Does Not Exist on NetBeans

    Hi
    I have just downloaded commons-dbcp-1.2.1 and have had trouble trying to integrate it into NetBeans so that my code will complie.
    I have tried several things to try and make this work firstly I placed the JAR file in to my java instalations lib folder, and then set the classpath environment variable to include this, this however did not work.
    I then went into Netbeans and discoved under tools something called Library Manager, I created a new Library called DBCP and added links to the classpath sources and java docs, still it does not work.
    Finally I searched around a bit more and tried doing the same using the Java Platform Manager under the Tools menu, still no luck
    The error I am getting is as follows and occurs on the import statements
    package org.apache.commons.dbcp does not existThe following is the import statements I am using
    import org.apache.commons.dbcp.ConnectionFactory;
    import org.apache.commons.dbcp.DriverManagerConnectionFactory;
    import org.apache.commons.dbcp.PoolableConnectionFactory;
    import org.apache.commons.dbcp.PoolingDataSource;I am using NetBeans 5.5 with Java jdk1.6.0
    Anyone out there can tell me what I'm doing wrong, and how to fix this please?... oh and using . completion works while typing the code... just won't compile.

    See if this helps. This is a minimal explanation of packages.
    Assume that your programs are part of a package named myapp, which is specified by this first line in each source file:
    package myapp;
    Also assume that directory (C:\java\work\) is listed in the CLASSPATH list of directories.
    Also assume that all your source files reside in this directory structure: C:\java\work\myapp\
    Then a statement to compile your source file named aProgram.java is:
    C:\java\work\>javac myapp\aProgram.java
    And a statement to run the program is:
    java myapp.aProgram
    (This can be issued from any directory, as Java will search for the program, starting the search from the classpath directories.)
    Explanation:
    Compiling
    A class is in a package if there is a package statement at the top of the class.
    The source file needs to be in a subdirectory structure. The subdirectory structure must match the package statement. The top subdirectory must be in the classpath directory.
    So, you generate a directory structure C:\java\work\myapp\ which is the [classpath directory + the package subdirectory structure], and place aProgram.java in it.
    Then from the classpath directory (C:\java\work\) use the command: javac myapp\aProgram.java
    Running
    Compiling creates a file, aProgram.class in the myapp directory.
    (The following is where people tend to get lost.)
    The correct name now, as far as java is concerned, is the combination of package name and class name: myapp.aProgram (note I omit the .class) If you don't use this name, java will complain that it can't find the class.
    To run a class that's NOT part of a package, you use the command: java SomeFile (assuming that SomeFile.class is in a directory that's listed in the classpath)
    To run a class that IS part of a package, you use the command java myapp.aProgram (Note that this is analogous to the command for a class not in a package, you just use the fully qualified name)

  • Package does not exist even though I set classpath right!

    Hi, my JSP got an error message saying "Package does not exist" at line
    <% import ="org.jfreechart.*"%>
    And I have put the myjar.jar file containing the above classes into blabla\WEB-INF\classes,(where blabla is my current working directory) and set my classpath= blabla\WEB-INF\classes
    It does not either if set classpath= blabla\WEB-INF\classes\myjar.jar
    Anybody could give suggestion? By the way I am using Tomcat.

    your .jar files should be in WEB-INF/lib

  • Compiler exception - package does not exist?

    I am new to NWDS and J2EE.  I followed the steps in the tutorial as indicated in the below link:
    http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/library/netweaver-application-server/_netweaver-application-server/a-c/Creating%20your%20First%20J2EE%20Application.pdf
    I did everything inside up to the last moment after I deployed my EAR and tried to run from the portal but got Application error.  I checked the defaultTrace log file from the portal server and notice these errors:
    #1.5 #001A6431E0FE0020000000750000155C0004B9B284863A19#1330076285575#com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl#sap.com/CalculatorEar#com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl#Guest#0##40C36AF65ECB11E18721000000978DDA#40c36af65ecb11e18721000000978dda-0#40c36af65ecb11e18721000000978dda#SAPEngine_Application_Thread[impl:3]_21##0#0#Error#1#/System/Server/WebRequests#Plain###application [Calculator] Processing HTTP request to servlet [jsp] finished with error.
    The error is: com.sap.engine.services.servlets_jsp.server.jsp.exceptions.CompilingException: Error while executing the compilation process: [G:/usr/sap/EPD/JC00/j2ee/cluster/server0/apps/sap.com/CalculatorEar/servlet_jsp/Calculator/work/jsp_Calculator1330076284538.java:41: package com.sap.examples.calculator.beans does not exist
              com.sap.examples.calculator.beans.CalcProxy calc = null;
                                                     ^
    G:/usr/sap/EPD/JC00/j2ee/cluster/server0/apps/sap.com/CalculatorEar/servlet_jsp/Calculator/work/jsp_Calculator1330076284538.java:42: package com.sap.examples.calculator.beans does not exist
                   calc = (com.sap.examples.calculator.beans.CalcProxy)pageContext.getAttribute("calc", PageContext.SESSION_SCOPE);
                                                                     ^
    G:/usr/sap/EPD/JC00/j2ee/cluster/server0/apps/sap.com/CalculatorEar/servlet_jsp/Calculator/work/jsp_Calculator1330076284538.java:48: package com.sap.examples.calculator.beans does not exist
                        calc = (com.sap.examples.calculator.beans.CalcProxy) Beans.instantiate(getClass().getClassLoader(), "com.sap.examples.calculator.beans.CalcProxy");
                                                                             ^
    3 errors
    The thing I don't understand is the "comp.sap.examples.calculator.beans" class has already been included inside the EAR (I used my zip tool to check the EAR file and confirmed it's there), why did the compiler still complain that the package does not exist?  Any great guys & gals out there can help this poor newbie who spent the past 5 hours searching for Google for answers but couldn't find any??
    Thank you.
    Brian

    Perhaps I should give out more information about this problem.
    The EAR file contains a WAR file and a JAR file. 
    The WAR file contains a JSP and it contains codes to refer to a java proxy class of package comp.sap.examples.calculator.beans.CalcProxy.
    So it seems the compilation error is triggered when it tries to compile the WAR file.
    I checked the structure of the WAR file using a zip tool.
    At the base it contains this:
    WEB-INF (a folder)
    Calculator.jsp (the JSP file)
    Inside the WEB-INF folder is these:
    classes (a folder)
    web-j2ee-engine.xml
    web.xml
    Inside the classes folder is a tree of subfolders to describe the structure of the CalcProxy class:
    classes -> comp -> sap -> examples -> calculator -> beans -> CalcProxy.class
    So the java class file and the JSP file is in the same bundle of the WAR file.
    Why the compiler is not able to find the class file inside the JSP?

  • Error:  microedition.io.* package does not exists

    Been at this for a few days...frustration...funny.
    Using JDK 1.6 NetBeant 6.8 with WTK 2.5.2 on XP
    Was able to resolve the javax.bluetooth.* package does not exists and xylostudio by doing the following to add the libraries to the project file.
    1) Tools > Libraries
    2) in the pop up Library Manager window click 'New Library'
    3) in the pop up New Library window typed 'bluetooth' > OK
    3) highlight 'bluetooth' in Library Manager scroll menu on left
    4) click add JAR/Folder
    5) added jsr082 from C;\WTK2.5.2_01\lib\jsr082.jar
    6) click OK
    7) right click project and select properites
    8) highlight the library node under Categories on the left side of the Project Properties window
    9) 'Add Library' created 'bluetooth'
    10) click OK
    When the process was followed to resolve the microedition.io.* package does not exist error it was unsuccessful.
    The difference in the two processes being New Library name: 'microedition' and added jsr75, MIDPapi20, jsr118, then MIDPapi21 with no resolution to the errors.
    Also add the jsr75, MIDPapi20, jsr118, and MIDPapi21 directly to the project by clicking the 'Add JAR/Folder' button in the Project Properties window.
    Here is the Output:
    init:
    deps-clean:
    Updating property file: C:\Scholastic\4340MS\REU\ItsAForum\build\built-clean.properties
    Deleting directory C:\Scholastic\4340MS\REU\ItsAForum\build
    clean:
    init:
    deps-jar:
    Created dir: C:\Scholastic\4340MS\REU\ItsAForum\build
    Updating property file: C:\Scholastic\4340MS\REU\ItsAForum\build\built-jar.properties
    Created dir: C:\Scholastic\4340MS\REU\ItsAForum\build\classes
    Created dir: C:\Scholastic\4340MS\REU\ItsAForum\build\empty
    Compiling 8 source files to C:\Scholastic\4340MS\REU\ItsAForum\build\classes
    C:\Scholastic\4340MS\REU\ItsAForum\src\mobile\communication\Server.java:8: cannot find symbol
    symbol : class Connector
    location: package javax.microedition.io
    import javax.microedition.io.Connector;
    C:\Scholastic\4340MS\REU\ItsAForum\src\mobile\communication\Server.java:9: cannot find symbol
    symbol : class StreamConnection
    location: package javax.microedition.io
    import javax.microedition.io.StreamConnection;
    C:\Scholastic\4340MS\REU\ItsAForum\src\mobile\communication\Server.java:10: cannot find symbol
    symbol : class StreamConnectionNotifier
    location: package javax.microedition.io
    import javax.microedition.io.StreamConnectionNotifier;
    C:\Scholastic\4340MS\REU\ItsAForum\src\mobile\communication\Server.java:19: cannot find symbol
    symbol : class StreamConnectionNotifier
    location: class mobile.communication.Server
    private StreamConnectionNotifier server = null;
    ^
    C:\Scholastic\4340MS\REU\ItsAForum\src\mobile\communication\Server.java:20: cannot find symbol
    symbol : class StreamConnection
    location: class mobile.communication.Server
    private StreamConnection connection = null;
    ^
    C:\Scholastic\4340MS\REU\ItsAForum\src\mobile\communication\Server.java:58: cannot find symbol
    symbol : class StreamConnectionNotifier
    location: class mobile.communication.Server
    server = (StreamConnectionNotifier)Connector.open(URL);
    ^
    C:\Scholastic\4340MS\REU\ItsAForum\src\mobile\communication\Server.java:58: cannot find symbol
    symbol : variable Connector
    location: class mobile.communication.Server
    server = (StreamConnectionNotifier)Connector.open(URL);
    ^
    7 errors
    C:\Scholastic\4340MS\REU\ItsAForum\nbproject\build-impl.xml:413: The following error occurred while executing this line:
    C:\Scholastic\4340MS\REU\ItsAForum\nbproject\build-impl.xml:199: Compile failed; see the compiler error output for details.
    BUILD FAILED (total time: 4 seconds)
    any information would be much appreciated. Thanks,
    LD

    By completing the process shown in below link and adding the bluecove jar file directly to the project as of the reply post suggests, all compilation errors were corrected.
    http://forums.netbeans.org/viewtopic.php?t=22823&start=0&postdays=0&postorder=asc&highlight=microedition
    Thanks me for point me in the right direction,
    Me is happy.

  • Weird.. package does not exist

    I know this is a common question and i searched the forum but nothing there is what I need.
    First of all I have the 'main' source file under a directory: d:\Model1_SecurityService\
    There is a subdirectory securityservice, under which there are several other directories according to the packages I have.
    Another directory I have is: d:\Model1_Classes
    When I compile the main program from d:\Model1_SecurityService> typing the following: javac -d d:\Model1_Classes testmain.java
    When I do this, i get an error message saying package does not exist for each package I import in the main file.
    My classpath has d:\Model1_Classes in it and my path has .; etc.
    Anyone know what the problem is?
    Everything used to work but i continued working on another computer and after copying these changes to this one, i'm getting these errors...

    So, for example if you had a class Baz in package
    com.foo.bar and you're using d:\Model1_Classes as your
    root directory for your compiled code, then there
    should be a directory structure
    d:\Model1_Classes\com\foo\bar
    which contains the compiled class Baz.class. Is this
    what you have?yes
    I found the problem though, apperently i need . in my classpath as well; don't know why actually, but it works now.
    thanks for wanting to help though

  • Java.math package does not exist!!!

    hi java experts, i really desperately need some help. ihave been trying to compile a java program i have written that imports the java.math package as i am using the BigInteger class. I am using SUN ONE STUDIO ME 4 and have j2se SDk installed. when i try to build the program in the IDE, it gives me an error message saying the java.math package does not exist. i can't understand why. i think it's an IDE problem. i tried mounting the filesystem and i mounted almost a million times in diff ways but it still can't compile. i can't find the directory of the java.math to mount into. anyway i tried to compile it at the command prompt and it can compile but with errors... so i figure that i do have the java.math class on my system just that the IDE jsut can't recognise it. i am at my wits end and gonna go mad if someone doesn't please help me.
    adeline from singapore

    Cross-posted at http://forum.java.sun.com/thread.jsp?thread=293132&forum=54&message=1155073

  • Import javax.servlet.* gives error "package does not exist"

    I am working through Monica Pawlan's book "Essentials of Java PL".
    My PC runs Windows2000 prof. I have downloaded and installed j2sdk-1_3_1_01-win.exe in c:\jdk1.3.1_01
    I have downloaded and installed tomcat4.0 (jakarta-tomcat-4.0.zip) into c:\jakarta-tomcat-4.0
    CATALINA_HOME is set to c:\jakarta-tomcat-4.0 and CLASSPATH is set to .;C:\jakarta-tomcat-4.0\common\lib\servlet.jar
    I can compile an applet starting:
    import java.awt.Color;
    import java.awt.BorderLayout;
    import java.awt.event.*;
    import javax.swing.*;
    //Class Declaration
    class SwingUI extends JFrame implements ActionListener { ... }
    but trying to compile my servlet starting:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class ExampServlet extends HttpServlet { ... }
    gives me the error (import javax.servlet.*) "package does not exist".
    Any pointers on this immediate problem? and is my book out of date?
    Many thanks,
    James Towell

    You downloaded the Java 2 SDK Standard Edition, but you need to also download the Enterprise Edition if you want to write programs that use enterprise features.

  • Imported package does not exist

    Hello
    I'm importing a package com.borland.jbcl.layout.* into my java
    program to do some GUI layout but kept getting the error that the package does not exist. Can someone explain why and the solution to this problem please?
    Thanks
    Danny

    If the class you are trying to import is in a .jar file, you need to add the jar to your classpath CLASSPATH=c:\dir1\...\MyJar.jar. If the file is in a directory you need to include the base directory in the classpath CLASSPATH=c:\basedir

  • Import statement reports 'package does not exist'

    I am seeing another odd error. I'm working on learning how to read and write to text files, and I have 2 errors reported, but one is obviously caused by the other. My package is labeled as such (copy>paste of package line):
    package michaelchristopherp4db;
    and the import line is this (copy>paste again):
    import michaelchristopherp4db.ProductRecord;
    However, Netbeans looks at the import and flags it red, saying package michaelchristopherp4db does not exist. this caused my line:
    ProductRecord product = new ProductRecord();
    to also be flagged in red as it cannot find the ProductRecord class. However, it has no problems with any of the product.get* method calls. Thank you in advance for any ideas or input.
    here is the full code of the file reporting the errors.
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package michaelchristopherp4db2;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.lang.IllegalStateException;
    import java.lang.SecurityException;
    import java.util.NoSuchElementException;
    import java.util.Formatter;
    import java.util.FormatterClosedException;
    import java.util.Scanner;
    import michaelchristopherp4db.ProductRecord;
    /*  @author info
    public class readTxt
        private Scanner txtfile;
        private Formatter wishList;
        private Formatter giftIdeas;
        private Formatter priceError;
        //let user open file
        public void openFile()
        {//open method openFile
            try
            {//open try block
                priceError = new Formatter("priceerror.txt");//open object for items with invalid prices
                giftIdeas = new Formatter("giftideas.txt");//open object for gift ideas
                wishList = new Formatter("wishlist.txt");//open object for wish list
                txtfile = new Scanner(new File("products.txt"));//tell the compiler which file to use for input
            }//close try block
            catch (FileNotFoundException fileNotFoundException)
            {//open file not found catch block
                System.err.println("Error opening or creating file.");
                System.exit(1);
            }//close file not found catch block
            catch ( SecurityException securityException )
            {//start catch for SecurityException
                System.err.println("File Write access is denied.");
                System.exit(1);//END PROGRAM
            }//end catch
        }//close openFile method
        public void readProducts()
        {//open readProducts method
            ProductRecord product = new ProductRecord();//create object to hold read data
            //print headers for for output columns
            System.out.printf("%-10s%-12s%10s\n", "Product ID", "Product Name", "Price");
            try //read records from the file
            {//open try block
                while (txtfile.hasNext())
                {//open while
                    product.setproductID(txtfile.nextInt());//get productID
                    product.setproductName(txtfile.next());//get product name
                    product.setproductPrice(txtfile.nextDouble());//get product price
                    //print collected product details
                    System.out.printf("%-10d%-12s%10.2f\n", product.getproductID(),
                            product.getproductName(), product.getproductPrice());
                    if (product.getproductPrice()>50.0)
                    {//open if to store items $50 or more to wishlist.txt
                        wishList.format("%-10d%-12s%10.2f\n", product.getproductID(),
                                product.getproductName(), product.getproductPrice());
                    }//close if $50 or greater
                    else if (product.getproductPrice()<0.0)
                    {//open if less than zero
                        priceError.format("%-10d%-12s%10.2f\n", product.getproductID(),
                                product.getproductName(), product.getproductPrice());
                    }//close if less than zero
                    else
                    {//open else for gift ideas from $0 to $50
                        giftIdeas.format("%-10d%-12s%10.2f\n", product.getproductID(),
                                product.getproductName(), product.getproductPrice());
                    }//close else for gift ideas
                }//close while
            }//close try block
            catch (NoSuchElementException elementException)
            {//open no such element exception catch
                System.err.println("File improperly formed.");
                txtfile.close();//close text file
                System.exit(1);
            }//close no such element exception catch
            catch (IllegalStateException stateException)
            {//open illegal state exception catch
                System.err.println("Error reading from file.");
                System.exit(1);
            }//close illegal state exception catch
        }//close readProducts method
        //close file and end application
        public void closeFile()
        {//open closeFile method
            if (txtfile != null)
                txtfile.close();//close file
        }//close closeFile method
    }//end application readTxtAnd the code at the top of the class I am trying to import (so you can see the package I am trying to import)
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package michaelchristopherp4db;
    *  @author
    public class ProductRecord {

    I am embarrassed to admit this, but I am completely lost on the last question.. I have no clue wether it is a convenience for development or a dependancy, as I have not learned those terms or distinctions yet. For now I copied the ProductRecord file into my new project folder and renamed it's project line to match the new project name. However, while that eliminated the package does not exist error, and netbeans reports no errors now, when I run the program it does not write the new files. I have made some modifications to the code tryiing to get it to write properly but so far no luck in makingit work. Here is the current version of the file not running right.
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package michaelchristopherp4db2;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.lang.IllegalStateException;
    import java.lang.SecurityException;
    import java.util.NoSuchElementException;
    import java.util.Formatter;
    import java.util.FormatterClosedException;
    import java.util.Scanner;
    /*  @author
    *   Michael Christopher
    *   IT215-1004D-03
    *   December 30, 2010
    *   Phase 4 DB 2
    public class readTxt
        private Scanner txtfile;
        private Formatter wishList;
        private Formatter giftIdeas;
        private Formatter priceError;
        //let user open file
        public void openFile()
        {//open method openFile
            try
            {//open try block
                priceError = new Formatter("priceerror.txt");//open object for items with invalid prices
                giftIdeas = new Formatter("giftideas.txt");//open object for gift ideas
                wishList = new Formatter("wishlist.txt");//open object for wish list
                txtfile = new Scanner(new File("products.txt"));//tell the compiler which file to use for input
            }//close try block
            catch (FileNotFoundException fileNotFoundException)
            {//open file not found catch block
                System.err.println("Error opening or creating file.");
                System.exit(1);
            }//close file not found catch block
            catch ( SecurityException securityException )
            {//start catch for SecurityException
                System.err.println("File Write access is denied.");
                System.exit(1);//END PROGRAM
            }//end catch
        }//close openFile method
        public void readProducts()
        {//open readProducts method
            ProductRecord product = new ProductRecord();//create object to hold read data
            //print headers for for output columns
            wishList.format("%-10s%-12s%10s\n", "Product ID", "Product Name", "Price");
            giftIdeas.format("%-10s%-12s%10s\n", "Product ID", "Product Name", "Price");
            priceError.format("%-10s%-12s%10s\n", "Product ID", "Product Name", "Price");
            try //read records from the file
            {//open try block
                while (txtfile.hasNext())
                {//open while
                    product.setproductID(txtfile.nextInt());//get productID
                    product.setproductName(txtfile.next());//get product name
                    product.setproductPrice(txtfile.nextDouble());//get product price
                    if (product.getproductPrice()>50.0)
                    {//open if to store items $50 or more to wishlist.txt
                        wishList.format("%-10d%-12s%10.2f\n", product.getproductID(),
                                product.getproductName(), product.getproductPrice());
                    }//close if $50 or greater
                    else if (product.getproductPrice()<0.0)
                    {//open if less than zero
                        priceError.format("%-10d%-12s%10.2f\n", product.getproductID(),
                                product.getproductName(), product.getproductPrice());
                    }//close if less than zero
                    else
                    {//open else for gift ideas from $0 to $50
                        giftIdeas.format("%-10d%-12s%10.2f\n", product.getproductID(),
                                product.getproductName(), product.getproductPrice());
                    }//close else for gift ideas
                }//close while
            }//close try block
            catch (NoSuchElementException elementException)
            {//open no such element exception catch
                System.err.println("File improperly formed.");
                txtfile.close();//close text file
                System.exit(1);
            }//close no such element exception catch
            catch (IllegalStateException stateException)
            {//open illegal state exception catch
                System.err.println("Error reading from file.");
                System.exit(1);
            }//close illegal state exception catch
        }//close readProducts method
        //close file and end application
        public void closeFile()
        {//open closeFile method
            if (txtfile != null)
                txtfile.close();//close file
        }//close closeFile method
    }//end application readTxtwith the System.out.printf lines in the ReadProducts method it would properly print to screen all of the elements in the products.txt file, it is not outputting to the other .txt files at all. I will be exploring the closeFile method in case the error is due to not closing all of the files in that method, but does anyone else see what might cause it not to output the data to the appropriate .txt files?

  • Package does not exist error-message

    When I try to compile a java servlet with the following piece of code I get a compilation error referring to the import statement.
    I have just included the initial import statements. A large number of errors follow, as a result of this 'package does not exist error-message'.
    Has anyone encountered this or any ideas?
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.* ;
    import java.io.* ;
    import java.sql.* ;
    import com.ericsson.snf.mps.mppapi.mtlr.*;
    The error messages come from the 'import com.ericsson.snf.........' statement.
    I am trying to integrate ericsson software, into my application.
    Thanks,
    java-mobile-user

    That's probably because you are trying to integrate j2me suff with j2se/ee. That won't work without los of extra work..

Maybe you are looking for

  • HP Color LaserJet CP2025dn Printer Wired Connectivity and have USB simultaneously?

    Hello to all; Thank you in advance. I have a HP Color LaserJet CP2025dn Printer.  The question, can I use ethernet connection and have USB simultaneously?  Ethernet is faster, right? Currently, I have the printer connected to network via Ethernet Wir

  • Scheduling of Process Chain

    Hi Gurus I am strugling to reschedule a Process Chain to the folling criteria 6AM to 6PM  one hourly 6PM to 6AM two hourly (night time the chain must run every 2 hours ) Thank You Donn

  • Using 36.0.1 clicking Help does not show the latest update 36.0.3. Why?

    I feel nervous about directly using pop-up reminder messages to update software. I am aware that there are frequently false messages that appear to be from a company whose software I use, and that clicking on them to update, can cause seious problems

  • Iphoto is not showing faces anymore.

    Hello everyone. For some reason, my Iphoto is not showing faces anymore. All faces I've cataloged are still there, but it shows only the names. And there are many more others to identify, but It's impossible, because the menu shows only black thumbna

  • Costing items for material 21000001 in plant 204A without cost element.

    Dear Friends, Kindly suggest solution to below problem, Costing items for material 21000001 in plant 204A without cost element. Message no. CK597 Diagnosis The itemization for material 21000001 in plant 204A contains valuation-relevant items without