Classpath in LINUX????

Where and how to set classpath in linux??.
Is it the same way as we do it for windows???.
regards,
koel

I have set my classpath properly in my LINUX OS.When i run my class file it throws the following error.
[root@ compfetch]# java com.trytill.comp.analyse.SiteAnalysisFlow
java.lang.NoClassDefFoundError: java/util/ArrayList
I tried to see the contents of the src.jar.I'm getting the following error message
[root@ java]# jar tf src.jar
java.lang.NoClassDefFoundError: sun/tools/jar/Main
at java.lang.Throwable.<init>(Throwable.java:40)
at java.lang.Error.<init>(Error.java:21)
at java.lang.LinkageError.<init>(LinkageError.java:21)
at java.lang.NoClassDefFoundError.<init>(NoClassDefFoundError.java:21)
I want to know whether this error is becoz of the jdk kit i have.If so,which version of jdk is compatible with LINUX OS

Similar Messages

  • Setting Classpath in linux

    Hi !! Can anyone help me in setting classpath in linux to run servlets/? I tried using this command..but didnt work
    export CLASSPATH="$CLASSPATH:/usr/share/tomcat5/server/lib/servlets-common.jar"
    Thanks
    Nive

    in ur autoexec.bat file write the following
    set PATH=C:\jdk1.5.0_04\bin;%PATH%
    set JAVA_HOME=C:\jdk1.5.0_04
    set
    CLASSPATH=.;C:\jakarta-tomcat-5.5.9\common\lib\servlet
    -api.jar;C:\jakarta-tomcat-5.5.9\common\lib\jsp-api.ja
    r;C:\Servlets+JSP;..;..\..;C:\jakarta-struts-1.2.4\lib
    \struts.jarThis response is meaningless. Principally because the OP specifically mentioned the use of LINUX. Not Windows.
    I've taken the advice of other forum users by avoiding a system level classpath variable. I define the classpath each time I compile and run. Working on Linux I tend to use command line argument files ( http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html#commandlineargfile ) which eliminates the need to redefine the classpath each time I compile or run my classes and apps. But others may do things differently.
    Here is a website you might want to check out which pertains to setting the classpath on Solaris and Linux.
    http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html

  • Set classpath in linux

    if u dont mind plz explain the steps of how to set java classpath in linux.?

    The same way you do it in windows, except that you use ":" instead of ";" to seperate the paths.
    Although you can set a environment variable (CLASSPATH), it is usually best to just provide the classpath explicitely in each command:
    javac -cp <myclasspath> com/foo/Bar.java
    java -cp <myclasspath> com.foo.Bar

  • Setting Path and Classpath in Linux environnement

    Hello,
    I use to develop with JAVA under Windows platform,
    now i am using j2sdk under Mandrake 8.0 , i dunno how to set my PATH end Classpath variables, could you show me how?
    Thanks

    Put this in your user's .bashrc file at the end of it.
    JAVA_HOME=/path/to/java/install
    PATH=$PATH:$JAVA_HOME/bin
    export JAVA_HOME PATHAnd buy a book on Unix/Linux.

  • About path and classpath in linux

    How to set classpath and path in Linux.
    thank you very much!

    The class path can be set using either the -classpath option when calling an SDK tool (the preferred method) or by setting the CLASSPATH environment variable. The -classpath option is preferred because you can set it individually for each application without affecting other applications and without other applications modifying its value.
    % sdkTool -classpath path1:path2...
    -or-
    % setenv CLASSPATH path1:path2...
    where:
    sdkTool
    A command-line tool, such as java, javac, or javadoc. For a listing, see SDK Tools.
    path1:path2
    Paths to the .jar, .zip or .class files. Each path should end with a filename or directory depending on what you are setting the class path to:
    For a .jar or .zip file that contains .class files, the path ends with the name of the .zip or .jar file.
    For .class files in an unnamed package, the path ends with the directory that contains the .class files.
    For .class files in a named package, the path ends with the directory that contains the "root" package (the first package in the full package name).
    Multiple path entries are separated by colons.
    The default class path is the current directory. Setting the CLASSPATH variable or using the -classpath command-line option overrides that default, so if you want to include the current directory in the search path, you must include "." in the new settings.
    Classpath entries that are not either a directory or an archive (.zip or .jar file) are ignored.

  • How i can setup CLASSPATH in Linux!!!

    Help me plese how I can to modify PATH for JMF in Linux Red Hat 7.2

    The syntax for setting your classpath is slightly dependent on which shell you are using. The default shell for RedHat 5.x and 6.x is the bash shell. Two other popular shells are tcsh and and csh called "t shell" and "c shell." Thus, these 3 shells are covered here. If you are using a different shell, you can read the man pages by typing man "shellname" to find out the exact syntax. To find out which shell you are running, type the command finger yourusername such as finger tfox and look at the argument for Shell.
    For bash shell:
    export CLASSPATH=$CLASSPATH:/java/myjar
    export PATH=$PATH:/java/mybin
    For tcsh or csh:
    set CLASSPATH = $CLASSPATH /java/myjar
    set PATH=$PATH:/java/mybin
    These commands can either be typed at the terminal each time you login, or you can add it to your .bashrc for bash shell or .cshrc for csh or tcsh so that each time you login, the CLASSPATH is already set. The $CLASSPATH means to keep the existing CLASSPATH and then append it with the other directories listed. This is helpful if a directory is set in the CLASSPATH by the System Administrator for everyone.

  • Using javac and classpath with Linux

    My classpath is
    /usr/java/jdk1.3.1_02/bin (that's the path to jdk1.3.1)
    but I get a
    /usr/java/jdk1.3.1_02/bin/i386/native_threads/javac: error while loading shared libraries: libstdc++-libc6.1-1.so.2: cannot open shared object file: No such file or directory
    error when I try to compile a java file with javac. tried to set the classpath to
    /usr/java/jdk1.3.1_02/bin/i386/native_threads/
    and I get another error with that
    Any help is appreciated, thanks

    <http://developer.java.sun.com/developer/bugParade/bugs/4405489.html>
    Assuming you are using RedHat, if other search at rpmfind.net for your distro (if it's a RPM-based distro):
    You need either:
    For RedHat 7.1: <http://www.rpmfind.net//linux/RPM/redhat/7.1/i386/compat-libstdc++-6.2-2.9.0.14.i386.html>
    For RedHat 7.2:
    <http://www.rpmfind.net//linux/RPM/redhat/7.2/i386/compat-libstdc++-6.2-2.9.0.16.i386.html>
    The CLASSPATH values have already been specified in many other posts.
    Bhav

  • Pakages & how to added them to your CLASSPATH  under Linux OS

    Yesterday i posted a question how to setup a CLASSPATH under
    win2000. Finally with some help i got to work perfectly.
    here is the link for that thread if any one interested in it.
    http://forum.java.sun.com/thread.jsp?forum=31&thread=277111
    Now my question how to do the same thing under Linux OS. I'm using
    linux Redhat 7.3. Just to give you an idea, i have created a package is structure shown bellow. I'm looking to add the package somehow to my
    CLASSPATH or setting it up inorder to be able to import it in any application i might need to that package for.
    archives/mo
    archives/mo/util
    archives/mo/io
    archives/mo/fileutil
    ... Any idea how to do that in Linux

    Hi,
    Ok edit .cshrc file in your root dir, and add a line
    set CLASSPATH=( pkg_a pkg_b pkg_c . )
    this should work, if not try a few different configurations on the command line like infact try this first then edit your .cshrc file
    [ option 1 ]
    home> set CLASSPATH=(pkg_a pkg_b .)
    home> echo $CLASSPATH
    pkg_a pkg_b
    home> { then try a sample java program }
    [ option 2 ]
    home> set CLASSPATH=pkg_a:pkg_b:.
    home> echo $CLASSPATH
    pkg_a:pkg_b:.home> { then try a sample java program }
    regards,
    gearoid

  • Compiling packages in linux

    Hi I have been struggling with this for the last three days. I have tried multiple searches in the forums but cannot make head nor tail of setting the classpath in linux when compiling a package.
    in the following directory "/home/tamtam/Java/Course/Unit4/act4_1"
    I have two classes Greeting.java and Main.java
    Greeting.java compiles successfully and creates Greeting.class
    I cannot compile Main.java which uses the class Greeting.
    Both have package act4_1 as the first line in the code.
    I know I need to set the classpath but have been unable to do so. Where is the starting directory.
    I havenot got a clue where to start.
    I get error message
    Main.java:15: cannot resolve symbol
    symbol : class Greeter
    location: class act4_1.Main
    Greeter greeter = new Greeter();
    Any help would be greatfully appreciated.
    tamtam

    I am completely new to Linux and just started with Java.
    Does anyone know a link to a step by step guide.
    in C++ say I had two files in the same directory "Greetings.cpp" and "Main.cpp" and there coresponding header files. Main.cpp uses an instance of the class Greeting. I would use include "Greeting.cpp" in Main.cpp so that the class Greeting would be available.
    In Java I have two files, Greeting.java and Main.java. Both have package act4_1 at the top of the file.
    Main.java
    package act4_1;
         Activity 4.1
         Main.java
         Runs Greeting.java
    import java.io.*;
    public class Main
         public static void main(String[] args) throws IOException
              Greeter greeter = new Greeter();
              greeter.Run();
    }Greeting.java
    package act4_1;
         Activity 4.1
         Greeter.java.
    import java.io.*;
    public class Greeter {
         public void Run() throws IOException
              System.out.println("Hello from TamTam");
    }How exactly do I get Main.java to accept the class Greeter.
    The path is as above.

  • Javac problem due to a wrong classpath - WHY?

    Hi,
    this is the initial part of my classpath:
    luca@linux:~> echo $classpath
    :/java/jdk/jre/lib/rt.jar:/java/jikes/rvm/2.3.0.1/rvm.classes:
    As you can see the first entry is the rt.jar, while the second is a wrong path that leads to a directory tree where there are both classes and sources. In particular, under rvm.classes there is a structure similar to the java one, with the java directory, java/lang, etc.
    With this (wrong) classpath, when I try to compile an application, the compiler stops due to problems compiling java.lang.Thread under rvm.classes. I've solved the problem inserting the right classpath in the second entry, but I'd like to know why the compiler asks me to compile Thread since it should be already available from rt.jar (which is the first entry).
    Thanks,
    Luca

    You don't need to put rt.jar in the classpath, the compiler will automatically look there for classes. So perhaps you are confusing the compiler by putting it there. Take it out.

  • Linux Oracle

    Can someone tell me how to use Oracle database in my java applications on Linux OS.
    I have downloaded classes12.zip and set PATH, CLASSPATH on linux but still my program is not able to find OracleDriver class
    "java.lang.ClassNotFoundException: oracle:jdbc:driver:OracleDriver"
    Any suggestions are really appreciated.
    Thanks.

    Your CLASSPATH is not getting set correctly for the application you are running.
    If you are using a container, put classes12.zip in a lib directory. If you are running from a shell script, pass in the path to classes12.zip with "java -classpath ..."
    http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html
    -Scott
    http://www.swiftradius.com

  • Jar files as application Error under linux

    I created a jar file with the following jar command
    jar cmf mainclass Asdi2GuiJar.jar *.class
    Main-Class: ASDIGUI
    It did work without any problem : java -jar Asdi2GuiJar.jar
    when I added to the CLASSPATH under linux "Redhat 7.2" C-shell, it give me an error:
    Exception in the thread main java.util.zip.ZipException: No Such file or directory
    even im not using any zip file class in my java application. Any idea why im getting such an error even before addding the jar file to the CLASSPATH it did work without any problem?

    ah young grasshopper you are using zip files :) rename your .jar file a .zip and use unzip on it :)
    and that error means that the jvm's classloader couldn't load it's zip component so it's likely that your jvm can't find it's standard lib's
    make sure your class path points to the /lib directory of your java install..... which version of the jdk are you using?
    are you setting the classpath globally? since the way you said CLASSPATH I guess you are... ....are you keeping the old classpath when you set it? like CLASSPATH=$CLASSPATH:/myNewSource
    or something like that...
    maybe something in that will help

  • Set java classpath.

    hai,
    how to export- set classpath on linux platform.where is jdk located on fedora linux.

    hai,
    i got all u had told,but classpath is set compiles and run only one java class.
    for ex if a class A object is called by class B which has main method and both are put in same folder,their i am finding prob's.problem is class B(main class) doesn't find class A objects and gives errors.

  • Set classpath for java in fedora core 1?

    i am new to programming java on linux and im having trouble finding out how to set classpath in the shell, permenently. i have the sdk installed and tried the usual "hello world" test and failed. the response i would get a message telling me javac is not a bash command. i have no clue how to set classpaths in linux so i would much appreciate it if someone would show me thanks

    Ok, there is two ways to achieve this. Either by setting it globally for all the user, or only for your self. If you are working on your own station and have super user access, you can set it up for all th eusers, if not, just set it for your self. How ??
    for all the users, modify the file /etc/profile and include this:
    PATH=$PATH:/path/to/jdk/bin:.
    CLASSPATH=$CLASSPATH:/path/to/jdk/lib/tools.jar:/path/to/jdk/lib/rt.jar
    export PATH CLASSPATH
    If you want to add it only for ur self then, modify the lsame line in ~/.bash_profile
    hope this helps

  • JDBC connector/J Installation HELP!

    Hi,
    I am new to Java technology.I need to connect a MySQL database with Java.
    I downloaded the connector/J from mySql site.
    I am unable to install the same on a linux machine.
    PLEASE anyone help me with a step-by-step procedure for installing it.I do not know how to set the CLASSPATH in linux and also registering the driver etc?
    Thanx in advance
    Ashwin.

    As far as I know, the classpath can be set in the .bashrc file for each user. Locate your user folder and open or create the .bashrc file. Inside this file add the following:
    CLASSPATH = ${CLASSPATH} :ADD_YOUR_JAR_HERE:ADD_YOUR_CLASSDIR_HERE:ETC.
    export CLASSPATHYou can also type the above on the commandline to try it out. By adding the lines to the .bashrc file the commands will be executed each time the user logs in.
    If you want a quick way of adding all jars inside a folder to the classpath, you can do this:
    addJar() {
            cd ${1}
            for f in *.jar
            do
                    CLASSPATH=${CLASSPATH}:${PWD}/${f}
            done
            cd --
    addJar /opt/java/jars
    export CLASSPATH

Maybe you are looking for