What is a classpath?

What does one mean by setting a classpath and how to do it in Linux (CentOS 5)?

I tried compiling my program... I get the following error...
src]#  /usr/java/jdk1.3.1_04/bin/javac -cp com/ail/cars/app/HeartBeat.java javac: invalid flag: -cp
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-encoding <encoding> Specify character encoding used by source files
-target <release> Generate class files for specific VM version
If I just say
src]# /usr/java/jdk1.3.1_04/bin/javac com/ail/cars/app/HeartBeat.java it complies but gives errors, few of them are -->
./com/ail/cars/app/Reader.java:245: cannot resolve symbol
symbol : class Message
location: class com.ail.cars.app.Reader
public void postMessages(Message[] aoMessage)
^
./com/ail/cars/app/Reader.java:258: cannot resolve symbol
symbol : class Message
location: class com.ail.cars.app.Reader
public boolean appendMessage(Message oMessage)
^
./com/ail/cars/app/Reader.java:1417: cannot resolve symbol
symbol : class Transaction
location: class com.ail.cars.app.Reader
private void fillEmployeeDetails(Transaction oTrans, HashMap ohmEmployee)
^

Similar Messages

  • What is the CLASSPATH for?

    Hi!
    I have installed the JDK and it works fine, only for some problems with packages I've created. (I can�t import using "*", I have to import every class to use, even in the same package)
    The only thing I haven�t configured it's the CLASSPATH.
    May it be the cause of my problem?
    Thanks
    Santiago

    Hi,
    Reagrding what "CalssPATH" is for..
    Check this link.
    http://java.sun.com/products/jdk/1.1/docs/tooldocs/win32/classpath.html
    Hope this info will help you.
    Thanks
    Roopasri Vittal
    Developer Technical Support
    Sun Microsystems
    http://sun.com/developers/support

  • What's this CLASSPATH thing?

    I am really new to Java. I'm at the very start of a book titled "Teach Yourself Java" and I'm trying execute the first example. This is it:
    class Example1 {
    public static void main(String args[]) {
    System.out.println("This is the output from Example1");
    I downloaded and installed Java SE into:
    C:\Program Files\Java\jdk1.6.0_11
    I defined folder C:\Java Applications and put my first file in there titled Example1.java. I'm Windows XP PRO BTW.
    At first it wouldn't compile because it couldn't find command javac. Based an another thread here I went into Start | Control Panel | System | Advanced | Environment Variables and updated variable PATH by adding to the end of it ;C:\Program Files\Java\jdk1.6.0_11\bin. It now compiles. But when I try to execute it with command
    java Example1.java I get error Exception in thread "main" java.lang.NoClassDefFoundError.
    I've read a dozen threads on this problem and most say something about adding a set CLASSPATH or a -cp command between command java and Example1.java. I've tried about everyone of the solutions but no luck. Where exactly is the main class it can't find? What do I need for it to find it when I execute it?

    winke04 wrote:
    I am really new to Java. I'm at the very start of a book titled "Teach Yourself Java" and I'm trying execute the first example. This is it:
    class Example1 {
    public static void main(String args[]) {
    System.out.println("This is the output from Example1");
    I downloaded and installed Java SE into:
    C:\Program Files\Java\jdk1.6.0_11
    I defined folder C:\Java Applications and put my first file in there titled Example1.java. I'm Windows XP PRO BTW.
    At first it wouldn't compile because it couldn't find command javac. Based an another thread here I went into Start | Control Panel | System | Advanced | Environment Variables and updated variable PATH by adding to the end of it ;C:\Program Files\Java\jdk1.6.0_11\bin. It now compiles. But when I try to execute it with command
    java Example1.java I get error Exception in thread "main" java.lang.NoClassDefFoundError.
    I've read a dozen threads on this problem and most say something about adding a set CLASSPATH or a -cp command between command java and Example1.java. I've tried about everyone of the solutions but no luck. Where exactly is the main class it can't find? What do I need for it to find it when I execute it?(Probable) solution:
    // to compile:
    javac Example1.java
    // to run:
    java -cp . Example1Don't forget the DOT after "-cp"!
    Explanation: [http://en.wikipedia.org/wiki/Classpath_(Java)]

  • What is a classpath and where can  i find it

    hi all...
    i am desperately loooking for the claspath as i have to include some directories in order for my program to run..plus i don't know the commands..thanks alot

    edit your autoexec.bat file to contain
    SET CLASSPATH=C:\TheDirectoryWhereIInstalledJava;MyOtherDirectories;

  • What is a classpath and where is it?

    hi...
    i am writing a program that requires me to include some directories in the classpath...but i don't where the classpath is..and how do i input the names of the directories...or do i run from it..actually i don' know a thing about classpaths..but i have to know in order for my program to run properly..thanks...

    A classpath is an environment property which allows the JVM to locate classes so that it can load them (to run).
    in a windows environment, u can type "set classpath=..." where ... is the directories containing your class files.
    For more information, do a search on "setting classpath". I believe many other users had similar problems with classpaths

  • MySQL and JDBC Classpath errors

    I am new to Java and installed MySql and also installed mysql-connectorJ driver. I can compile the code below, but when I go to run it, I get "Exception in thread "main" java.lang.NoClassDefFoundError: JDBCDemo/class" error. I can't figure out what I am doing wrong.
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class JDBCDemo {
         public static void main(String[] args) {
              try{  
    Class.forName("com.mysql.jdbc.Driver");
              catch (Exception e)
                   e.printStackTrace();
    I have a the following environment variable called MySQL_Driver located at "C:\Program Files\Java\jdk1.5.0_06\lib".
    Path = "%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared;%JAVA_HOME%;%JAVA_HOME%\lib;%JAVA_VM%\bin;%JAVA_VM%\lib;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\QuickTime\QTSystem\;%MySQL_Driver%"

    What is your CLASSPATH set to as you need to make sure that the driver is in the path as well as the directory/jar where the JDBCDemo app lives.
    Try explictly specifying everything via the -classpath option on your java command line

  • Path, classpath, java build path???

    I am happy with what path and classpath does but what is java build path for? could someone point me in the direction of where I can find more info?

    cool but the IDE also had a place where you could set the classpath. so is the java build path just like an extra way of setting up classes for different projects where the classpath in the IDE is used by all projects?

  • Classpath variable

    Can someone please help me with what exactly the classpath variable does? I have my java and javac.exe files located in C:\Program Files\Java\jdk1.5.0\bin. I can only compile and run files that are located in this directory. So if I put my HelloWorld.java file in that directory and run the compiler, it does create a HelloWorld.class file in that directory too. When I run the file using java HelloWorld the program runs fine.
    How can I save the files in other directories but still compile and run them? Any help would be great.
    Thanks.

    classpath variable is where u specify a path with files and such in it.
    Ie \Java\jdk1.5.0\bin has got files like javac.exe and such which can normally only be run from that folder but if u specify that folder as a classpath variable it means that u can run the file javac.exe from anywhere in the computer.
    To do this I have created a batch file I run every time.
    part of it is:
    set JAVA_HOME=C:\j2sdk1.4.2_05
    (no need to specify the bin folder I think)
    if u have something like XP look at system in the control panel under a button called environmental variables and add in that path
    Regards, Rory

  • Unsure about Classpath variable

    What should the classpath variable be set to? I am working through a tutorial from the command line for the first time and running into problems with classdefnotfound errors. It's saying to run it using java -classpath, but I thought that was just a shorter way to say what folder your workspace files are in. What should this be set to?

    The environment variable CLASSPATH should not be set to anything. It should not exist.
    If you do not include a -cp (or -classpath) command-line option, then the system looks for a CLASSPATH environment variable. If it finds it, it acts the same as if you had used that for the -classpath command-line option. If it does not, then it by default acts as if you included the "current directory" only as the -classpath.
    If you do include a -cp / -classpath command-line option, then the system ignores any CLASSPATH environment variable anyway.
    All "real" systems do not rely on a CLASSPATH environment variable. IDEs don't use it; J2EE containers (weblogic, jboss, etc) don't use it; applets don't use it; etc etc etc. It's basically only there for "toy" applications and beginners to try and make their life a little easier. However it just turns out to have confused them even more.

  • Classpath is not identifing the class file

    Iam developing cumtom java function event in Oracle WorkFlow. Here iam getting ClassNotFoundException. I included all class file in the jar file and the jar file added in the class path
    The problem seems be, java compiler not recognising the class which is there in the classpath.. any one suggest on this. ??

    Let's get this straight first: ClassNotFoundException is something that happens at runtime; that means you must have been able to compile your program successfully. So it is not the "java compiler not recognising the class".
    What does your classpath look like exactly?
    Is the class you are trying to use in a package?
    Are you correctly importing the class?
    Look inside the JAR files in your classpath to check if the class is really present in one of the JAR files.
    If you were able to compile the code successfully but you get an error while running it, then the compiler must have been able to find the class while you were compiling it. Are you passing the same classpath to the Java runtime environment as what you are using when you were compiling your code?
    And by the way, you posted this question in the forum about generics, but your question does not have anything to do with generics. Please post your questions in the appropriate forum in the future.

  • OC4J "classpath+properties" issue

    Hi,
    Is any fix available for the OC4J classpath+properties issue?
    It can't find *.properties files even if it is in the classpath.
    It's not convenient to jar properties files and edit the manifest.mf file in orion.jar every time you want to add new file
    Thanks

    The classpath for the Oc4j is entirely different than what is normal classpath. If you start your oc4j with -jar option the system classpath will never get effected. If you want your properties files to be recognized keep under the possible classpaths. Oc4j takes every thing from lib directory so you can keep there.
    If you have an application you can add <library path=""/> tags to your application.xml and keep the properties files in that directory.
    If you have webapplication usually web-inf\lib added in classpath.

  • What tools needed to complie java telephony application

    Dear all,
    I heve downloaded JTAPI.But I thnk it is only documentation of API.
    In that downloaded JTAPI I got all .java files too.
    Now my Question is : what path or classpath I would have to set so that It will give me the all the description of javax.telephony.Call or Terminal or any XYZ classes or Interface just like if U give javap java.awt.Graphics or java.applet.Applet gives U all the methods and veriable whithin it.
    If U got the Question's answer or U have it then reply me at my
    yahoo mail : [email protected] with subject ::::to answer to telephony question posted on Sun. by [email protected]
    ANOTHER THING :::::::>if what I downloaded is not enough then what else will be needed to compile my telephony related application.
    kindly forward the link to download those JTAPI that is needed to compile my applicaton
    I would grately be thankful to U.
    Thanks.......
    Yours friend
    Tapan Bhatt

    u can make all the java files of jtapi as a jar file.then compile it.then u get the class file.
    i'm using the JTAPI.i u know more about that means mail me.
    [email protected]

  • Statement abt classpath in build.xml, pls help..

    <target name="run" description="Runs the example client">
    <echo message="Running the ${client-class} program:" />
    <echo message="java -classpath dist/${client-jar}:${jwsdp-jars} ${client-class} ${endpoint}" />
    <echo message="" />
    - <java fork="on" classpath="dist/${client-jar}:${jwsdp-jars}:${jaxp-jars}" classname="${client-class}">
    <arg value="${endpoint}" />
    </java>
    </target>
    What does the classpath means? what does attributes like, {client-jar}:, {jwsdp-jars}, {jaxp-jars} and {client-class} mean? please reply..

    class path tells java where the code (.class files) and any related data files are. It can contain paths to files or .jar files. .jar files are the same as .zip files except there's an extra file called the manifest file. Open one of the .jar files with winzip (or whatever tool you use) andyou will notices that most files are .class files (compiled java files).

  • How to set CLASSPATH in an ejb ear application

    Hi Gurus,
    I want to generate an EAR EJB Application and put 3 jars in the classpath of all ejb modules of this ear. Is it possible? How coul I do this without changing the application server's classpath.
    Cheers,
    George

    If you do put the ClassPath in the ejb's manifest file, what is the relative directory path for the ejb.
    For example if I want to include a jar file called mylib.jar. What would the classpath in the manifest file be.
    And were would I put the jar file, same path as the ejb itself?

  • Java Connector & classpath

    hello,
    I'm trying to connect to my database but i have the following error :
    "no suitable driver".
    I think i've all configured well but i don't know what's the "classpath" for, and when i need it to get connected.
    i've got a .classpath file which contains the following code :
    <?xml version="1.0" encoding="UTF-8" ?>
    - <classpath>
    <classpathentry kind="src" path="" />
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" />
    <classpathentry kind="lib" path="D:/exonum/projet/debut/driver/mysql-connector-java-3.1.7-bin.jar" />
    <classpathentry kind="output" path="" />
    </classpath>
    What should i do to resolve my problem ? I would appreciate any explanations.
    thanx
    tamtam

    that's a standalone application...
    Here's the code for the connection
    public static Connection getConnection() throws SQLException, IOException {
            Properties props = new Properties();
            FileInputStream in = new FileInputStream("G:/exonum/Projet/debut/database.properties");
            props.load(in);
            in.close();
            String drivers = props.getProperty("jdbc.drivers");
            if (drivers != null)
                System.setProperty("jdbc.drivers", drivers);
            String url = props.getProperty("jdbc.url");
            String username = props.getProperty("jdbc.username");
            String password = props.getProperty("jdbc.password");
            return DriverManager.getConnection(url, username, password);
        }and the file database.properties contains :
    jdbc.drivers=com.mysql.jdbc.Driver
    jdbc.url=jdbc:mysql://url
    jdbc.username=login
    jdbc.password=********

Maybe you are looking for

  • Compilation error while generating the form in linux

    Hello everyone, I am using Oracle Designer ver10.1.2.4 in windows to generate the forms with standard object library ofgwebol.olb and template form ofgwebt.fmb. form (with both .fmb and .fmx files) are generated without errors. Also when I open the f

  • Wipe ipod software

    is it possible to completely wipe all software on an Ipod 4th Gen (not photo), and then reformat it into an external hard drive? I'm curious because i have had this Ipod for a few years now and it has needed a reformat from iTunes almost every week.

  • BT Infinity Change of Address Order Blocked and Lo...

    I have just moved house, and I placed an order to move my services, including BT Infinity, to the new address about a week before.  A couple of days later, BT called me and said that the engineer could not attend on the 8th August, but would attend o

  • Can not modify template CR 8.8 of SAP

    Hi all! I have problem when i modify the template CR 8.8 of SAP that i downloaded form portal of SAP. File name: XX-1.2.b1p After i modified the template with some work as insert logo, modify text,.... and then i attached in to SAP B1 8.8 but when i

  • Oracle discoverer with oracle AS

    Is it oracle discoverer for web version must be install with oracle AS?