Good example of  Java Classpath

I am very much confused in learning about classpath in Java.
Could anyone of you explain it.
or
Refer me to some website where I can have a clear understanding of classpath as well as
master it by practicing a good example.
I searched for it for a long period of time. I just found some theory saying you can do this do that
with classpath but not practical example.
Help me out in this.
Thanks in Advance.

I don't know what you've read, and I don't know what you didn't understand about it, so I have no idea what to say or suggest to you, other than start here:
[http://www.google.com/search?q=java+classpath+tutorial]
It's really not a complicated concept, so "mastering" it doesn't mean much. You either understand it or you don't.

Similar Messages

  • How to add to java classpath?

    I am wondering how to add/implement to java classpath. I think I might be missed out the classpath thing so my program doesn't work. I keep getting error message like: "cannot resolve symbol: method setDocumentHandler(BookCounter)" and warning messages like: "C:\Example\BookCounter.java :11: warning:org.xml.sax.HandlerBase in org.xml.sax has been deprecated." and "C:\Example\BookCounter.java :16: warning:org.xml.sax.HandlerBase in org.xml.sax has been deprecated."
    If this is not because of classpath problem, kindly let me know what should I do?
    My code as follow:-
    ========================
    import java.io.*;
    import org.xml.sax.*;
    import org.xml.sax.HandlerBase;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    public class BookCounter extends HandlerBase
    private int count = 0;
    public static void main (String args[]) throws Exception
    (new BookCounter()).countBooks();
    public void countBooks() throws Exception
    SAXParserFactory f = SAXParserFactory.newInstance();
    SAXParser f2 = f.newSAXParser();
    // Parser p = new com.jclark.xml.sax.Driver();
    f2.setDocumentHandler(this);
    f2.parse("file:///C:/books.xml");
    public void startElement(String name) throws SAXException
    if (name.equals("book"))
    count++;
    public void endDocument() throws SAXException
    System.out.printIn("There are" + count + "books");

    The errors don't look like classpath problems. The first one is a result of it not being able to find a method in BookCounter (or more likely HandlerBase) that has the signature that you are attempting to use.
    The warnings come from the fact that HandlerBase has been deprecated, just like the messages state. In other words, it has been replaced by a newer version, or incorporated into another class' functionality. Check the API for more information.

  • GOOD tutorial for java?

    Hi, I am looking for a good tutorial for java. I cant understand my teacher's lectures, because they are always presented as a slide show and she just reads the slides in a monotone voice. (Not to mention her thick asian accent). So any one?
    *Note=A good tutorial is the one that shows coding examples, analysis of concepts etc
    Edited by: haraminoI on Mar 26, 2009 2:24 AM

    PhHein wrote:
    Start here:
    [Sun's basic Java tutorial|http://java.sun.com/docs/books/tutorial/]
    [Sun's New To Java Center|http://java.sun.com/learning/new2java/index.html]
    Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    jGuru
    A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch
    To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    [Yawmarks List|http://forums.devshed.com/java-help-9/resources-for-learning-java-249225.html]
    [The Java Developers Almanac|http://www.amazon.com/exec/obidos/tg/detail/-/0201752808?v=glance]
    [http://javaalmanac.com|http://javaalmanac.com]
    Bruce Eckel's [Thinking in Java(Available online.)|http://mindview.net/Books/DownloadSites]
    Joshua Bloch's [Effective Java|http://www.amazon.com/Effective-Java-2nd-Joshua-Bloch/dp/0321356683]
    Bert Bates and Kathy Sierra's [Head First Java|http://www.amazon.com/exec/obidos/tg/detail/-/0596004656?v=glance]
    James Gosling's [The Java Programming Language|http://www.bookpool.com/sm/0321349806]
    Gosling is the creator of Java. It doesn't get much more authoritative than this.
    Joshua Bloch and Neal Gafter [Java Puzzlers.|http://www.javapuzzlers.com/]
    Hey thanks a lot ! :)

  • Looking for good example about Woodstock components and custom validators

    Hi guys,
    could someone be so kind to give (or suggest) me a simple, minimal and working example with a Woodstock TextField (or Calendar) component and a custom validator?
    I cannot find good examples, all the ones I find on the net are too much wide and confusing so that I'm not able to adapt them to my needs.
    I already made a custom validator (formerly, "DateValidator") with the "validate()" method, and added it to some dynamically created components with code like this:
    calendar1.setImmediate(true);
    calendar1.setAutoValidate(true);
    MethodExpression methodExpression = facesContext.getApplication().getExpressionFactory().createMethodExpression(elcontext, "#{DateValidator.validate}", null, new Class[] { FacesContext.class, UIComponent.class, Object.class });
    calendar1.setValidatorExpression(methodExpression);
    Now, when I change data in the textbox or in the calendar, I see that something obscure is moving (this because I can read "Reading from localhost..." in the status bar of the browser), but nothing happens, and the validator method is never called (I tried this with the debugger).
    I think that only a good example could save me from the dark... Thanks in advance!

    Yes, I'd thought about just having the user set their
    timezone (similar to the forum Settings). However,
    even this forum settings causes some confusion.
    There's two options for a number of timezones. What
    differentiates them? The daylight saving rules are
    important to know and the list of timezones doesn't
    indicate this in any way. This list doesn't show all
    available timezones either (as previously mentionted,
    there's seven timezones for GMT -0700).Then you would have to do a better job than Sun did, wouldn't you? After all if you are going to be interpreting the answer you get, you had better ask a clear question. If you want to know the list of timezones actually supported by Java, then examine the source code for the TimeZone class. You can also search Google for "time zones" for links that will keep you busy for weeks learning the arcana of time zones around the world.

  • Any good examples of using hashCode?

    I am creating a simple test class of a date object using getYear, getMonth, GetDay, compareTo, equals and hashCode. Ive got everything else working fine, but im wondering if I am getting the correct output from the hashCode method. What exactly does the hashCode method do? anyone got a good example of using it and what it outputs?

    the name of my date class - here's the rest of my code if you want to verify it:
    package Final;
    import java.util.GregorianCalendar;
    import java.util.Calendar;
    public class SimpleDate
    /** Creates a new instance of SimpleDate
    public SimpleDate()
         GregorianCalendar greg = new GregorianCalendar();
              year = greg.get(Calendar.YEAR);
              month = 1 + greg.get(Calendar.MONTH);
              day = greg.get(Calendar.DATE);
    /** Creates the setDate method which allows the day, month, and year of the
    * date to be specified
    public SimpleDate( int year, int month, int day )
    setDate( year, month, day );
    /** Sets the day, month, and year variables for the date
    public void setDate( int year, int month, int day )
    GregorianCalendar greg = new GregorianCalendar();
    greg.set(Calendar.YEAR, year);
    greg.set(Calendar.MONTH, month-1);
    greg.set(Calendar.DATE, day);
    this.year = greg.get(Calendar.YEAR);
    this.month = 1 + greg.get(Calendar.MONTH);
    this.day = greg.get(Calendar.DATE);
    /** Defines the method getYear which gets the integer value which represents
    * the year in the date
    * @returns int year
    public int getYear()
    return year;
    /** Defines the method getMonth which gets the integer value which represents
    * the month in the date
    * @returns int month
    public int getMonth()
    return month;
    /** Defines the method getDay which gets the integer value which represents
    * the day in the date
    * @returns int day
    public int getDay()
    return day;
    /** Defines the boolean method equals which compares two dates to see if they
    * are equal
    * @returns boolean equals
    public boolean equals()
    return equals;
    public int compareTo()
    return comparable;
    public int hashCode()
    return hashcode;
    public String toString()
    String string1 = new String();
    return string1;
    /*************Built-in Self Test************/
    public static void main(String[] args)
    SimpleDate date = new SimpleDate();
    SimpleDate date2 = new SimpleDate();
    date.setDate(2005, 11, 4);
    System.out.println("Day, Month and Year: " + day + " " + month + " " + year);
    date.getYear();
    System.out.println("The year selected is: " + year);
    date.getMonth();
    System.out.println("The month selected is: " + month);
    date.getDay();
    System.out.println("The day selected is: " + day);
    date2.setDate(2004, 11, 4);
    System.out.println("The first date selected equals the second date selected: " + date.equals(date2));
    //System.out.println("The first date selected is comparable to the second date selected: " + date.compareTo(date2));
    //How do I implement compareTo?
    System.out.println("The hashcode for the first date selected is: " + date.hashCode());
    System.out.println("The hashcode for the second date selected is: " + date2.hashCode());
    // ***** Instance Variables *****
    static int year;
    static int month;
    static int day;
    boolean equals;
    int comparable;
    int hashcode;
    }

  • Java Classpath options

    My question is about Java classpath options in a production environment.
    The company I work for wants to start developing Java applications. These applications will not be running via a web container but standalone on a unix machine. We are setting up the environment and are unsure about the industry best practices. Specifically where it deals with classpath. We have around 15 developers and are not sure how to set up the environment on the production machine so that:
    A) The migration process is not overly complex (developers do not migrate/set up the code in production, they develop it and stage it and then other employees move it into production).
    B) There is no danger of getting the wrong versions of libraries (for example I am writing code using some toolkit that is version 2 and a co-worker is using version 3 of the same toolkit).
    Here is what we have come up with.
    1. Require all developers to place their Java code in executable JARs with a MAIN-CLASS attribute and the CLASSPATH attribute set. Here there would be no classpath set on the production environment and each developer would be responsible for setting everything in the jar. One object to migrate.
    2. Require all developers to write a shell script to accompany their Java code that will set up the CLASSPATH. This adds programs and adds another object/step to the migration.
    3. Just throw all library JAR files in the main JRE class path on the production machine and classes in a /class folder pointed to by $CLASSPATH. This seems like a bad idea and could cause confusion.
    4. Require all developers to use custom class loaders in their programs - we do not really understand this method.
    Thanks ahead of time for any advice on this issue.

    jverd wrote:
    I actually would prefer #2 over #1. I don't like dinking around with the manifest file, and if I want to see what's going on, I find it easier to read a shell script than to pull apart a jar. Plus, even with a jar, you may end up writing a script to set up other environment variables or prepare directories, etc. anyway.I prefer that as well.
    The manifest doesn't bother me but with more complex systems, solutions often require something more than just java. Especially for stand alone apps (versus JEE apps.)
    Additionally it allows one to control the VM.

  • Cannot deploy the Bookstore Example for Java EE tutorials

    I also have the same issue as another user on a different thread, and I did check my build.properties and it appears accurate. However I am still getting the exception when I try to run the 'ant create-tables' or 'ant deploy' :
    Buildfile: build.xml
    -pre-init:
    init:
    check:
    tools:
    start-db:
    [exec] Database already started on host localhost, port 1527.
    [exec] Command start-database executed successfully.
    delete-tables:
    [sql] Executing file: C:\tutorial\javaeetutorial\examples\web\bookstore1\${db.delete.src}
    BUILD FAILED
    C:\tutorial\javaeetutorial5\examples\bp-project\database-ant.xml:48:java.io.FileNotFoundException: C:\tutorial\javaeetutorial\examples\web\bookstore1\${db.delete.src} (The system cannot find the file specified)
    Total time: 7 seconds
    The Build.Properties file in my [install]/examples/bp-projects/ directory is a follows
    javaee.home=C:/Sun/AppServer
    javaee.tutorial.home = c:/tutorial/javaeetutorial5
    javaee.server.name=localhost
    javaee.server.port=10000
    javaee.adminserver.port=4848
    javaee.server.username=admin
    javaee.server.passwordfile=c:/tutorial/javaeetutorial5/password.txt
    appserver.instance=server
    I was able to compile the first Hello tutorial with Ant, so I am assuming that means the above build.properties file should be correct (or else that deployment would have failed too, right?). I also created the JDBC connection in the System Admin Console before trying this, as per the tutorial text.
    Since I'm new to the environment, I'm not sure where else to look for the problem.

    Ok, I did an 'ant deploy' at the books directory. It seems to be going well and then just hung for minutes at the following line...
    check:
    tools:
    -pre-deploy:
    -pre-init:
    init:
    check:
    tools:
    start-db:
    [exec] Database started in Network Server mode on host localhost and port 1
    527.
    [exec] --------- Derby Network Server Information --------
    [exec] Version: CSS10011/10.1.1.0 Build: 208786 DRDA Product Id: CSS10011
    [exec] -- listing properties --
    [exec] derby.drda.maxThreads=0
    [exec] derby.drda.keepAlive=true
    [exec] derby.drda.minThreads=0
    [exec] derby.drda.portNumber=1527
    [exec] derby.drda.logConnections=false
    [exec] derby.drda.timeSlice=0
    [exec] derby.drda.startNetworkServer=false
    [exec] derby.drda.host=localhost
    [exec] derby.drda.traceAll=false
    [exec] ------------------ Java Information ------------------
    [exec] Java Version: 1.5.0_06
    [exec] Java Vendor: Sun Microsystems Inc.
    [exec] Java home: C:\Sun\AppServer\jdk\jre
    [exec] Java classpath: C:\Sun\AppServer\lib\appserv-rt.jar;C:\Sun\AppServe
    r\lib\admin-cli.jar;C:\Sun\AppServer\javadb\lib\derby.jar;C:\Sun\AppServer\javad
    b\lib\derbytools.jar;C:\Sun\AppServer\javadb\lib\derbynet.jar;C:\Sun\AppServer\j
    avadb\lib\derbyclient.jar
    [exec] OS name: Windows XP
    [exec] OS architecture: x86
    [exec] OS version: 5.1
    [exec] Java user name: Russell Longo
    [exec] Java user home: C:\Documents and Settings\Russell Longo
    [exec] Java user dir: C:\Sun\AppServer
    [exec] java.specification.name: Java Platform API Specification
    [exec] java.specification.version: 1.5
    [exec] --------- Derby Information --------
    [exec] JRE - JDBC: J2SE 5.0 - JDBC 3.0
    [exec] [C:\Sun\AppServer\javadb\lib\derby.jar] 10.1.1.0 - (208786)
    [exec] [C:\Sun\AppServer\javadb\lib\derbytools.jar] 10.1.1.0 - (208786)
    [exec] [C:\Sun\AppServer\javadb\lib\derbynet.jar] 10.1.1.0 - (208786)
    [exec] [C:\Sun\AppServer\javadb\lib\derbyclient.jar] 10.1.1.0 - (208786)
    [exec] ------------------------------------------------------
    [exec] ----------------- Locale Information -----------------
    [exec] ------------------------------------------------------
    [exec] Starting database in the background. Log redirected to C:/Sun/AppSe
    rver/javadb\derby.log.
    [exec] Command start-database executed successfully.
    I hit a Ctrl-C and it asked if I wanted to end the batch. I replied 'n' but it dropped out to the command line.
    So I tried the ant deploy again and got the following...
    check:
    tools:
    -pre-deploy:
    -pre-init:
    init:
    check:
    tools:
    start-db:
    [exec] Database already started on host localhost, port 1527.
    [exec] Command start-database executed successfully.
    delete-tables:
    [sql] Executing file: C:\tutorial\javaeetutorial5\examples\web\books\${db.
    delete.src}
    BUILD FAILED
    C:\tutorial\javaeetutorial5\examples\web\books\build.xml:51: The following error
    occurred while executing this line:
    C:\tutorial\javaeetutorial5\examples\bp-project\database-ant.xml:48: java.io.Fil
    eNotFoundException: C:\tutorial\javaeetutorial5\examples\web\books\${db.delete.s
    rc} (The system cannot find the file specified)
    I finally went to the bookstore directory to see if I could deploy that application. Ant deploy gave the following:
    check:
    tools:
    -pre-deploy:
    -pre-init:
    init:
    check:
    tools:
    start-db:
    [exec] Database already started on host localhost, port 1527.
    [exec] Command start-database executed successfully.
    delete-tables:
    [sql] Executing file: C:\tutorial\javaeetutorial5\examples\web\books\${db.
    delete.src}
    BUILD FAILED
    C:\tutorial\javaeetutorial5\examples\web\books\build.xml:51: The following error
    occurred while executing this line:
    C:\tutorial\javaeetutorial5\examples\bp-project\database-ant.xml:48: java.io.Fil
    eNotFoundException: C:\tutorial\javaeetutorial5\examples\web\books\${db.delete.s
    rc} (The system cannot find the file specified)
    Last, I went to bookstore1 just to try the ant deploy again, see if things were cleared up, and maybe the errors above wouldn't affect it. When I tried deploying I got the following...
    check:
    tools:
    -pre-deploy:
    -pre-init:
    init:
    check:
    tools:
    start-db:
    [exec] Database already started on host localhost, port 1527.
    [exec] Command start-database executed successfully.
    delete-tables:
    [sql] Executing file: C:\tutorial\javaeetutorial5\examples\web\books\${db.
    delete.src}
    BUILD FAILED
    C:\tutorial\javaeetutorial5\examples\web\books\build.xml:51: The following error
    occurred while executing this line:
    C:\tutorial\javaeetutorial5\examples\bp-project\database-ant.xml:48: java.io.Fil
    eNotFoundException: C:\tutorial\javaeetutorial5\examples\web\books\${db.delete.s
    rc} (The system cannot find the file specified)
    I'm clearly not 'getting' a handle on this environment.

  • Help!! java,rmic,rmiregistry,java,classpath,etc.

    My problems lie I think mainly when I try to javac, rmic, start rmiregistry and java in DOS. My directory structure is d:\javas\java\jdk\bin\MyAss1(project name)\Classes\
                             - Client (package name) + .java file
                             - Interface (package name) + 2 .java files
                             - Server (package) + 3 .java files
    I have set the classpath and unset the classpath so many times I am cross-eyed. How do I set the classpath for compiling, then rmic�ing, then start rmiregistry and then again for starting servers? I have read countless documentation about this and am still confused. I think everything is going fine until I start the server � goes for a very long time and then eventually gives me � --- bound to registry�. When I start the client I get a very long error message, something about not being able to find the .stub. I am assuming it can�t find the .stub or am generating a wrong stub. Please tell me how to do this properly. I would be forever grateful as I am spending too much time on this and not enough on my other subjects. Thanks.
    Below is my code. I am using Jcreator for my editor and JDK1.4.0 Beta version.
    package Interface;
    public interface MyClass extends java.rmi.Remote {
    public void setMyClass(String val) throws java.rmi.RemoteException;
    public String getMyClass() throws java.rmi.RemoteException;
    }//MyClass
    package Interface;
    public interface MyClassFactory extends java.rmi.Remote {
         public MyClassFactory makeMyClass() throws java.rmi.RemoteException;
    }//MyClassFactory
    import Interface.*;
    import java.io.Serializable;
    // implementation for MyClassFactory
    public class MyClassFactoryServant extends UnicastRemoteObject implements MyClassFactory {
         public MyClassFactoryServant() throws RemoteException {
              //no code needed : will call parent constructor automatically
         }//default constructor
         public MyClassFactory makeMyClass(){
              try {
                   return( (MyClassFactory) new MyClassFactoryServant());
              }//try
              catch (Exception e) {
                   System.out.println(e);
                   return(null);
              }//catch
         }//makeMyClass
    }//MyClassFactoryServant
    package Client;
    import java.rmi.*;
    import Interface.*;
    public class MyClassRMIClient {
    private static String message = "";
    private static String name = "rmi://localhost/MyClassFactory";
    public static void main(String args[]) {
              String host="localhost";
              if (args.length >0) {
                   host=args[0];
    try {
         MyClassFactory sFact = (MyClassFactory) Naming.lookup(name /*"//"+host+"/MyClassFactory"*/);
                   MyClass st = (MyClass) sFact.makeMyClass();
                   st.setMyClass("Here I am");
    message = st.getMyClass();
    System.out.println(message);
    }//try
    catch (Exception e) {
                        System.out.println("GenericClient exception: " +
    e.getMessage());
    e.printStackTrace();
    }//catch Error
    }//main
    }//GenericClient
    package Server;
    import java.rmi.*;
    import Interface.*;
    public class MyClassRMIServer {
         public static void main(String args[]) {
              try {
                   MyClassFactoryServant obj = new MyClassFactoryServant();
                   // Bind this object instance to the name "MyClassFactory"
                   Naming.rebind("rmi://localhost:1099/MyClassFactoryServant", obj);
                   System.out.println("MyClassFactoryServant bound in registry");
              } catch (Exception e) {
                   System.out.println("MyClassFactoryServant err: " + e.getMessage());
                   e.printStackTrace();
              }//catch Errors
         }//main
    }//class GenericServer
    package Server;
    import java.rmi.*;
    import java.rmi.server.*;
    import Interface.*;
    public class MyClassServant extends UnicastRemoteObject implements MyClass {
         // what follows is the implementation of the
         String theString;
         public MyClassServant() throws RemoteException {
              //no code needed : will call parent constructor automatically
         }//default constructor
         public void setMyClass(String val) throws java.rmi.RemoteException {
              theString = val;
         }//setMyClass
         public String getMyClass() throws java.rmi.RemoteException {
              return(theString);
         }//getMyClass
    }//MyClassServant

    here are some batch files i wrote to achieve all the javac, rmic, etc. i'll start with a couple of folder lists so that you can see where the files end up after the batch files have been executed
    the project starts with the following structure
    \archives
    \classes
    \policies
    \projects\test\rik\server
    ----read.me
    ----cleanProject.bat
    ----compileClient.bat
    ----compileServerImplementation.bat
    ----compileServerInterface.bat
    ----deployPolicies.bat
    ----runClient.bat
    ----startRegistry.bat
    ----startServer.bat
    ----testLenClientOfRik.policy
    ----testRikServerImpl.policy
    \source\test\len
    ----ClientOfRik.java
    \source\rik
    ----Server.java
    \source\rik\server
    ----Impl.java
    and ends up with this one
    \archives
    ----classes.jar
    \classes\test\len
    ----ClientOfRik.class
    \classes\test\rik
    ----Server.class
    \classes\test\rik\server
    ----Impl.class
    ----Impl_Skel.class
    ----Impl_Stub.class
    \policies
    ----testLenClientOfRik.policy
    ----testRikServerImpl.policy
    \projects
    (this remains unchanged)
    \source
    (this remains unchanged)
    this is achieved by executing the following batch files in the following order
    rem cleanProject.bat start
    @echo off
    echo Cleaning project
    echo Deleting java archives
    del \archives\classes.jar
    echo Deleting class files
    del \classes\test\rik\Server.class
    del \classes\test\rik\server\Impl.class
    del \classes\test\rik\server\Impl_Skel.class
    del \classes\test\rik\server\Impl_Stub.class
    del \classes\test\len\ClientOfRik.class
    echo Deleting policy files
    del \policies\testRikServerImpl.policy
    del \policies\testLenClientOfRik.policy
    rem cleanProject.bat end
    rem compileServerInterface.bat start
    @echo off
    echo Compiling server interface
    javac -d \classes \source\test\rik\Server.java
    echo Maintaining class archive
    chdir \archives
    jar cvf classes.jar -C \classes \test\rik\Server.class
    rem compileServerInterface.bat end
    rem compileServerImplementation.bat start
    @echo off
    echo Compiling server implementation
    javac -classpath \archives\classes.jar -d \classes \source\test\rik\server\Impl.java
    echo Creating server stub and skeleton classes
    rmic -classpath \classes -d \classes test.rik.server.Impl
    cd \projects\test\rik\server
    rem compileServerImplementation.bat end
    rem compileClient.bat start
    @echo off
    echo Compiling client of rik of len
    javac -classpath \archives\classes.jar -d \classes \source\test\len\ClientOfRik.java
    rem compileClient.bat end
    rem deployPolices.bat start
    @echo off
    copy testLenClientOfRik.policy \policies
    copy testRikServerImpl.policy \policies
    rem deployPolices.bat end
    rem startRegistry.bat start
    @echo off
    echo Starting the rmi registry
    start rmiregistry
    rem startRegistry.bat end
    rem startServer.bat start
    @echo off
    echo Starting the test rik server
    start java -classpath \classes -Djava.rmi.server.codebase=file:/d:\classes/ -Djava.rmi.server.hostname=localhost -Djava.security.policy=\policies\testRikServerImpl.policy test.rik.server.Impl
    rem startServer.bat end
    rem runClient.bat start
    @echo off
    echo Running the client of rik of len
    java -classpath \classes -Djava.security.policy=\policies\testLenClientOfRik.policy test.len.ClientOfRik
    rem runClient.bat end
    beware 'cos the line breaks (may) have been added by the text window in which i'm typing and you'll have to remove them if you use 'em...
    i can send you a zip of the whole shebang, if you like; otherwise just modify the stuff above...
    good luck
    rik

  • Java classpath parameter

    Hi,
    I have created the small program to test the log4j.
    I have follwing directory structutre:
    TestLog4j.jar
    |
    +---lib
            log4j-1.2.15.jarI have executed following command:
    D:\Java\Programs\TestLog4j\release>java -classpath "./lib/log4j-1.2.15.jar" -jar TestLog4j.jarBut I have still ClassNotFoundException exception:
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
            at Main.Test1.<clinit>(Test1.java:6)
    Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClassInternal(Unknown Source)
            ... 1 moreFor the God! What Am I doing wrong?
    Thanks a lot
    Regards,
    Petr

    Hi, thanks for comments,
    the problem lies as linker said in the refferencing the jar instead of main class. Additionally in the classpath must be listed also the jar itself, which tooks me another hour to find out:)
    There is working example for the directory structure shown above for anyone, who will have similar problem:
    java -classpath ".\TestLog4j.jar;.\lib\log4j-1.2.15.jar" Main.Test1where TestLog4j.jar is my test jar, which uses classes from log4j-1.2.15.jar and the TestLog4j.jar entry point (i.e. public static void main(String args[])) lies in the Main package in the class Test1.
    BR
    STeN

  • Same Java classpath for any schema?

    Hello,
    I want to call a static Java method from PL/SQL, and my question is do all schema's on the database share the same Java classpath? The static Java class will read a config file on the classpath, and I want to know if all schema's that call this method will read the same config file (I would prefer if not).
    Thanks,
    Chris

    Yes, I agree with whatever you say. But there are associated problems by we ourselves enquiring the parser to return the NodeList using XPath.
    For example, let the input XSD file contain an xsd:include statement, which includes another XSD file. Then when I say:
    document.getElementsByTagName("xsd:complexType");only the list of nodes available in that particular XSD file are obtained, but none from the included file appear. This is the disadvantage of using custom (XPath) queries.
    Rather if there is an implementation supporting Schema Object Model specification, it would be easy to overcome such difficulties. I'm able to successfully use MSXML's SDK for SOM and am able to obtain all the included xsd:complexType elements as well.
    Hope this is clear.
    Thanks,
    Kalyan

  • JAVA classpath: How to find classpath for a given java process

    I want to find the classpath for java process outside of the process.
    example:
    Lets say I execute the following command
    java -classpath foobar.jar;shoobar.jar javatest
    Is there a way to find the classpath from a different program given the process id that is created for the above command?
    Ami shukla

    Perhaps through an externally connected debugger? Beyond that, the only thing I can think of would be to modify the source to report that information for you.

  • DASE Linux - Java CLASSPATH

    Folks,
    I have set java path in /etc/profile.d as java.sh, following are it's content -
    #!/bin/bash
    JAVA_HOME=/usr/java/jdk1.2.2
    JMF_HOME=/usr/java/JMF1.1
    LD_LIBRARY_PATH=/usr/java/jdk1.2.2/jre/lib/i386
    PATH=$JAVA_HOME/bin:$JMF_HOME/bin:$LD_LIBRARY_PATH/bin:$PATH
    export PATH JAVA_HOME JAVA_JMF LD_LIBRARY_PATH
    #export CLASSPATH=.
    I have checked following things for java path - which javac, it's works and also in
    path where I am suppose to do ./configure, it's works.
    After doing make 2>&1 | tee log.mks I get following errors -
    Exception in thread "main" java.lang.NoClassDefFoundError: tools/simulation/DataGen
    make[1]: *** [test] Error 1
    make[1]: Leaving directory `/home/DASE/nist_ri/devkit'
    make: *** [make-install] Error 1
    I presume, that somehow there is an issue for setting the java CLASSPATH. My classpath
    has all jar files as asked in NIST DASE document - devkit.jar, stb.jar, dase.jar & libjreX.so.
    I would appreciate if I can get some clue to resolve above issues.
    Regards,
    Mukesh K Srivastava

    Hi
    Most Linux machine's use bash as their shell, so you can try editing your ".bashrc" file which lies in the root of your profile directory (normally it would be something like "/home/username"
    If you want to make the changes for all users that log onto the machine you've got a couple of options - you can edit the ".profile" file under "/etc" , or you can run a script at a certain run-level; I normally choose run-level 3. OK, this last bit might sound like Greek to you, but it's also easy - have a look under "/etc" you'll find a dir called "rc.d" under that you'll find various dirs called "rc1.d", "rc2.d" etc; every dir contains scripts that execute when a certain run-level is reached. You can then just add a script that loads your environmental variables.
    Below is an example of how you could set you're environment variables in your ".bashrc" file:
    JAVA_HOME=/usr/lib/jdk1.3.1
    export JAVA_HOME
    TOMCAT_HOME=/opt/jakarta
    export TOMCAT_HOME
    PATH=/usr/lib/jdk1.3.1/bin:$PATH
    export PATH
    CLASSPATH=$JAVA_HOME/lib/tools.jar:.:/usr/lib/j2sdkee1.2.1/lib/j2ee.jar
    export CLASSPATH
    As you can see I set a number of variables - but that's just because I do a bit of J2EE dev every now and again
    Hope this helps - and welcome to the world of Linux!!!!!

  • [Newbie] Where are good example beans to learn from?

    I have been a professional software developer for 30 years (yes, I
    started using card punches and paper tape...), and have developed 3
    commercial Java/Swing desktop apps in the past 4 years. However, all my
    experience has been desktop apps. I'm now trying to teach myself JSP
    (starting to get a handle on that) and EJB (just starting literally
    today).
    Oh yes, doing this on my own nickel at home, so I can't afford Weblogic
    yet... I have JBoss/Cataline and MySQL running on my home Mac OSX
    system.
    What are some good sites where I can find good example bean code to
    read/modify/learn from?
    I am particularly interested at this point in database access beans.
    Something I could use as a template to develop a Customer, Invoice,
    Product bean (for an app I am writing to teach myself all this stuff).
    PS: If you know someone that needs a good C/C++/Java-Swing programmer,
    send them to my resume at:
    http://www.mindstorm-inc.com/software.html
    I'm between contracts (hence the time to learn this stuff).

    Hi Burt.
    BEA WLS does have some good EJB examples you might be interested.
    After you install WebLogic Server or Platform 7.0, you will find a directories
    in <weblogic700>\samples\server\src\examples, ejb11 and ejb20 ( The naming convention
    basically means EJB examples compliant with EJB Spec 1.1 or 2.0 ).
    In particular for EJBs intensively doing Database work, you probably want to go
    through container managed and bean managed EJB examples in each of ejb11 and ejb20
    directories correspondingly. In each of the examples, there is a package-summary.html
    page provides you the example details.
    Hopefully, above helps.
    Thanks.
    Ji Zhang
    Developer Relations Engineer
    BEA WebLogic Support
    [email protected] (Burt Johnson) wrote:
    I have been a professional software developer for 30 years (yes, I
    started using card punches and paper tape...), and have developed 3
    commercial Java/Swing desktop apps in the past 4 years. However, all
    my
    experience has been desktop apps. I'm now trying to teach myself JSP
    (starting to get a handle on that) and EJB (just starting literally
    today).
    Oh yes, doing this on my own nickel at home, so I can't afford Weblogic
    yet... I have JBoss/Cataline and MySQL running on my home Mac OSX
    system.
    What are some good sites where I can find good example bean code to
    read/modify/learn from?
    I am particularly interested at this point in database access beans.
    Something I could use as a template to develop a Customer, Invoice,
    Product bean (for an app I am writing to teach myself all this stuff).
    PS: If you know someone that needs a good C/C++/Java-Swing programmer,
    send them to my resume at:
    http://www.mindstorm-inc.com/software.html
    I'm between contracts (hence the time to learn this stuff).

  • Java classpath error while crawling sample user defined datasource (SampleA

    Hi All,
    I am trying to run the sample crawler agent provided by ultra search "SampleAgent.java". For this
    I have created and configured the user defined datasource type and the user defined data source (for the NEWS TABLE) as per the readme file of the Sample Crawler agent.
    I have also created a schedule for this user defined type.
    However, while executing the schedule I am getting the following error:
    WKG-30116: Can not find agent class "SampleAgent" from the java class path
    Please let me know the reason for the error. Am I right in creating and executing a schedule for user defined data source? (the doucmentation never says that, for user defined datasource, I need to create a schedule and execute it!!)
    Also, after going through some of the postings in this discussion forum I understood that I need to check my java classpath from the WK$CRAWLER_DEFAULT_CONFIG table.
    In this table my the value for
    CC_JAVA_EXEC_PATH is "C:\oracle\ora92\jdk\bin\java.exe -ms16m -mx256m"
    and
    CC_JAVA_CLASS_PATH is
    "-classpath
    C:\oracle\ora92\jdbc\lib\classes12.zip;
    C:\oracle\ora92\jdbc\lib\nls_charset12.zip;
    C:\oracle\ora92/ultrasearch/lib/ultrasearch.jar;
    C:\oracle\ora92/ultrasearch/lib/ultrasearch_db.jar;
    C:\oracle\ora92/lib/mail.jar;
    C:\oracle\ora92/lib/activation.jar;
    C:\oracle\ora92/ultrasearch/lib/jgl3.1.0.jar;
    C:\oracle\ora92/lib/xmlparserv2.jar;
    C:\oracle\ora92/lib/xschema.jar;
    C:\oracle\ora92/ultrasearch/bin;
    C:\oracle\ora92/ultrasearch/lib/agent/"
    Do I need to change any of these values? If so, what changes should I make and how should I make those changes?
    NOTE THAT I AM USING THE DATABASE VERSION OF ULTRASEARCH.
    Thanks in advance,
    Amit Sangle

    Hi All,
    I would appreciate any help that I get regarding this post.
    If anyone has run the Sample crawler Agent please let me know the steps needed to make it work. I have followed the steps mentioned in the readme file here:
    http://otn.oracle.com/docs/products/ultrasearch/doc_library/ultrasearch9_2/sample_agent_readme.htm
    Are there any other configurations that I need to do? Am I missing something? Please let me know.
    Thanks and Regards,
    Amit Sangle

  • Is there a good example of a shuttle item?

    Hello,
    I am looking for a good example of a shuttle:
    How to populate a Left side, Right site and a Merge to save results.
    Left side should have all available options, except the ones that User already have.
    Right side should have only options that User already have.
    Both sides of shuttle should be populated on page load with Options names, not IDs.
    Using apex 4.2
    If there is any demo app with a shuttle that would be helpful too.
    Thank you.
    Added some clarifications.

    Hi ,
    Please find the below threads/blogs which mey be helpful
    1.Dimitri Gielis Blog (Oracle Application Express - APEX): APEX by Example - Default value of Shuttle
    2.https://community.oracle.com/thread/2374927
    3.http://www.easyapex.com/index.php?p=206
    4.https://community.oracle.com/thread/1120460
    5.Re: Denes's Ajax Filter Shuttle List not working in IE
    Hope this helps!!
    Thanks,
    Shwetha

Maybe you are looking for