In UNIX how to set classpath

I know nothing about UNIX. pls kindly give me some instruction on how to set classpath in UNIX, thanks!

best way is to set in your .profile (name differs between different shells, but whatever the OS/Shell is, it should starts with . and has a 'profile' string in the name). Try ls -a to find the file, edit it, insert lines like this:
CLASSPATH=xxxx
export CLASSPATH
Use : to seperate different path/files.
then every time when you log in, the classpath is setted.
if you already logged in, use the above lines in command line, but it only set class path of the current shell/console.
anyway, you should learn Unix before you do anything, or you'll have more trouble. do a search in yahoo or google to find on line tuturials, and SUN's Java tuturial has some basic instructions on how to use Java in Unix.

Similar Messages

  • How to set Classpath for MySQL

    Hi
    I want to connect to my mySQL db with a java program , but I don't know how to install the mySQL connector driver. Can anyone help me? or indicate somewhere where I might find the answer?
    And how to set Classpath for MySQL.
    my program gives an exception ClassNotFound.
    Exception :com.mysql.jdbc.Driver
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at Files.main(Files.java:352)
    Plz help me
    Thanx
    Lalit

    to make your life easy i tried to connect..
    what you have to do is.. you mysql database server should be running
    next you have to download one of the version of mysql driver.. i downloaded mysql-connector-java-5.0.5
    go to my computer right click - >advance tab -> click on environment variable -> put you path e.g. C:\Program Files\Java\jarFiles\mysql-connector-java-5.0.5\mysql-connector-java-5.0.5-bin.jar
    into your classpath in a user variable section..
    Try this code
    import java.sql.*;
    public class MySqlConnect{
         public static void main(String [] args){
              try{
                   Class.forName("com.mysql.jdbc.Driver");
                   String url ="jdbc:mysql://localhost:3306/test";
                   Connection con =DriverManager.getConnection(url,"root", "password");
                   System.out.println("Connection: " + con);
              }catch(ClassNotFoundException cnfe){
                   cnfe.printStackTrace();
              }catch(SQLException se){
                   se.printStackTrace();
    }have fun
    Gurnah

  • How to set classpath in WinXP Home edition

    Hello everyone,
    Recently I have try to run the HelloWorld java code, but it come up with a error. (Exception in thread �main� java.lang.NoClassDefFoundError: HelloWorld)
    Java programming Code:
    public class HelloWorld {
    public static void main (String args[]) {
    System.out.println("Hello World!");
    I also try to compile another simple program, and it come up with the simpler error, (Exception in thread �main� java.lang.NoClassDefFoundError: Add16And23)
    Java programming Code:
    public class Add16And23
         public static void main (String[] args)
              int sum;
              sum=16+23;
              System.out.println("The sum of 16 and 23 is " + sum);
    HOW CAN I FIX THIS, I read other threads before, it say some about class path.
    Do anyone know how to set it, in winXP?
    Do anyone know the whole path that I should put in, in winXP?
    What should I type in the (User variables for windows) and (System variables).
    I have :
    * (j2eesdk-1_4-dr-windows-eval) downloaded and installed;
    *WinXP Home edition Version 2002 Service Pack 1
    * My current Java path are (C:\Sun\AppServer\jdk\bin) in the (User variables for windows).
    Please help!!!
    Thank you all!!!

    I'm also windows xp.
    fllowing example:
    java_home=c:\j2sdk1.4.2_03\bin
    classpath=c:\j2sdk1.4.2_03\dt.jar;c:\j2sdk1.4.2_03\tool
    .jarThis won't fix a thing.
    When you run, do it like this:
    java -classpath . HelloWorldNote the "dot" after -classpath. That tells the class loader to look in the current directory for the .class files it needs.
    Read about how to run the javac.exe and java.exe tools in your javadocs. You'll have to learn about CLASSPATH. - MOD

  • How to set classpath from java class ??

    I have tried to use System.setProperty("java.class.path", "my class path string ") to set classpath dynamically. But it is not working. How to set it dynamically from java class ?? Thanks , gary

    Look into the java.net.URLClassLoader. You can't set the classpath after the fact but you can specify URL's that will checked when you try to load a class with that loader.

  • How to Set CLASSPATH in Apache Web Server Using IAS

    Hi,
    I have problem setting the classpath for the servlet I am using for file uploading...My work environment is Web Server is Apache with Oracle8i IAS on Sun Solaris..
    I have tried various method like setting wrapper.classpath=/oracle/ias/Apache/Jserv/servlets and my class resides under /oracle/ias/Apache/Jserv/servlets/com/oreilly/servlets/MultipartRequest.class
    in the Jserv.properties, still it get the error message class ...not found in type declaration when I compile the code...my reference to the servlet in my JSP code is com.oreilly.servlet.MultipartRequest ..
    Can someone help me out please, if you have have any idea of how to set the class path with the working environment I have specified ealier....
    null

    have you posted this on the ias 9i forum where the ias 9i apache experts are at ??

  • How to set classpath for J2ME

    how to set class path for j2me. I downloaded J2ME Wireless tool kit. And set the classpath "set classpath=c:\J2mewtk\lib\midpapi.zip;.;". but i could compile java file. .how to set.
    With regards
    Santhosh

    When you are downloading j2MEWTK, everything is included within it. You dont require MIDP seperately. When you are runnung the ktoolbar , which is provided with J2mewtk, the preverifier runs and creates the required jad file for you. You dont need a forte to run these.
    If you want to download MIDP seperately, that also is possible. Then you have to go for command line arguments. Please refer to Sun's MIDP page for details.
    Let me know, if you face any further problem

  • How to set classpath and server configuration in eclipse

    i am new to eclipse tool pls anyone tell me to set classpath and serverconfiguration (tomcat) and sample program

    Get WTP [1], install it [2] and checkout one of the lot Eclipse WTP tutorials [3].
    [1] http://www.eclipse.org/webtools/
    [2] http://ftp.osuosl.org/pub/eclipse/technology/phoenix/demos/install-wtp/install-wtp.html
    [3] http://www.eclipse.org/webtools/community/tutorials/BuildJ2EEWebApp/BuildJ2EEWebApp.html

  • How to set classpath to use imported packages?

    Hi all,
    a real newbie question:
    I have created a class in which i import the java.io package. I can compile this class with the Oracle JDeveloper IDE (this is a variation on JBuilder).
    The problem is that i can't run this class because (most probably) the java.io package is not in the class path.
    Which jar file should i include in my classpath?
    jdk1.3\src.jar
    or jdk1.3\lib\tools.jar
    or jdk1.3\lib\dt.jar
    or ...
    Where can i find information on this? How can i find structure in the jungle of classes and packages?
    thanks, Bart

    If you want to execute this class file there are two ways you can do this:
    First set your environment PATH:
    Second you can explicitly state the classpath: for example
    change to the directory with the class file:
    cd c:\progra~1\Oracle\JDEVEL~1.0\MYCLAS~1
    while in the directory type
    java -classpath c:\progra~1\Oracle\JDEVEL~1.0\MYCLAS~1 HelloWorld
    Hope this helps.

  • How to set classpath for classes in war files

    Hi All,
    After deploying the WAR file I could access the JSP files but gives classnotfound exception when the information is expected from the java servlet.DO I need to set the classpath if yes how to do for the war file.
    thanks

    The web.xml,file structure and error is below let me know if more information is required.
    As you said weblogic is looking for the classes in lib directory inspite of having the classes in web-inf/classes directory.
    web-app>
    <servlet>
    <servlet-name>ControllerServlet</servlet-name>
    <servlet-class>com.test.site.pds.Controller</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ControllerServlet</servlet-name>
    <url-pattern>/controller</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    </web-app>
    File Structure:
    C:\test\PDSWebApp\WEB-INF\classes\com\test\site\pds\*.class
    PDSWebApp
         css
         html
         images
         javascript
         jsp
         WEB-INF
         classes
         com/test/site/pds/*.java
         lib
         servlets
    The error:
    javax.servlet.ServletException: [HTTP:101249][ServletContext(id=18129862,name=PdsApp,context-path=/PdsApp)]: Servlet class com.test.site.pds.Controller for servlet ControllerServlet could not be loaded because the requested class was not found in the classpath C:\bea\user_projects\domains\mydomain\myserver\.wlnotdelete\extract\myserver_PDSAPP_PdsApp\PdsApp.war;C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_PDSAPP_PdsApp\jarfiles\WEB-INF\lib\classes12.jar;C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_PDSAPP_PdsApp\jarfiles\WEB-INF\lib\commons-beanutils.jar;C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_PDSAPP_PdsApp\jarfiles\WEB-INF\lib\commons-collections-2.1.1.jar;C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_PDSAPP_PdsApp\jarfiles\WEB-INF\lib\commons-lang-2.0.jar;C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_PDSAPP_PdsApp\jarfiles\WEB-INF\lib\displaytag-1.0.jar;C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_PDSAPP_PdsApp\jarfiles\WEB-INF\lib\jstl.jar;C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_PDSAPP_PdsApp\jarfiles\WEB-INF\lib\standard.jar;C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_PDSAPP_PdsApp\jarfiles\_wl_cls_gen.jar;C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_PDSAPP_PdsApp.
    java.lang.ClassNotFoundException: com.test.site.pds.Controller.

  • Starting RMIRegistry in ksh, how to set classpath?

    Hi,
    I'm a newbie to Unix and have a question. Here's the situation:
    I'm
    using HP-UX version 11.0 with the latest complete JDK 1.1.7 avail
    for
    that platform. The shell is ksh. I have a classpath exported
    from my
    .profile file. I start the rmi registry with the command
    "$rmiregistry
    &". It starts alright but can NOT find my stub files!
    What am I missing? Does the child process I create inherit my
    environment settings? How am I or how is the rmi registry
    executable
    determine the classpath??
    Any help would be appreciated.
    Frank
    null

    Frank,
    Thanks for your help, but found my problem. I was using an
    environment variable that was lowercase, rmiregistry was looking
    for it as UPPERCASE!
    Thanks,
    Frank
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    Frank Zhang (guest) wrote:
    : Frank:
    : You could start rmiregistry in your server's constructor, if it
    : is an option.
    : Frank
    : Frank Garber (guest) wrote:
    : : Hi,
    : : I'm a newbie to Unix and have a question. Here's the
    : situation:
    : : I'm
    : : using HP-UX version 11.0 with the latest complete JDK 1.1.7
    : avail
    : : for
    : : that platform. The shell is ksh. I have a classpath
    exported
    : : from my
    : : .profile file. I start the rmi registry with the command
    : : "$rmiregistry
    : : &". It starts alright but can NOT find my stub files!
    : : What am I missing? Does the child process I create inherit
    my
    : : environment settings? How am I or how is the rmi registry
    : : executable
    : : determine the classpath??
    : : Any help would be appreciated.
    : : Frank
    null

  • How to set classpath to take classes in conf \ jboss.service.xml file

    Hi,
    I just want to put some classes which are in a package say 'mypack' in the lib folder . In the jboss.service.xml file the classpath is set to codebase="lib" archive=" * " > but this won't work for classes which are not in any of the jar files. how to do this?.. pls help me.
    Thanks in advance
    Sudheer

    Could you package your classes into a jar file?
    Fil

  • How to set CLASSPATH with makePropertiesObject in WLST

    In Weblogic 9.1 we are using Nodemanager to start the Admin Server in WLST using nmStart. We want to set some memory args for the Admin server and I was told by BEA that you'd use makePropertiesObject to this and pass this object to nmStart, that was fine. We also want to update the admin server classpath and were told makePropertiesObject could also be used for this.
    I'm doing
    arg = "Arguments=\" -client " + jvm_args + "\""
    prps = makePropertiesObject (arg)
    nmStart(targetserver, domain_home, props=prps)
    where jvm_args ="-Xms256m -Xmx512m -XX:MaxPermSize=128m -Djava.class.path=..."
    Also tried
    jvm_args = "-Xms256m -Xmx512m -XX:MaxPermSize=128m -cp ......",
    However, in both cases the Admin Server process is running with default "-Djava.class.path=...", plus a my "-cp myclasspath" or "-Djava.class.path=myclasspath", depending on which method I used. Am I doing something obviously wrong ? When the Admin Sever is started by NM using nmStart how would you set its classpath ? Should another command be used for starting the Admin Server instead ?

    Hello,
    http://edocs.bea.com/wls/docs91/server_start/nodemgr.html#1083353
    This link lists the list of properties that can be specified to start.
    Normally, for managed servers, the admin server collects the values for
    these properties from various config mbeans and sends them to the
    nodmanager. For starting the admin server itself, a properties object
    can be created and the values explicitly populated with desired values
    and passed to nmStart.
    Classpath is one of the properties to send to the nodemanager while
    requesting server start.
    HTH,
    -satya
    BEA Blog:
    http://dev2dev.bea.com/blog/sghattu/
    Get Involved in CodeShare:
    https://wls-console-extensions.projects.dev2dev.bea.com/
    https://wlnav.projects.dev2dev.bea.com/
    https://eclipse-wlst.projects.dev2dev.bea.com/
    https://wlst.projects.dev2dev.bea.com/

  • How to Set Classpath in servlet

    Hi Friends,
    I want to call class with using reflection in my "servlet" , since class which I am calling is stand alone java program and it is not in web application. It is stored else where on server in Offline process. So how can I call the method of this class from my Servlet.
    Reply is appreciated

    any server when it starts up, loads the classes and lib from specifed paths in a config file.
    e.g., jrun has a jvm.config file where you can give the classpath entries for third party classes/jars.
    also for the specific classpath entry for particular war-file, u can specify it in the manifest-file of the war.

  • How to set classpath to EJB and Servlets

    Hi all,
    How can I add a classpath to EJB and Servlets in Weblogic 6.1, so that that classpath
    can be achieved by both EJB jar and war file? I have deployed a .ear file having
    the jar and war files. Now the EJBs inside the jar file are not reaching the class
    files of the war file and the class files in the war file are not reaching to
    the EJBs. Please let me know at the earliest.
    Atanu

    Hi.
    You might try looking at the petstore example which combines webapps (war files) with
    ejbs in an ear file to see how to do this. It may be a simple config problem.
    Regards,
    Michael
    Atanu Dey wrote:
    Hi all,
    How can I add a classpath to EJB and Servlets in Weblogic 6.1, so that that classpath
    can be achieved by both EJB jar and war file? I have deployed a .ear file having
    the jar and war files. Now the EJBs inside the jar file are not reaching the class
    files of the war file and the class files in the war file are not reaching to
    the EJBs. Please let me know at the earliest.
    Atanu--
    Michael Young
    Developer Relations Engineer
    BEA Support

  • How to set classpath

    I would like to know the proper syntax for setting multiple baeans for classpath for iWS6. Can something like this work:
    D:/mybeans/beana.jar;D:/mybeans/beanb.jar;D:/mybeans/beanc.jar
    thanks

    Hi,
    Make sure that you append the following syntax in your jvm.classpath setting in jvm12.conf. And restart the server to make the changes effective. I hope this helps.
    <b>D:/mybeans/beana.jar:D:/mybeans/beanb.jar:D:/mybea ns/beanc.jar</b>
    Regards,
    Dakshin.
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support.

Maybe you are looking for

  • Vendor Master data change

    Hi sap guru's I want to change bank routing number, if i give one key message coming like " Bank key is invalid" at the same time when i came some another key then one box is appearing for filling Bank address Bank key Bank country like that. why the

  • Inserting multiple data in a single textfield

    is it possible?? something like "select name from table where department_id = 2" and put it in a textfield(or any prefered item) and the output would be like "sanchez , goodyear , hillman" <-- data shud be also separated by comma.

  • Error target not found base-level failed to install the packages

    Im trying to install arch on my Virtualbox VM and its just returning: error target not found base-level failed to install the packages to new root What do I do? I have selected the right mirrors, pinging google, my own VPS's and a few other servers a

  • Is possible to know the age of an Ipod?

    i'm thinking to buy a second hand Ipod nano... is possible to know "when it was born". (when i went to the apple store, the attendant verified by the serial number if my ipod was covered by the warranty). can i make the same on internet? or in anothe

  • Payroll Reconciliation Report

    Hi Experts,                  Can you please resolve this: 1) Payroll was run for pay-period 12.2008 (2008.12.01 - 2008.12.31)     FI Posting completed and Net pay paid out via check too. 2) This payroll of pp 12.2008 was reversed on 9thJan 2009. thro