Java doesn't recognize jasperReport classes

Hi guys could you please help me with my program it doesn't work so you guys might rectify the problem. Here is my code and errors:
package helloWorld;
import java.io.*;
import java.sql.*;
import javax.swing.*;
import java.util.*;
import net.sf.jasperreport.engine.JasperCompileManager;
import net.sf.jasperreport.engine.JasperFillManager;
import net.sf.jasperreport.engine.JasperPrintManager;
import net.sf.jasperreport.engine.JasperExportManager;
import net.sf.jasperreport.view.JasperDesignViewer;
class jasperExample
public static void main(String[] args)
System.out.println("Hello World! for Jasper Example");
try
JasperDesign jasperDesign = JasperManager.loadXmlDesign(samke.xml);
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
Connection con1 = DriverManager.getConnection("com.mysql.jdbc.Driver","root","");
Statement s1 = con1.createStatement();
java.util.Map parameters = new java.util.HashMap();
parameters.put("Tittle","Test JasperReport");
JasperPrint report = JasperFillManager.fillReport(jasperReport, parameters, con1);
JasperExportManager.exportReportToPdfFile(report,"report1.pdf");
JasperViewer.viewReport(report);
catch(Exception ex)
System.out.print("Error!");
These are the errors
C:\Unify\NXJ\j2sdk\bin>javac sbo.java
sbo.java:6: package net.sf.jasperreport.engine does not exist
import net.sf.jasperreport.engine.JasperCompileManager;
^
sbo.java:7: package net.sf.jasperreport.engine does not exist
import net.sf.jasperreport.engine.JasperFillManager;
^
sbo.java:8: package net.sf.jasperreport.engine does not exist
import net.sf.jasperreport.engine.JasperPrintManager;
^
sbo.java:9: package net.sf.jasperreport.engine does not exist
import net.sf.jasperreport.engine.JasperExportManager;
^
sbo.java:10: package net.sf.jasperreport.view does not exist
import net.sf.jasperreport.view.JasperDesignViewer;
^
sbo.java:19: cannot resolve symbol
symbol : class JasperDesign
location: class helloWorld.jasperExample
JasperDesign jasperDesign = JasperManager.loadXmlDesign(samke.xml);
^
sbo.java:19: cannot resolve symbol
symbol : variable samke
location: class helloWorld.jasperExample
JasperDesign jasperDesign = JasperManager.loadXmlDesign(samke.xml);
^
sbo.java:19: cannot resolve symbol
symbol : variable JasperManager
location: class helloWorld.jasperExample
JasperDesign jasperDesign = JasperManager.loadXmlDesign(samke.xml);
^
sbo.java:20: cannot resolve symbol
symbol : class JasperReport
location: class helloWorld.jasperExample
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
^
sbo.java:20: cannot resolve symbol
symbol : variable JasperCompileManager
location: class helloWorld.jasperExample
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
^
sbo.java:26: cannot resolve symbol
symbol : class JasperPrint
location: class helloWorld.jasperExample
JasperPrint report = JasperFillManager.fillReport(jasperReport, parameters, c
on1);
^
sbo.java:26: cannot resolve symbol
symbol : variable JasperFillManager
location: class helloWorld.jasperExample
JasperPrint report = JasperFillManager.fillReport(jasperReport, parameters, c
on1);
^
sbo.java:27: cannot resolve symbol
symbol : variable JasperExportManager
location: class helloWorld.jasperExample
JasperExportManager.exportReportToPdfFile(report,"report1.pdf");
^
sbo.java:28: cannot resolve symbol
symbol : variable JasperViewer
location: class helloWorld.jasperExample
JasperViewer.viewReport(report);
^
14 errors
Help me guys I am burning

1. right click ur "my computer" icon.
2. then properties -> advanced -> Enviroment variable
3. user variable - > add
4. add two variavle
i.
Name : JAVA_HOME
Value : jdk home
ii
Name : PATH
Value : .; jdk bin path ; tomcat path

Similar Messages

  • Java Doesn't Recognize Something That Exists?

    I'm writing an XML checker for a homework assignment. I'm using a stack which uses a double linked list which uses nodes with a generic data type.
    I ran into a problem after testing the program for the first time. I got a NullPointerException error at the instance where I tried to add a new node to the head. After a little digging I found out that apparently Java doesn't remember that I set the successor of "head" to be "tail". I've already spent 20 minutes going over the code that sets the tail as head's successor but I just can't see what I did wrong.
    Exception in thread "main" java.lang.NullPointerException
         at DLLNode.setNext(DLLNode.java:59)
         at DLLNode.<init>(DLLNode.java:17)
         at DLL.<init>(DLL.java:20)
         at Stack.<init>(Stack.java:11)
         at ParseTokens.<init>(ParseTokens.java:9)
         at Driver.main(Driver.java:16)The program is already too long to post here and broken up into multiple classes, so I will only post the important stuff. Note: Token is just a Record class that keeps two Strings, type and tagName for the xml tag to store.
    DLLNode.java //node with generic datatype T
         private T data;
         private DLLNode<T> successor;
         private DLLNode<T> predecessor;
         public DLLNode(T d, DLLNode<T> next, DLLNode<T> prev) {
              this.setNodeData(d);
              this.setNext(next); //line 17
              this.setPrev(prev);
           public T getNodeData() {
                return this.data;
           public void setNodeData(T newData) {
                this.data = newData;
           public DLLNode<T> getNext() {
                return this.successor;
           public void setNext(DLLNode<T> newNext) {
                this.successor = newNext;
                System.out.println(newNext.toString()); //zeroed in on the problem being here; throws NullPointerException; line 59
           public DLLNode<T> getPrev() {
                return this.predecessor;
           public void setPrev(DLLNode<T> newPrev) {
                this.predecessor = newPrev;
           }DLL.java //manages the DLLNode objects
         private DLLNode<T> head;
         private DLLNode<T> tail;
    //other vars
         public DLL() {
              this.setHead(new DLLNode<T>(null, tail, null)); //problem is probably here; after this, java doesn't see tail as head's successor; //line 20
              this.setTail(new DLLNode<T>(null, null, head));
              this.setSize(0);
           public void setHead(DLLNode<T> value) {
                this.head = value;
           public void setTail(DLLNode<T> value) {
                this.tail = value;
         public boolean addAtHead(T dllData) {
              DLLNode<T> newNode = new DLLNode<T>(dllData, this.head.getNext(), this.head);          
              this.getHead().getNext().setPrev(newNode); //original NullPointerException thrown here at the first instance of this method being used
              this.getHead().setNext(newNode);
              this.setSize(this.getSize() + 1);
              return ((newNode != null) && (newNode.getNext() != null) &&
                        (newNode.getPrev() != null));
         }Stack.java //manages a DLL object as a stack
         private DLL<T> dll;
         public Stack() {
              dll = new DLL<T>(); //line 11
              this.setSize(dll.getSize());
           public void push(T data) {
                dll.addAtHead(data); //original NullPointerException at first instance of push() being used
           }ParseTokens.java //class to actually go through the xml and list what it finds
         private Stack<Token> stack;
         public ParseTokens() {
              stack = new Stack<Token>(); //original error; line 9
         }Driver.java //main
    ParseTokens parse = new ParseTokens();//line 16Thank you for any help.
    Edited by: WhoCares357 on Feb 16, 2010 5:10 PM
    Edited by: WhoCares357 on Feb 16, 2010 5:17 PM

    A user on another forum h(http://preview.tinyurl.com/yjqx4a9) helped me find the problem. I had to create the head and tail first and then point them at each other. Thanks for all the help here.
    @flounder Even though I've already solved my problem I am still confused by what you're saying. The double linked list I created has two placeholders so that I don't have to worry about how many nodes are included. To connect my new node I start at the head and point at whatever is connected to the head (whether it is the tail or another node) to set the successor and predecessor for the new node. I then break the old connections (from the head to the old node after it) and connect them to the new node. I don't see a problem in this, but I am most likely not understanding your concern.
    I don't really want to let this go, because there might be a problem in my code that I don't see right now.
    @AndrewThompson64 I'll use that the next time I have a problem. Thanks.

  • Java doesn't recognize VectorList methods

    I get the following error trying to use Vector methods.
    ----jGRASP exec: javac -g /home/eugene/javafiles/book.java
    book.java:20: cannot find symbol
    symbol  : method elementAt(int)
    location: interface java.util.List<java.lang.String>
                   temp += author.elementAt( i ) + " ";
                                 ^
    1 error
    ----jGRASP wedge: exit code for process is 1.
    ----jGRASP: operation complete.
    import java.util.*;
    public class book
         private String title = "";
    //     String author[] = new String[ 4 ];
    /* Make author private */
         List<String> author = new Vector<String>();
         String publisher = "";
         int isbn = 0;
         double price = 0;
         int stock = 0;
    /*  ---------------------------------------- HERE IS THE PROBLEM CODE --------------------------------------- */     
         String showAuthor()
              String temp = "";
              int i;
              for (i = 0; i < author.size(); i++)
                   temp += author.elementAt( i ) + " ";
              return temp;     
         String showTitle()
              return title;
         void changeTitle( String input )
              title = input;
         String showPublisher()
              return publisher;
         void changePublisher( String input )
              publisher = input;
         int showIsbn()
              return isbn;
         void changeIsbn( int input )
              isbn = input;
         double showPrice()
              return price;
         void changePrice( double input )
              price = input;
         int showStock()
              return stock;
         void changeStock( int input )
              stock = input;
         book( String title, String publisher, int isbn, double price, int stock, String ... author )
              if ( author.length > 4 )
                   throw new IllegalArgumentException( "You have too many authors" );
    //          else if ( author.length == 0 )
    //               throw new IllegalArgumentException( "You have no authors" );
              this.title = title;
              this.publisher = publisher;
              this.isbn = isbn;
              this.price = price;
              this.stock = stock;
              this.author = new ArrayList<String>( Arrays.asList( author ) );
         public static void main( String[] args )
              book test = new book( "title", "publisher", 123, 12.20, 4, "eugene", "vadim" );
              System.out.println( test.title );
    }

    yougene wrote:
         List<String> author = new Vector<String>();
    Since you explicitly defined your reference to be of type List<String> you can only call methods that List has. And elementAt(int) is a method that's not existing in the List interface.
    Use .get(int) instead.

  • Forte doesn't recognize classes are compiled

    In the Sun One Studio 4 Update 1 IDE, my Java source files are displayed in the Explorer window with the uncompiled badge icons next to them, even though the classes are already compiled. If I select a file to compile it, the IDE will compile it, and put the compiled class in the target directory correctly. But the uncompiled icon is still displayed. If I select the file again and compile, the IDE compiles it again, instead of giving me the message that the file is up to date.
    Has anyone seen this problem?

    Add the output dir to classpath.Did you ever use forte? It doesn't recognize classpath. It looks at the mounted directories and jars instead. And I do have the output dir mounted - otherwise, the compiler couldn't put the compiled classes in the right place.

  • Jar doesn't recognize another jar

    Hi I packed my java class and additional files into a jar file, using the eclipse.
    The class I packed uses another jar file. it works fine.
    the problem is with my new jar that I created, since it doesn't recognize the other jar that the class uses and can't use it,
    Although I included the other jar in my class path in the eclipse.
    i don't know how to make that the new jar will know the other jar.
    thanks.

    gimbal2 wrote:
    ...Jar files have their own classpath that you cannot override. ...Since you have provided the correct strategy to pursue in this instance, I will simply point out (OP please stop reading ..now!) that it is possible to side step the default behaviour of the -jar option by not including that option when starting an app.
    E.G.
    prompt:java -jar main.jar
    NoClassDefFoundError Other.class
    prompt:java -cp main.jar;other.jar com.our.main
    Other.class processing..

  • Tecra M4 - DVD drive doesn't recognize any disk under Vista

    Hi,
    after the installation of Vista my dvd drive doesn't recognize any disks !
    No upgrade from XP! It was a clean Vista installation.
    I found several links about the registry entries upper and lower filter this entries doesn't exist in my registry under the class CDROM.
    I tested the drive under XP it works fine and recognizes everything.
    Drivers are correctly installed no problems in the device manager is prompted.
    So i have no idea how to get it working, seems to be a Vista problem
    Could any one help me ? I'm really frustrated about this
    Thanks for your help

    Maybe this helps:
    - Remove the CD/DVD drive from the device manager.
    - Then access the registry and remove the Upperfilters and Lowerfilters values completely from the following registry key:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Class\{4D36E965-E325-11CE-BFC1-08002BE10318}
    - Then reboot the notebook
    But what happens exactly? What disks are not recognized?

  • Java stored procedures and referencing classes

    We are referencing to some classes/libraries which are not present in the database. In normal java world, you specify the libraries/classes needed to run your piece of code in the CLASSPATH and that forms part of your complete code.
    Can java stored procedures in the database refer to libraries or class files it requires on the file system rather than the database? Is it possible to make this happen?
    Thanks

    pshiva,
    Posting the same question to multiple forums usually doesn't increase your chances of getting an answer, and it just frustrates those wishing to answer you with the result being that any future questions you post may have less chance of being answered -- because of your uncourteous, initial behaviour.
    I have answered your other thread:
    java stored procedures and referencing classes
    In my opinion, that forum (the Database JVM forum) is the most appropriate for your question.
    Good Luck,
    Avi.

  • Actionscript image gallery doesn't recognize load request

    Hi, I'm trying to create a five image gallery, and when I try to add the load request for the 3rd, 4th, and 5th images I get an error message that says it doesn't recognize that request: see code below:
    stop();
    //turn on buttonMode for mc's so mouse changes to hand
    one_mc.buttonMode=true;
    two_mc.buttonMode=true;
    three_mc.buttonMode=true;
    //four_mc.buttonMode=true;
    //five_mc.buttonMode=true;
    //--add button modes for 3-5 here
    //define rollovers (don't define rollOuts yet...will prevent flickering)
    one_mc.addEventListener(MouseEvent.ROLL_OVER, over1);
    two_mc.addEventListener(MouseEvent.ROLL_OVER, over2);
    three_mc.addEventListener(MouseEvent.ROLL_OVER, over3);
    //--add eventListeners for 3-5 here
    //define clicks
    one_mc.addEventListener(MouseEvent.CLICK, load1);
    two_mc.addEventListener(MouseEvent.CLICK, load2);
    three_mc.addEventListener(MouseEvent.CLICK, load3);
    //four_mc.addEventListener(MouseEvent.CLICK, load4);
    //five_mc.addEventListener(MouseEvent.CLICK, load5);
    //--add eventListeners for 3-5 here
    //turn off big rect
    bigRect_mc.visible=false;
    //create URL request to communicate to external file
    //NOTE: You will have to have an "images folder with "one.jpg" in order for this to work
    //title your files so they make sense
    var my1Request:URLRequest=new URLRequest("images/one.jpg");
    var my2Request:URLRequest=new URLRequest("images/two.jpg");
    var my3Request:URLRequest=new URLRequest("images/three.jpg");
    //--add requests for 3-5 here
    //create loader to bring in external file
    var my1Loader:Loader = new Loader();
    var my2Loader:Loader = new Loader();
    var my3Loader:Loader = new Loader();
    //--add requests for 3-5 here
    //move loaders to create room for nav
    my1Loader.x=125;
    my1Loader.y=12;
    my2Loader.x=125;
    my2Loader.y=12;
    my3Loader.x=125;
    my3Loader.y=12;
    //--add positioning for 3-5 here
    //add a close button. The new close is a reference to the CLASS NAME GIVEN IN THE PROPERTIES OF THE SYMBOL...very important!
    var close1_btn=new close();
    var close2_btn=new close();
    var close3_btn=new close();
    //--add close buttons for 3-5 here
    //choose location on the stage (my close button has the registration in the upper right)
    close1_btn.x=954;
    close1_btn.y=11;
    close2_btn.x=954;
    close2_btn.y=11;
    close3_btn.x=954;
    close3_btn.y=11;
    //--add close locations for 3-5 here
    //define event listeners
    function over1(evt:MouseEvent):void {
        //remove over event
        one_mc.removeEventListener(MouseEvent.ROLL_OVER, over1);
        //play one's timeline
        one_mc.gotoAndPlay("over");
        //add rollout
        one_mc.addEventListener(MouseEvent.ROLL_OUT, out1);
    function out1(evt:MouseEvent):void {
        //remove out event
        one_mc.removeEventListener(MouseEvent.ROLL_OUT, out1);
        //play one's timeline
        one_mc.gotoAndPlay("out");
        //add rollover
        one_mc.addEventListener(MouseEvent.ROLL_OVER, over1);
    function over2(evt:MouseEvent):void {
        two_mc.removeEventListener(MouseEvent.ROLL_OVER, over2);
        two_mc.gotoAndPlay("over");
        two_mc.addEventListener(MouseEvent.ROLL_OUT, out2);
    function out2(evt:MouseEvent):void {
        two_mc.removeEventListener(MouseEvent.ROLL_OUT, out2);
        two_mc.gotoAndPlay("out");
        two_mc.addEventListener(MouseEvent.ROLL_OVER, over2);
    function over3(evt:MouseEvent):void {
        three_mc.removeEventListener(MouseEvent.ROLL_OVER, over3);
        three_mc.gotoAndPlay("over");
        three_mc.addEventListener(MouseEvent.ROLL_OUT, out3);
    function out3(evt:MouseEvent):void {
        three_mc.removeEventListener(MouseEvent.ROLL_OUT, out3);
        three_mc.gotoAndPlay("out");
        three_mc.addEventListener(MouseEvent.ROLL_OVER, over3);
    //--add event listener definitions for 3-5 here
    define loadOne
    function load1(evt:MouseEvent):void {
        //remove any listeners you don't need
        one_mc.removeEventListener(MouseEvent.ROLL_OUT, out1);
        one_mc.removeEventListener(MouseEvent.CLICK, load1);
        //add listeners you do need
        one_mc.addEventListener(MouseEvent.ROLL_OVER, over1);
        //turn on big rect
        bigRect_mc.visible=true;
        //load image
        my1Loader.load(my1Request);
        //add image + close to display list
        addChild(my1Loader);
        addChild(close1_btn);
        //add event for close button click
        close1_btn.addEventListener(MouseEvent.CLICK, remove1);
    //define event function
    function remove1(evt:MouseEvent):void {
        //remove image & close button from display list
        removeChild(my1Loader);
        removeChild(close1_btn);
        //turn off big rect
        bigRect_mc.visible=false;
        //reset movieClip button
        one_mc.gotoAndStop(1);
        //add back necessary event listenters
        one_mc.addEventListener(MouseEvent.ROLL_OVER, over1);
        one_mc.addEventListener(MouseEvent.CLICK, load1);
    function load2(evt:MouseEvent):void {
        //remove any listeners you don't need
        two_mc.removeEventListener(MouseEvent.ROLL_OUT, out2);
        two_mc.removeEventListener(MouseEvent.CLICK, load2);
        //add listeners you do need
        two_mc.addEventListener(MouseEvent.ROLL_OVER, over2);
        //turn on big rect
        bigRect_mc.visible=true;
        //load image
        my2Loader.load(my2Request);
        //add image + close to display list
        addChild(my2Loader);
        addChild(close2_btn);
        //add event for close button click
        close2_btn.addEventListener(MouseEvent.CLICK, remove2);
    //define event function
    function remove2(evt:MouseEvent):void {
        //remove image & close button from display list
        removeChild(my2Loader);
        removeChild(close2_btn);
        //turn off big rect
        bigRect_mc.visible=false;
        //reset movieClip button
        two_mc.gotoAndStop(1);
        //add back necessary event listenters
        two_mc.addEventListener(MouseEvent.ROLL_OVER, over2);
        two_mc.addEventListener(MouseEvent.CLICK, load2);
    function load3(evt:MouseEvent):void {
        //remove any listeners you don't need
        three_mc.removeEventListener(MouseEvent.ROLL_OUT, out3);
        three_mc.removeEventListener(MouseEvent.CLICK, load3);
        //add listeners you do need
    three_mc.addEventListener(MouseEvent.ROLL_OVER, over3);
        //turn on big rect
        bigRect_mc.visible=true;
        load image
        my3Loader.load(my3Request);
        add image + close to display list
        addChild(my3Loader);
        addChild(close3_btn);
        add event for close button click
        close3_btn.addEventListener(MouseEvent.CLICK, remove3);
    //define event function
    function remove3(evt:MouseEvent):void {
        remove image & close button from display list
        removeChild(my3Loader);
        removeChild(close3_btn);
        //turn off big rect
        bigRect_mc.visible=false;
        reset movieClip button
        three_mc.gotoAndStop(1);
        add back necessary event listenters
        three_mc.addEventListener(MouseEvent.ROLL_OVER, over3);
        three_mc.addEventListener(MouseEvent.CLICK, load3);
    //--add other events here

    copy and paste the error message after clicking file/publish settings/flash and ticking "permit debugging".  specify the line of code with the error mentioned in the error message.

  • Java doesn't pick up system's DNS settings change until restarted

    Hello,
    I have a service running on a few Linux computers. Those computers have a NIC, which is configured with a fixed IP address. So /etc/resolv.conf contains the IP address of the LAN's DNS server. But most of the time, the computers are not plugged into the LAN at all. Instead, they connect themselves periodically to the Internet by establishing a ppp connection. When it happens, the ISP's DHCP server assign them new IP parameters, including their DNS server's IP address. And /etc/resolv.conf gets updated with this address.
    But it seems that java doesn't take care of DNS change taking place during a run. Which means that my program (started at boot with no connectivity at all) tries to connect to some host, and obviously trigger an "UnknownHostException" (at that point it does try to contact the LAN's DNS server). Quite logical. Later, the ppp link become active. But my program still try to contact the LAN's DNS server, despite the new configuration in /etc/resolv.conf. As such, it will forever trigger UnknowHostExceptions, until it gets restarted (it will then pick up the new settings) or it is plugged back into the LAN (it will finally reach the LAN's DNS server).
    This is quite a problem as during one single execution, the machine may encounter several DNS configuration changes, and this problem basically means that it will be impossible for my application to resolve any name at all.
    So is there a way to tell Java to re-read the system wide DNS configuration? Or is there some option to prevent Java to "cache" the DNS server to use?
    To demonstrate my problem, I've written a simple test case, see below.
    To get the problem:
    1) Put a bogus DNS server into your /etc/resolv.conf
    2) Start the test program. Wait for some time: it will trigger UnknownHostExceptions.
    3) Fix the entry in /etc/resolv.conf, and check it actually works (eg ping www.google.be)
    4) Test program will continue to trigger UnknownHostExceptions forever.
    One interesting fact is that someone tried this test on Windows, and didn't suffer from this behaviour, eg the application reacts to DNS system settings changes dynamically. So it looks like a Linux-only problem.
    Thanks in advance for your insight.
    Pierre-Yves
    package com.test.dnsresolver;
    import java.net.InetAddress;
    import java.net.UnknownHostException;
    public class DnsResolver {
        private static String urlString = "www.google.com";
        public static void main(String[] args) {
             * Specified in java.security to indicate the caching policy for successful
             * name lookups from the name service. The value is specified as as integer
             * to indicate the number of seconds to cache the successful lookup.
            java.security.Security.setProperty("networkaddress.cache.ttl" , "10");
             * Specified in java.security to indicate the caching policy for un-successful
             * name lookups from the name service. The value is specified as as integer to
             * indicate the number of seconds to cache the failure for un-successful lookups.
             * A value of 0 indicates "never cache". A value of -1 indicates "cache forever".
            java.security.Security.setProperty("networkaddress.cache.negative.ttl", "0");
            int loopCounter = 0;
            while (true) {
                InetAddress resolved;
                try {
                    resolved = InetAddress.getByName(urlString);
                    System.out.println("Loop " + loopCounter + ": resolved IP address: " + resolved);
                } catch (UnknownHostException e) {
                    System.out.println("Loop " + loopCounter + ": UnknownHostException");
                    e.printStackTrace();
                loopCounter++;
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {}
    }

    Well, the nameservice property allowing to specify my DNS server of choice is interesting (I didn't know about those), but not very usable, as the DNS server to use is not known in advance (it may be whatever the ISP tells me to use at the time where the ppp link gets established). So no real solution there.
    The fact that it caches /etc/resolv.conf content for 300s is very interesting, but having no possibility to impact on this duration really is a pity. There should be some kind of property to fix this behaviour. So as you say, a custom provider may be the only solution.
    So far, the hack I use to get this working is based on code similar to this one (it is presented here in a similar form than my test case above). Obviously, reading the /etc/resolv.conf for each dns resolution is not an option in a real environment, but you get the idea.
    package com.test.dnsresolver;
    import java.io.BufferedReader;
    public class DnsResolver {
         private static final String urlString = "www.google.com";
         private static final String resolvConf = "/etc/resolv.conf";
         public static void main(String[] args) {
              int loopCounter = 0;
              while (true) {
                   loopCounter++;
                   try {
                        Thread.sleep(1000);
                   } catch (InterruptedException e) {}
                   // Parse the current DNS server to be used in the config
                   String nameserver = null;
                   try {
                        BufferedReader input =  new BufferedReader(new FileReader(new File(resolvConf)));
                        String currentLine = null;
                        while (( currentLine = input.readLine()) != null){
                             // Take care of potential comments
                             currentLine = currentLine.substring(0, currentLine.indexOf("#") == -1
                                       ? currentLine.length() : currentLine.indexOf("#") );
                             if (currentLine.contains("nameserver")) {
                                  // It is the line we are looking for
                                  nameserver = currentLine;
                                  break;
                   } catch (FileNotFoundException e) {
                        System.out.println("Loop " + loopCounter + ": FileNotFoundException");
                   } catch (IOException e) {
                        System.out.println("Loop " + loopCounter + ": IOException");
                   if (nameserver == null) {
                        // No "nameserver" line found
                        System.out.println("Loop " + loopCounter + ": No nameserver found in configration file!");
                        continue;
                   // Trim it to just contain the IP address
                   nameserver = (nameserver.replace("nameserver", "")).trim();
                   System.out.println("Loop " + loopCounter + ": Going to use DNS server " + nameserver);
                   // At this point, we know which server to use, now perform the resolution
                   Hashtable<String, String> env = new Hashtable<String, String>();
                   env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
                   env.put("java.naming.provider.url",    "dns://" + nameserver);
                   DirContext ictx;
                   try {
                        ictx = new InitialDirContext(env);
                        Attributes attrs1 = ictx.getAttributes(urlString, new String[] {"A"});
                        System.out.println("Loop " + loopCounter + ": Manual resolution: +" + attrs1.get("a").get() + "+");
                   } catch (NamingException e) {
                        System.out.println("Loop " + loopCounter + ": NamingException");
    }So maybe I should adapt and package this into a proper provider and specify it for sun.net.spi.nameservice.provider. Any link, info or example about how a proper provider should look like?
    Thanks for your advices!

  • Tomcat 4.1 class problem. Doesn't identify the class.

    Hi
    I just installed J2SDK and tomcat in windows xp. I've made jsp files and beans. The first page is customerlogin.jsp which takes user id and password in a form. It sends the request to authenticate.jsp. Would you please give me a few important steps that need to be done?
    My directory structure is as follows:
    C:\Tomcat 4.1\Webapps\Log -> jsps
    c:\Tomcat 4.1\Webapps\Log\WEB-INF\classes\Log -> java beans
    The jsp doesn't find AuthenBean class. It complains about it.
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 1 in the jsp file: /authenticate.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\Tomcat 4.1\work\Standalone\localhost\Log\authenticate_jsp.java:43: package Log does not exist
    Log.AuthenBean Authen = null;
    ^
    ******** AuthenBean is : *********
    package Log;
    public class AuthenBean{
         String userid;
         String password;
         public void setUserid (String tuserid) {
                   userid = tuserid;
         public void setPassword (String tpassword) {
                   password = tpassword;
         public String getUserid() { return userid; }
         public String getPassword() { return password; }
    ******** Authenticate.jsp ***********
    <jsp:useBean id="Authen" class="Log.AuthenBean" scope="session"/>
    <jsp:useBean id="select" class="Log.ExecuteQuery"/>
    <jsp:setProperty name="Authen" property="*"/>
    <%
    String id = Authen.getUserid();
    String passwd = Authen.getPassword();
    out.print("User id is " + id);
    out.print("Password is " + passwd);
    %>
    <%@ page import="java.util.Vector" %>
    <% Vector aResult = select.getResult();
    select.connect();
    boolean idCheck = false;
    String query = new String();
    query = "SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME, PASSWORD, COUNTY, AREA FROM EMPLOYEE, LOCATION WHERE EMPLOYEE_ID = '" + id + "' AND PASSWORD = '" + passwd + "' AND (EMPLOYEE.LOCATION_ID = LOCATION.LOCATION_ID)";
    select.select(query, 6);
    select.disconn();
    int size = aResult.size();
    if(size > 0){
    idCheck = true;
    if(idCheck)
         session.setAttribute("loginId",id);
         session.setAttribute("firstName",(String)aResult.elementAt(1));
         session.setAttribute("lastName",(String)aResult.elementAt(2));
         session.setAttribute("county",(String)aResult.elementAt(4));
         session.setAttribute("area",(String)aResult.elementAt(5));
    %>
    <jsp:forward page="customer.jsp"/>
    <%
    else
    String error_msg = "Error: User Authentication Failed!";
    String link = "customerlogin.jsp";
    session.setAttribute("prevPage", link);
    session.setAttribute("errorMsg", error_msg);
    }%>
    ****** web.xml in Log\WEB-INF is **********
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>Log\AuthenBean</servlet-name>
    <servlet-class>Log\AuthenBean</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>Log\ExecuteQuery</servlet-name>
    <servlet-class>Log\ExecuteQuery</servlet-class>
    </servlet>
    </web-app>
    Your help would be appreciated
    Thanks!

    Your problem is in web.xml. Only servlet classes need to be mapped. Your bean class should not be.
    ****** web.xml in Log\WEB-INF is **********
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web
    Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>Log\AuthenBean</servlet-name>
    <servlet-class>Log\AuthenBean</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>Log\ExecuteQuery</servlet-name>
    <servlet-class>Log\ExecuteQuery</servlet-class>
    </servlet>
    </web-app>
    If you have only jsps, u mau use
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web
    Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    </web-app>
    Hope it works.
    Hafizur Rahman
    SCJP

  • Java can't find main class when manifest has certain JARs on it

    I recently wrote an Ant script that builds my application and jars it up, creating a manifest in the process. The manifest specifies the main class and a classpath that mentions other jars that exist in the same directory. Everything works as expected and I am able to run the program using "java -jar abc.jar".
    However, I recently started using classes in my program that come from a jar that should (according to the company I work for) reside in a central location rather than each application having its own copy. So, I changed my build script to reference those shared jars in a common location. But now when I run "java -jar abc.jar", I get a java.lang.ClassNotFoundException: com.example.Main. If I edit the jar's manifest and manually remove the new jars from the classpath, the ClassNotFoundException error goes away (although obviously that causes other problems.) Is there something about adding those new jars to the manifest classpath that would prevent Java from finding my main class? My manifest looks something like this and the last two jars (the ones with the absolute paths) are the jars that seem to be the root of the problem.
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.0
    Created-By: 1.5.0_04-b05 (Sun Microsystems Inc.)
    Main-Class: com.uprr.app.rsa.Main
    Class-Path: acegi-security-1.0.6.jar commons-codec-1.4.jar commons-htt
    pclient-3.1.jar commons-lang-2.4.jar commons-logging-1.1.1.jar common
    s-pool-1.5.4.jar dom4j-1.6.1.jar jakarta-oro-2.0.8.jar jaxen-1.1.1.ja
    r jibx-run-1.2.1.jar joda-time-1.6.jar jsr173_1.0_api.jar log4j-1.2.1
    5.jar opensaml-1.1.jar spring-2.5.2.jar stax-api-1.0.1.jar wstx-asl-3
    .2.9.jar xmf-3.0.2.jar xmlsec-1.4.1.jar C:\software\tibco\ems\clients
    \java\jms.jar C:\software\tibco\ems\clients\java\tibjms.jarAny ideas?
    Brandon

    I still don't know why giving the absolute classpath entry like that would cause Java to be unable to find the jar's main class, but I did make an interesting discovery. If I give the absolute path without the drive letter, is able to find the main class again. Something like this won't work...
    Class-Path: C:\software\tibco\ems\clients\java\tibjms.jarBut something like this will...
    Class-Path: \software\tibco\ems\clients\java\tibjms.jarBut I'd still like to know why Java doesn't accept drive letters when running on a Windows machine. After all, what if my manifest needed to reference a jar that was on a different drive, like a network drive (since this whole problem came up as a result of shared common jars that need to exist outside of the project.)

  • Eclipse doesn't recognize TomEE

    According to 'TomEE and Eclipse' on Apache's website, it should be easy to run TomEE on Eclipse. I downloaded version 1.7.2 of TomEE-webproject from TomEE's download section and unpacked it in my home directory, as described in the YouTube-video on 'TomEE and Eclipse', and tested by running ~/apache-tomee-webprofile-1.7.2/bin/startup.sh. When navigating to localhost:8080, everything seems fine (the page displays "Apache Tomcat (TomEE)/7.0.62 (1.7.2)").
    However, when trying to install a new server in Eclipse, by choosing New Runtime... in the new Dynamic Web Project dialog and browsing for a Tomcat 7.0 directory, I can't select the root of the tomcat-webprofile directory (Eclipse complains that "unknown version of Tomcat was specified") and 'Finish' remains grey (and a Tomcat version is suggested to download and install). Apparently, Eclipse doesn't recognize the TomEE directory as a Tomcat directory.
    I'm using Eclipse 4.5.0 (Mars) in Arch Linux. Tomcat 7 and 8 installed by the system are correctly recognized.
    NOTE: Sorry for not including hyperlinks, but I'm not yet allowed to post links to non-eclipse.org sites.

    On 08/03/2015 12:24 PM, Marcel Korpel wrote:
    > [snip]
    > To be frank, I got a bit irritated by bad support of Eclipse for servlet
    > containers capable of JSF (if I'm clear; tried Glassfish but got tons of
    > NullPointerExceptions) and Maven problems, so now I'm trying NetBeans +
    > Glassfish, which work fine, so far. The IDE is not as neat and
    > configurable as Eclipse, but they work fine together.
    Marcel,
    A few years ago, I took some careful notes as I made my way through some
    JSF stuff. While I experienced some frustration, it was more with the
    general Faces community and not at all with Eclipse. I would have said
    then that Eclipse was just the table top; the different Faces proposals
    (Rich, My-, etc.) were frustratingly documented, ill available, hard to
    find a complete set, etc. It's not so much Eclipse's fault.
    I assume you downloaded Eclipse IDE for Java EE Developers. I used just
    plain Tomcat.
    In any case, and I know these notes are several years old, feel free to
    look through them for any help or clues you might find (bottom/middle
    half of left column).
    http://www.javahotchocolate.com/topics.html
    Lars Vogel's got some great tutorials on web programming including
    Tomcat and JSF:
    http://www.vogella.com/tutorials/web.html
    Hope this helps and doesn't confuse.
    Cheers

  • Itunes 10.6 doesn't recognize my iphone 4s 32gb, could you please help me?

    I bought an iPhone 4s 32gb from Singapore. I'm living in Chennai, India. To connect it to my computer (windows XP,), I have downloaded iTunes 10.6.1.7. Unfortunately iTunes is not recognizing my iPhone.  I had tried to troubleshoot it by reinstalling iTunes (2 times). I have restarted the apple mobile device from control panel. I try connecting my iphone in another usb port. but no use. I don't know what am I missing?.  iTunes opens on my computer. but doesn't recognize my device. when I click on help. it says an "unknown error has occurred. your computer is not connected to internet. please check your internet connection and try again later". I don't know what to do? could you please help me? thank you so much for your help and time.
    I did the apple's diagnostics test on my computer. I'm pasting the result for your info.
    Microsoft Windows XP Professional Service Pack 3 (Build 2600)
    System manufacturer System Product Name
    iTunes 10.6.1.7
    QuickTime not available
    FairPlay 1.14.37
    Apple Application Support 2.1.7
    iPod Updater Library 10.0d2
    CD Driver 2.2.0.1
    CD Driver DLL 2.1.1.1
    Apple Mobile Device 5.1.1.4
    Apple Mobile Device Driver not found.
    Bonjour 3.0.0.10 (333.10)
    Gracenote SDK 1.9.5.502
    Gracenote MusicID 1.9.5.115
    Gracenote Submit 1.9.5.143
    Gracenote DSP 1.9.5.45
    iTunes Serial Number 0013AC2C0E8DEF50
    Current user is an administrator.
    The current local date and time is 2012-06-12 20:13:12.
    iTunes is not running in safe mode.
    WebKit accelerated compositing is enabled.
    HDCP is not supported.
    Core Media is supported.
    Video Display Information
    Intel(R) G41 Express Chipset
    **** External Plug-ins Information ****
    No external plug-ins installed.
    **** Network Connectivity Tests ****
    Network Adapter Information
    Adapter Name:        {D85300A1-330D-41ED-AC5A-EC032B22FBF0}
    Description:            Atheros AR8121/AR8113/AR8114 PCI-E Ethernet Controller - Packet Scheduler Miniport
    IP Address:             192.168.1.3
    Subnet Mask:          255.255.255.0
    Default Gateway:    192.168.1.1
    DHCP Enabled:      Yes
    DHCP Server:         192.168.1.1
    Lease Obtained:     Tue Jun 12 19:48:36 2012
    Lease Expires:       Wed Jun 13 07:48:36 2012
    DNS Servers:         192.168.1.1
    Active Connection: LAN Connection
    Connected:             Yes
    Online:                    Yes
    Using Modem:        No
    Using LAN:             Yes
    Using Proxy:           No
    Firewall Information
    Windows Firewall is on.
    iTunes is enabled in Windows Firewall.
    Connection attempt to Apple web site was unsuccessful.
    The network connection timed out.
    Basic connection to the store failed.
    The network connection timed out.
    Connection attempt to Gracenote server was successful.
    The network connection timed out.
    iTunes has never successfully accessed the iTunes Store.
    **** CD/DVD Drive Tests ****
    No drivers in LowerFilters.
    UpperFilters: GEARAspiWDM (2.2.0.1),
    G: Optiarc DVD RW AD-7220A, Rev 1.01
    Drive is empty.
    **** Device Connectivity Tests ****
    iPodService 10.6.1.7 is currently running.
    iTunesHelper 10.6.1.7 is currently running.
    Apple Mobile Device service 3.3.0.0 is currently running.
    Universal Serial Bus Controllers:
    Intel(R) N10/ICH7 Family USB Universal Host Controller - 27C8.  Device is working properly.
    Intel(R) N10/ICH7 Family USB Universal Host Controller - 27C9.  Device is working properly.
    Intel(R) N10/ICH7 Family USB Universal Host Controller - 27CA.  Device is working properly.
    Intel(R) N10/ICH7 Family USB Universal Host Controller - 27CB.  Device is working properly.
    Intel(R) N10/ICH7 Family USB2 Enhanced Host Controller - 27CC.  Device is working properly.
    No FireWire (IEEE 1394) Host Controller found.
    **** Device Sync Tests ****
    No iPod, iPhone, or iPad found.

    Well, you do not mention what computer OS you are using, so here are the support documents for both.
    Windows:     http://support.apple.com/kb/TS1538
    OS X:     http://support.apple.com/kb/TS1591

  • ITunes doesn't recognize either of my iPods

    I downloaded the latest update recently and since then iTunes doesn't recognize either of my two iPod touches (4th gen), even though the computer does. My iPad (1st gen) is still recognized normally. I tried uninstalling iTunes and reinstalling it several times, and that didn't work. The iPods are recognized by iTunes on other computers. The computer in question runs windows 8.1, if that makes a difference. From the look of these forums it looks like I'm not the only one who has this problem. Please help.

    Hi Tanskalinen,
    If you are having issues with iTunes not recognizing some of your devices on your Windows machine, you may find the following article helpful:
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/ts1538
    Regards,
    - Brenden

  • After I reset my Ipod (deleted all data and settings) windows 7 doesn't recognize by ipod touch, and it doesn't appear in the itunes library or in the device menu, but it does charge. How can I get my computer to recognize it again?

    After I reset my Ipod (deleted all data and settings) windows 7 doesn't recognize by ipod touch, and it doesn't appear in the itunes library or in the device menu, but it does charge. How can I get my computer to recognize it again?

    Refer to this article:
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/TS1538

Maybe you are looking for

  • "command disabled" when setting IP address on AIR-LAP1252G-A-K9

    Hi, I am trying to set ip address on cisco ap AIR-LAP1252G-A-K9 using the "lwapp" command but get message "command is disabled" I am connecting via console cable to ap. I have already reset ap to defaults. Not sure why I'm getting this error "command

  • RAW files from my new Canon SL1 to Lightroom?

    I just bought a new Canon Rebel SL1 as a second, lightweight camera. But I just discovered my Lightroom won't recognize my RAW files. Is there an update or plug-in to let me do this?

  • T-code to be check on R3 side

    I find in R3 and BW, both got RSA3 and RSO2, does it mean no need to run RSo2 and RSA3 in BW side? under which circustance, we should use RSO2 tocreate extractor in BW, since I already define RSO2 in R3 and run RSA3 in R3.

  • DW (CS6) keeps asking me whether to update template files?

    I have come across this issue before but ended up regenerating the site. I have a template which has a basic menu on it which points to three index files in root, portfolio and contact folders respectively. From this template I have created the index

  • Tutorial downloads not working !

    Hi , There are quite a few new tutorials which have come up in WebDynpro java area .. When I try to access them , it gives a Portal Runtime error..  ! I feel a bit funny and odd , being in SAP and working on portals and still seeing an error whose re