Classpath for javac

I can compile files with the javac compiler only if I place the .java files in the bin directory where C:\j2sdk1.4.1_01\bin is the full path to the bin folder. How can I set the path so I can compile .java files from a different folder? I'm running Windows XP home edition.

Right. To invoke any program, it's either got to be in your path, or called directly
C:\java\bin\javac myClass.java
Log in as administrator.
Start > Settings > Control Panel > System > Advanced >
Environment Variables...
Under "System Variables"
Select "Path" and click Edit...
Append ";C:\j2sdk1.4.1_01\bin" to the list
Under "User Variables"
Select "New..."
Name: CLASSPATH
Value: .;C:\j2sdk1.4.1_01\bin

Similar Messages

  • Problem in setting path and classpath for java in RedHat linux 9

    Hi ,
    i am not able to set the PATH and CLASSPATH for j2sdk1.4.2_06
    I have tried with export PATH=$PATH:/usr/j2sdk1.4.2_06/bin
    and export CLASSPATH=$CLASSPATH:/usr/j2sdk1.4.2_06/lib
    in terminal
    but i want to configure it as permenant way for the jre and jdk
    and we should only type java or javac according to the requirement
    regards mihir...

    type those in .bashrc ... save and exit
    then at prompt, type 'source .bashrc'
    this is the permanent solution ...
    bhalo thakun

  • JDBC drivers for  postgres+classpath for windows

    I've written an application for university last year, that connects to a postgres database. It worked perfectly on the Debian, but I'm trying to run it on Windows 2000 now.
    I've downloaded the driver http://jdbc.postgresql.org/download/postgresql-8.0-311.jdbc3.jar but now what do I need to write in the "Class.forName(String name)" line , as I've put the jar in c:\ ?
    Other question while I'm typing : my other java applications run correctly althought no classpath variable exists in the system. How can I set it easily and how can I add the postgres drivers to it ? ( I know how to under Linux, not windows )

    You write Class.forName() using the name of the PostgreSQL driver class, just like you always do.
    As far as classpath goes, you set that the same way, too: using the -classpath option when you run java.exe.
    You shouldn't have a CLASSPATH variable in the system. One size does not fit all. You should know how to set it every time you compile and run using the -classpath option for javac.exe and java.exe. Read the javadocs for these tools.
    %

  • Path in Classpath for file SapMetamodelWebdynproContent.zip not found.

    How to get rid of these warnings?
                   [Warning]: Path in Classpath for file SapMetamodelWebdynproContent.zip not found.          
    Warning               [Warning]: Version for file SapMetamodelWebdynproContent.zip not found.          
    Warning               [Warning]: Versions of 'SapDictionaryTypeServices.jar' have different prefix.          
    Warning               [Warning]: Versions of 'SapDictionaryTypesRuntime.jar' have different prefix.     
    thanks in advance.

    Hi,
    This is a common problem when you import projects to NWDS. Do like this.
    1.Change to Navigator tab in NWDS and delete gen_wdp folder.
    2.Switch to Web Dynpro Explorer. Select the Project -> Right click-> Select properties -> in the wizard select Java Build Path -> Select Libraries tab -> You will find jar files with warnings
    3.Remove the jar and add the jar file with same name to the project one by one.
    4.For each jar file repeat step 3.
    5.Save the project
    Or
    removed the read-only property from all folders / files of the project and it solved my problem.
    Hope this helps!!
    Thanks & Regards
    Vijay K

  • Can I set classpath for OAS 10g?

    Hi,<br>
    <br>
    I have OAS on my workstation. Here are the details.<br>
    Server : Oracle Application Server 10g Release 3 <br>
    Version : 10.1.3.1.0 SOA4<br>
    Build : 061008.0900.00025<br>
    Platform : Windows XP - SP2<br>
    <br>
    I want to set an explicit classpath for complete OAS 10g as such and not to an individual oc4j application. Will I be able to do it?<br>
    I saw the System Properties after my server started.<br>
    It has a name-value pair as "java.class.path oc4j.jar".<br>
    So, I assume all my classpath settings (done thru Environment Variables from My Computer) are lost.?<br> I want to set it explicitly during the server startup itself. Can I do that?<br>
    I tried setting below in the opmn.xml <br>
    <process-set id="ASG" numprocs="1"><br>
         <module-data>          <br>                         <category id="start-parameters">     <br>               <data id="start-executable" value="C:\Oracle\product\10.1.3.1\OracleAS_1\jdk\bin\java"/>     <br>               <data id="start-args" value="-classpath C:\abc\properties\"/><br>
    I appended my properties folder after all the jar files present in that tag.<br>
    But its not loading any of my properties files.<br>
    <br>
    Can someone please help me out.<br>
    <br>
    Regards,<br>
    <br>
    Prashanth Babu.

    No, the iPad does not support multiple user accounts or preferences.

  • Wildcards in Classpath for JNI-Calls

    Is it possible to use wildcards in the classpath for KNI-Calls?
    I would like to use wildcard for jni-calls like for normal java-calls (java -classpath *.jar ...), but it is not working.
    JDK version is JDK 1.5.0 on Win32

    I would like to use wildcard for jni-calls like for normal
    java-calls (java -classpath *.jar ...), but it is not working.It would be the Shell, not Java doing the wildcard magic.
    You would have to do the globbing manually (or use any OS APIs, or 3rd party APIs).

  • How to set a classpath for referring classes

    I am using windows vista.....I had assigned classpath for Variable name and given address of class in variable type ..even then compiler does not recognize class path..........

    Thanks but it is not what I am really asking or I may didnt understand..
    The program is working ok through JCreator.. My problem is when I create an Installation file and then run it..
    the program is being created just fine but when it has to load the jdic then it blocks...
    This is something that must be done through variables right?
    If you ever used Install4J there are 2 columns where you declare variables..
    The first column is for Variable name and the second one is Variable Value..
    Sorry for buthering you with all this but this is the first time that I am dealing with jar files!
    Thanks again !

  • Starting tomcat server after setting classpath for java

    Sorry if this is nothing to do with java, it is more to do with starting tomcat server.
    Tomcat server has been working totally fine, but when I wanted to compile a java servlet I wrote for it, I needed to run a BAT file called gojava in MS-DOS that had the classpath for java to work properly. I then attempted to run Tomcat, but just got 'bad command'. As long as I don't start up java by setting the classpath, tomcat will work, but as I need java to write servlets and then to test them without restarting my PC each time, how do I get tomcat to work?
    Thanks
    Hannah

    Sounds like your batch file is changing your path, not your classpath. If you're getting "Bad command or filename" when attempting to run Tomcat, it can't find the executable. Check out the .bat file and see what it's doing (maybe even post it here for further clarity). If it's changing your path at all, make sure it includes a %path% to indicate that it simply wants to append items to the path, not overwrite it completely. Sorry if i'm way off base with my suggestions, but it sounds like that's where the problem's going to be, especially if rebooting resolves the problem.

  • Did u use jar files as classpath for appletviewer?

    as tested, jar files can not be used as classpath for appletviewer.
    java command is bellow
    appletviewer -J-classpath -Jc:\folder00\some.jar; -Jc:\folder01\any.jar; MyAppletClass
    the jar files (or classpaths) above do not work.
    I am not sure about my test, so i post my Q here for confirming it.
    thx

    appletviewer needs HTML code to run an Applet similar to how the Applet would be run from a browser. It does not have a Classpath option.
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/appletviewer.html

  • How to edit classpath for Domain Admin Server?

    Hi!
    Please, explain me how can I edit the classpath settings for Domain Admin Server of Sun java Application Server 8.2?
    I need to remove some classpath made by application installer in order to make the application work.
    It is said in documentation that I have to login to DAS first, but I can't see how can I make it through Server's web-interface :(

    Hi Rengasamy,
    If you want to set the CLASSPATH for all the managed Servers available in your Domain then "$DOMAIN_HOME/bin/setDomainEnv.sh" has an Environment variable with name "PRE_CLASSPATH" which is usually preferred for Patches or any JAR which we want to override from the WebLogic's existing classpath.
    But if you don;t want to override WebLogic's default CLASSPATH rather include your Jars in it then please add your JAR filenem including absolute path inside the "POST_CLASSPATH" variable inside "$DOMAIN_HOME/bin/setDomainEnv.sh"
    Apart from this another option will be putting your Jars inside the "$DOMAIN_HOME/lib" directory because The jars located in this directory will be picked up and added dynamically to the end of the server classpath at server startup. The jars will be ordered lexically in the classpath. The domain library directory is one mechanism that can be used for adding application libraries to the server classpath. It is possible to override the $DOMAIN_DIR/lib directory using the -Dweblogic.ext.dirs system property during startup. This property specifies a list of directories to pick up jars from and dynamically append to the end of the server classpath using java.io.File.pathSeparator as the delimiter between path entries.
    If you are starting your Managed Servers using NodeManager then please refer to the following Article.:
    Topic: Nodemanager Based ManagedServers setting MEM_ARGS
    http://middlewaremagic.com/weblogic/?p=780
    Regards
    Ravish Mody

  • Problem with NetWeaver 2004s EAR classpath for EJB

    I'm working with SAP NetWeaver Developer Studio Version: 7.0.09.
    I am trying to reference additional JARs from an EJB at runtime in the J2EE engine.  I have added the additional JARs to my EAR project (I have a separate EJB module project) through "Properties/Archive Build Info."  Then I have updated my EAR classpath by double-clicking on the application-j2ee-engine.xml and selecting Expert settings then specify a list of JAR's in the "Additional classpath" field as such: "log4j-1_2_8.jar, basis-test.jar,commons-beanutils-bean-collections.jar,commons-beanutils-core.jar,commons-beanutils.jar"  Then I build the Application Archive (the EAR) and deploy to the J2EE Engine.
    This is what my application-j2ee-engine.xml in my EAR looks like:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE application-j2ee-engine SYSTEM "application-j2ee-engine.dtd">
    <application-j2ee-engine>
         <classpath>log4j-1_2_8.jar, basis-test.jar,commons-beanutils-bean-collections.jar,commons-beanutils-core.jar,commons-beanutils.jar</classpath>
         <provider-name>sap.com</provider-name>
         <fail-over-enable
              mode="disable"/>
    </application-j2ee-engine>
    Then when I run my client code against the EJB (actually through a web service) I get an error in the log -- a "NoClassDefFoundError" on the log4j-1_2_8.jar file from a log4j call:
    EntryPoint: [/SalesOrderCalculation/Config1]. Implementation exception occurs. Please check implementation container(e.g. EJB) logs for additional information! com.sap.engine.services.ejb.exceptions.BaseEJBException: Exception in method calculateOrder.->java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    Why is my EJB not finding the jar file even though I add it to the EAR and specify the additional classpath for the EAR?
    Edited by: Juan Reyes on Jul 30, 2008 9:08 AM

    Removed the word URGENT from your subject.
    Please read the "Rules of Engagement"

  • How to add to classpath for OAF extensions in 11.5.10

    In 11.5.10, how do I add jar files to the default EBS classpath for new custom classes that are used in OAF extensions? Is there a directory which I can drop them in where they will get automatically appended to the classpath? Or is there a configuration file which needs to get updated with the new jar/library dependencies?
    I tried dropping them in $JAVA_TOP, but that only seems to pick up new classes, not complete jar files. However, I need to add several jar files as well (such as log4j). Ideally I would like to be able to do this without manually changing any of the config files.
    Thanks,
    Ed

    Keeping your concern in mind, the standard way of putting customization in OAF which is patch safe is to
    1. create a custom top like xxx_top
    2. prefix the standard page package which you are extending with xxx to separate it from standard seeded ones.
    3. Keep all your custom files on the xxx_top which is registered with the system.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • 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

  • 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.

  • Classpath for java and javac

    Hi,
    I'm a bit confused as to when include the "current" path to java/javac's "-classpath". For instance, if the project has the following structure:
    test
      |___foo (package "foo")
             |___B.java (extends foo.A)
             |___A.javaand the "current" directory is at "test/", then a simple "javac foo/B.java" or "java foo.B" works. However, if the structure of the project is altered to the following:
    test
      |___foo  (package "foo")
      |      |___B.java (extends foo.A and imports boo.C)
      |      |___A.java
      |
      |___myapp (just a directory)
              |____boo (package "boo")
                    |____C.javathen in order to compile or run foo.B when the current directory is at "test/", I have to explicitly specify the "current" directory (or "."), i.e.
    javac -classpath myapp/:. foo/B.java or java -cp myapp/:. foo.B
    Why is it that in the first example, the current directory need not to be specified (".") but in the second example, it must? Is it because as soon as "-classpath/-cp" option is included in the command line, java ignores the default current path ("./")?
    Sincerely,

    If nothing is specified via -cp and no CLASSPATH is set, then the default classpath contains one entry, which is the current directory (a.k.a the classpath is ".").
    If you set the classpath, then the classpath is exactly what you set it to and doesn't include any default.
    That's the only reasonable way to model such things, because if you included the current directory in all cases, then that would produce many unexpected side effects.

Maybe you are looking for