Java versus javac classpath

hi everyone:
this is a bit embarassing, as I have been using java for some time, but I recently came across a classpath conceptual difficulty.
My understanding was that 'javac' uses classpath to find the path to any classes referenced in a target for compilation. However, I couldn't come up with any concrete rationale for using an additional classpath for 'java', the JVM command, when developing your own applications (I can see its importance for third party classes).
Doesn't javac encode the classpath passed to it in the compiled class file itself? (I figured this because even if I do not specify a classpath to the 'java', the program still executes fine). If this is true, then the only way I see the 'java' classpath being useful is if you were to change around the location of the class files after compilation.
Any thoughts would be greatly appreciated.

Btw, there is no distiction between java and javac
classpaths. They're both the classpath.only difference i see there could be, is that, for
javac you tell the path to your .java file that
need's to be compiled, and for java you tell the name
of class whose main() method it should run (or you
tell which .jar file to execute)That's not relevant here. Classpath is used the same way for both of them. Classpath has nothing to do with finding a .java file to compile.
The only difference, I think, is that I think by default, the directory holding the package root of any .java file given as an arg to javac is implicitly added to the classpath. I'm not sure about that though.
>
so in some cases you would need to include "." in
your classpath for execution, but would not need to
include it for compilation.
just my 2 cents

Similar Messages

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

  • Javac classpath problem

    I get this error when trying to compile a simple program:
    # javac -classpath .;/mnt/bdrive/MyData.class Test.java
    javac: no source files
    Usage: javac <options> <source files>
    where possible options include:
    ***snip***
    bash: /mnt/bdrive/MyData.class: Permission denied
    It seems to be a problem with specifying more than one thing for the classpath. If I remove the ".;", it works. (I don't need the . in the classpath but I should be able to specify it)

    probably :)
    I originally had just the path and was trying it different ways. If I use just the path instead of the permission denied message, I get this:
    bash: /mnt/bdrive/: is a directory

  • Javac -classpath / -sourcepath does not work ?

    when i call javac in the current directory (where the java source files within subdirectories for package names) the compilation works. but when i go one directory up and want to use the -classpath or the -sourcepath options, i just get errors:
    D:\TEMP\Java>javac -classpath ./examples test/HelloWorld.java
    error: cannot read: test/HelloWorld.java
    1 error
    D:\TEMP\Java>javac -sourcepath ./examples test/HelloWorld.java
    error: cannot read: test/HelloWorld.java
    1 errorRunning javac in the directory D:\TEMP\Java\examples works ...

    nope, the doc for javac clearly says:
    "If the -sourcepath option is not specified, the user
    class path is searched for source files as well as
    class files. "
    (see
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/ja
    ac.html#options)Yes but this is in reference to dependent classes, as the page you referenced explains.
    The basic format of javac isjavac source_fileIf the source file needs other user classes, then the classpath is searched for either .class files or .java files.

  • Fatal Error: Unable to find package java.lang in classpath or bootclasspath

    Hi,
    I am trying to build my project using ant tool, but it is erroring out as follows:
    Buildfile: D:\My Software\eclipse\workspace\ShoppingCart\build.xmlprepare:compile:    [javac] Compiling 2 source files to D:\My Software\eclipse\workspace\ShoppingCart\build\WEB-INF\classes    [javac] Fatal Error: Unable to find package java.lang in classpath or bootclasspath BUILD FAILEDD:\My Software\eclipse\workspace\ShoppingCart\build.xml:46: Compile failed; see the compiler error output for details. Total time: 1 second  Please find the build.xml:
    <project name="Shopping Cart" default="compile" basedir=".">      <property name="app.name" value="ShoppingCart" />     <property name="app.path" value="/${app.name}" />     <property name="app.version" value="0.1-dev" />     <property name="build.home" value="${basedir}/build" />     <property name="catalina.home" value="C:\Program Files\Apache Software Foundation\Tomcat 5.0" />     <property name="dist.home" value="${basedir}/bin" />     <!--<property name="docs.home" value="${basedir}/docs" /> -->     <property name="manager.url" value="http://localhost:8080/manager" />     <property name="src.home" value="${basedir}/src" />     <property name="web.home" value="${basedir}/web" />     <property name="lib.home" value="${basedir}/WEB-INF/lib" />      <target name="all" depends="clean,compile" description="Clean build and dist directories, then compile" />      <target name="clean" description="Delete old build and dist directories">          <delete dir="${build.home}" />          <delete dir="${dist.home}" />     </target>      <target name="prepare">          <!-- Create build directories as needed -->          <mkdir dir="${build.home}" />          <mkdir dir="${build.home}/WEB-INF" />          <mkdir dir="${build.home}/WEB-INF/classes" />           <!-- Copy static content of this web application -->          <copy todir="${build.home}/web">               <fileset dir="${web.home}" />          </copy>           <!-- Copy external dependencies as required -->          <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->          <mkdir dir="${build.home}/WEB-INF/lib" />          <copy todir="${build.home}/WEB-INF/lib">               <fileset dir="${lib.home}" />          </copy>          <!-- Copy static files from external dependencies as needed -->          <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->     </target>      <target name="compile" depends="prepare" description="Compile Java sources">          <!-- Compile Java classes as necessary -->          <mkdir dir="${build.home}/WEB-INF/classes" />          <javac srcdir="${src.home}" destdir="${build.home}/WEB-INF/classes" bootclasspath="${lib.home}" source="1.5"/>           <!-- Copy application resources -->          <copy todir="${build.home}/WEB-INF/classes">               <fileset dir="${src.home}" excludes="**/*.java" />          </copy>     </target>      <target name="dist" depends="compile" description="Create binary distribution">          <!-- Copy documentation subdirectories           <mkdir dir="${dist.home}/docs" />          <copy todir="${dist.home}/docs">               <fileset dir="${docs.home}" />          </copy> -->          <!-- Create application JAR file -->          <jar jarfile="${dist.home}/${app.name}-${app.version}.war" basedir="${build.home}" />          <!-- Copy additional files to ${dist.home} as necessary -->     </target> </project>  thnx,
    Rakesh

    Sounds like your JBuilder environment is screwed up; see what the classpath and bootclasspath are set to, and correct the error. (This is a question that belongs on a JBuilder website.)

  • Using Runtime exec() to open and close process like java or javac

    Hi, I m a student who is learning IT and is wondering if
    Runtime exec() can run and stop commands like java and javac?
    Can someone post the code to do so here?Thank you

    Well, Here is my complete code:
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    class StreamGobbler extends Thread
    InputStream is;
    String type;
    StreamGobbler(InputStream is, String type)
    this.is = is;
    this.type = type;
    public void run()
    try
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line=null;
    while ( (line = br.readLine()) != null)
    System.out.println(type + ">" + line);
    } catch (IOException ioe)
    ioe.printStackTrace();
    class Program implements Runnable
         Process proc;
    String args[];
         String[] cmd = new String[4];
         boolean isGone=false;
         public Program(String args[])
              this.args=args;
         public void run()
              if (isGone==true)
                   try
                        Runtime.getRuntime().exec(cmd).destroy();
                   catch(IOException e)
                        System.out.println("Error: "+e.toString());
                   System.out.println("User abort");
         public void start(String args[])
              if (args.length < 1)
    System.out.println("USAGE: java GoodWindowsExec <cmd>");
    System.exit(1);
    try
    String osName = System.getProperty("os.name" );
    if( osName.equals( "Windows NT" ) )
    cmd[0] = "cmd.exe" ;
    cmd[1] = "/C" ;
    cmd[3] = args[0];
    else if( osName.equals( "Windows 95" ) ||osName.equals( "Windows 98" ))
    cmd[0] = "command.com" ;
    cmd[1] = "/C" ;
    cmd[2] = args[0];
                        cmd[3]=args[1];
    Runtime rt = Runtime.getRuntime();
    // System.out.println("Execing " + cmd[0] + " " + cmd[1]
    // + " " + cmd[2]+" "+args[1]);                                    
    proc = rt.exec(cmd);
    // any error message?
    StreamGobbler errorGobbler = new
    StreamGobbler(proc.getErrorStream(), "ERROR");
    // any output?
    StreamGobbler outputGobbler = new
    StreamGobbler(proc.getInputStream(), "OUTPUT");
    // kick them off
    errorGobbler.start();
    outputGobbler.start();
    // any error???
    // int exitVal = proc.waitFor();
    //System.out.println("ExitValue: " + exitVal);
    } catch (Throwable t)
    t.printStackTrace();
         public void destroy()
              isGone=true;
    class test1 implements ActionListener
         String s[]={"c:\\jdk1.3\\bin\\java.exe","ContactProcessor1"};
         GUI g=new GUI();
              Program p=new Program(s);
         public test1()
              //didnt work
              g.getStart().addActionListener(this);
              g.getStop().addActionListener(this);
              g.show();
         public void actionPerformed(ActionEvent e)
              if (e.getSource()==g.getStart())
                   p.start(s);
                   p.run();
              if (e.getSource()==g.getStop())
                   p.destroy();
                   p.run();
         public static void main(String args[])
              test1 t = new test1();
    class GUI extends JFrame
         JButton start;
         JButton stop;
         public GUI()
              super();
              getContentPane().setLayout(new FlowLayout());
              start=new JButton("start");
              stop=new JButton("stop");
              getContentPane().add(start);
              getContentPane().add(stop);
              setSize(100,100);
         public JButton getStart()
              return start;
         public JButton getStop()
              return stop;
    }

  • Java runtime parameter (-classpath)

    Hi,
    Does anyone know how to programmatically set the java-runtime-parameters?
    I need to set them to: "-classpath c:\jar\test.jar"
    My goal is to access test.jar thru the ActiveX Bridge, and test.jar is not inside the "applet" folder (nor the "ext" folder). Note: ActiveX bridge uses the java plug-in which has a default path to the applet folder, I need to programmatically set a java-runtime-parameter "-classpath" to c:\jar\test.jar...
    (I know that you can set the java-runtime-parameters thru control panel - java plug-in, but this will not work for what I am doing, I need to do it on the fly programmatically).
    Gene.

    People I have tried this after trying all that I could fine on the internet,
    What did not work is as follows:
    1) Setting "-Xmx512m", where "512" should be replaced by 3/4 of the system
    physical memory size.
    2) Also enable "<APPLET> tag support" for Internet Explorer. Apply settings.
    This worked for some.
    3) Also tried uncheking the box for <APPLET> but that was not to work.
    "What --WORKED-- for me at last was:"
    1. Uninstall Internet Explorer 7.
    2. Restart System.
    3. Uninstall Java 1,5 with Update 9(that was installed)
    4. Install Java version 1.5 with upgrade 5 from the link:
    http://www.tucows.com/preview/194327
    5. Then go to Start, Run, type
    iexplore
    and hit Enter.
    Try the sites now.. It works:)
    6. Then disable update for Java in Control panel. (Also do not update IE or
    JAVA after that)
    Hope this help ya all!!!

  • Unbiased Java versus C# comparison

    I found this feature-by-feature, unbiased and informatve Java versus C# comparison, and thought that perhaps a few of you may be interested in it:
    http://www.prism.gatech.edu/~gte855q/CsharpVsJava.html
    Every comparison that I've read up to this point has either been written by Java or MS evangelists, and this one is definitely refreshing break from the typical essay.

    Agreed. However, the decision may generalize even further in many cases, and become "Industry supported platform of technologies (Java) or Microsoft proprietarization (.NET)." I still have not seen an unbiased comparison of the platforms, rather than languages, that goes as in depth as this one... if anybody else has, I'd love to see a link to it?
    For those that will be using both technologies, such as myself, this paper helps bridge the language gaps between the two and make transitioning simple. It's more helpful at the post-decision (to use .NET) level, rather than pre-decision.

  • Javac -classpath . ./baza/program.java

    Error: Super class "<gen>" is not accessible: it is not in the same package
    and not public. Please help, what should I do?

    Error: Super class "<gen>" is not accessible: it is
    not in the same package
    and not public. Please help, what should I do?Why is the error message not clear?
    You have code that looks like the following...
       package com.x.y;
       class gen
       package com.zzzzz.aaaaaa;
       class child extends com.x.y.gen
    In the above 'gen' is not 'public' so it can't be accessed in package 'com.zzzzz.aaaaaa'

  • BankingAppServlet.java crashes javac?!

    When I try to compile BankingAppServlet.java in the banking tutorial, I get this:
    root@localhost dev]# echo $CLASSPATH
    /bea/wlserver6.1/samples/examples/tutorials/banking/deploy/ejb:/usr/java/jdk1.3.1_02/lib/tools.jar:/bea/wlserver6.1/lib/weblogic.jar:/usr/java/j2sdkee1.3/lib/j2ee.jar
    [root@localhost dev]# javac -d ../deploy/web/WEB-INF/classes web/BankAppServlet.java
    line 0: expecting an identifier, found '('
    at java.lang.Throwable.fillInStackTrace(Throwable.java:native)
    at java.lang.Throwable.<init>(Throwable.java:38)
    at java.lang.Exception.<init>(Exception.java:24)
    at antlr.ANTLRException.<init>(ANTLRException.java:16)
    at antlr.RecognitionException.<init>(RecognitionException.java:24)
    at antlr.MismatchedTokenException.<init>(MismatchedTokenException.java:107)
    at antlr.Parser.match(Parser.java:177)
    at at.dms.kjc.KjcParser.jStatement(KjcParser.java:1761)
    at at.dms.kjc.KjcParser.jCompoundStatement(KjcParser.java:1308)
    at at.dms.kjc.KjcParser.jTryBlock(KjcParser.java:2145)
    at at.dms.kjc.KjcParser.jStatement(KjcParser.java:1720)
    at at.dms.kjc.KjcParser.jCompoundStatement(KjcParser.java:1308)
    at at.dms.kjc.KjcParser.jMember(KjcParser.java:1105)
    at at.dms.kjc.KjcParser.jClassBlock(KjcParser.java:926)
    at at.dms.kjc.KjcParser.jClassDefinition(KjcParser.java:376)
    at at.dms.kjc.KjcParser.jTypeDefinition(KjcParser.java:246)
    at at.dms.kjc.KjcParser.jCompilationUnit(KjcParser.java:108)
    at at.dms.kjc.Main.parseFile(Main.java:285)
    at at.dms.kjc.Main.run(Main.java:88)
    at at.dms.kjc.Main.compile(Main.java:255)
    at at.dms.kjc.Main.main(Main.java:246)
    The files I'm compiling come from http://e-docs.bea.com/wls/docs61//examples/banking.zip:
    [root@localhost dev]# pwd
    /bea/wlserver6.1/samples/examples/tutorials/banking/dev
    [root@localhost dev]# ls -al ejb/*.java
    -rw-rw-rw- 1 root root 7790 May 20 17:54 ejb/AccountBean.java
    -rw-rw-rw- 1 root root 4666 May 20 14:19 ejb/AccountHome.java
    -rw-rw-rw- 1 root root 2186 May 20 13:39 ejb/Account.java
    -rw-rw-rw- 1 root root 438 May 20 14:21 ejb/BankConstants.java
    -rw-rw-rw- 1 root root 11373 May 20 14:22 ejb/Client.java
    -rw-rw-rw- 1 root root 813 May 20 13:39 ejb/ProcessingErrorException.java
    -rw-rw-rw- 1 root root 2057 May 20 14:21 ejb/RMILoggerImpl.java
    -rw-rw-rw- 1 root root 430 May 20 14:20 ejb/RMILogger.java
    Similar files are part of the WebLogic installation:
    [root@localhost dev]# cd ../../migration/banking
    root@localhost banking]# pwd
    /bea/wlserver6.1/samples/examples/tutorials/migration/banking
    [root@localhost banking]# ls -al *.java
    -rw-r--r-- 1 root root 7529 May 19 10:37 AccountBean.java
    -rw-r--r-- 1 root root 4556 May 19 10:37 AccountHome.java
    -rw-r--r-- 1 root root 2120 May 19 10:37 Account.java
    -rw-r--r-- 1 root root 8260 May 19 10:37 BankAppServlet.java
    -rw-r--r-- 1 root root 418 May 19 10:37 BankConstants.java
    -rw-r--r-- 1 root root 11011 May 19 10:37 Client.java
    -rw-r--r-- 1 root root 785 May 19 10:37 ProcessingErrorException.java
    -rw-r--r-- 1 root root 1986 May 19 10:37 RMILoggerImpl.java
    -rw-r--r-- 1 root root 413 May 19 10:37 RMILogger.java
    I commented out the package specification in the first set:
    // package examples.tutorials.migration.banking;
    since it appears to reflect the organization of the second set; class files are consequently
    compiled into /bea/wlserver6.1/samples/examples/tutorials/banking/deploy:
    root@localhost ejb]# pwd
    /bea/wlserver6.1/samples/examples/tutorials/banking/deploy/ejb
    [root@localhost ejb]# ls -al
    total 48 (hmm?..)
    drwxrwxrwx 3 root root 4096 May 20 17:53 .
    drwxrwxrwx 5 root root 4096 Nov 29 15:25 ..
    -rw-r--r-- 1 root root 3812 May 20 17:55 AccountBean.class
    -rw-r--r-- 1 root root 350 May 20 17:55 Account.class
    -rw-r--r-- 1 root root 567 May 20 17:55 AccountHome.class
    -rw-r--r-- 1 root root 428 May 20 17:55 BankConstants.class
    -rw-r--r-- 1 root root 7096 May 20 17:55 Client.class
    drwxrwxrwx 2 root root 4096 Dec 4 14:11 META-INF
    -rw-r--r-- 1 root root 303 May 20 17:55 ProcessingErrorException.class
    -rw-r--r-- 1 root root 221 May 20 17:55 RMILogger.class
    -rw-r--r-- 1 root root 1366 May 20 17:55 RMILoggerImpl.class
    What the heck?
    And I just thought I'd mention that "samples/examples/tutorials" seems a bit redundant...
    and it'd be nice to have a preview function here.

    When I try to compile BankingAppServlet.java in the banking tutorial, I get this:
    root@localhost dev]# echo $CLASSPATH
    /bea/wlserver6.1/samples/examples/tutorials/banking/deploy/ejb:/usr/java/jdk1.3.1_02/lib/tools.jar:/bea/wlserver6.1/lib/weblogic.jar:/usr/java/j2sdkee1.3/lib/j2ee.jar
    [root@localhost dev]# javac -d ../deploy/web/WEB-INF/classes web/BankAppServlet.java
    line 0: expecting an identifier, found '(' at
    java.lang.Throwable.fillInStackTrace(Throwable.java:native) at
    java.lang.Throwable.<init>(Throwable.java:38) at
    java.lang.Exception.<init>(Exception.java:24) at
    antlr.ANTLRException.<init>(ANTLRException.java:16) at
    antlr.RecognitionException.<init>(RecognitionException.java:24) at
    antlr.MismatchedTokenException.<init>(MismatchedTokenException.java:107) at
    antlr.Parser.match(Parser.java:177) at
    at.dms.kjc.KjcParser.jStatement(KjcParser.java:1761) at
    at.dms.kjc.KjcParser.jCompoundStatement(KjcParser.java:1308) at
    at.dms.kjc.KjcParser.jTryBlock(KjcParser.java:2145) at
    at.dms.kjc.KjcParser.jStatement(KjcParser.java:1720) at
    at.dms.kjc.KjcParser.jCompoundStatement(KjcParser.java:1308) at
    at.dms.kjc.KjcParser.jMember(KjcParser.java:1105) at
    at.dms.kjc.KjcParser.jClassBlock(KjcParser.java:926) at
    at.dms.kjc.KjcParser.jClassDefinition(KjcParser.java:376) at
    at.dms.kjc.KjcParser.jTypeDefinition(KjcParser.java:246) at
    at.dms.kjc.KjcParser.jCompilationUnit(KjcParser.java:108) at
    at.dms.kjc.Main.parseFile(Main.java:285) at
    at.dms.kjc.Main.run(Main.java:88) at
    at.dms.kjc.Main.compile(Main.java:255) at
    at.dms.kjc.Main.main(Main.java:246)
    The files I'm compiling come from http://e-docs.bea.com/wls/docs61//examples/banking.zip:
    [root@localhost dev]# pwd
    /bea/wlserver6.1/samples/examples/tutorials/banking/dev
    [root@localhost dev]# ls -al ejb/*.java
    -rw-rw-rw- 1 root root 7790 May 20 17:54 ejb/AccountBean.java
    -rw-rw-rw- 1 root root 4666 May 20 14:19 ejb/AccountHome.java
    -rw-rw-rw- 1 root root 2186 May 20 13:39 ejb/Account.java
    -rw-rw-rw- 1 root root 438 May 20 14:21 ejb/BankConstants.java
    -rw-rw-rw- 1 root root 11373 May 20 14:22 ejb/Client.java
    -rw-rw-rw- 1 root root 813 May 20 13:39 ejb/ProcessingErrorException.java
    -rw-rw-rw- 1 root root 2057 May 20 14:21 ejb/RMILoggerImpl.java
    -rw-rw-rw- 1 root root 430 May 20 14:20 ejb/RMILogger.java
    Similar files are part of the WebLogic installation:
    [root@localhost dev]# cd ../../migration/banking
    [root@localhost banking]# pwd
    /bea/wlserver6.1/samples/examples/tutorials/migration/banking
    [root@localhost banking]# ls -al *.java
    -rw-r--r-- 1 root root 7529 May 19 10:37 AccountBean.java
    -rw-r--r-- 1 root root 4556 May 19 10:37 AccountHome.java
    -rw-r--r-- 1 root root 2120 May 19 10:37 Account.java
    -rw-r--r-- 1 root root 8260 May 19 10:37 BankAppServlet.java
    -rw-r--r-- 1 root root 418 May 19 10:37 BankConstants.java
    -rw-r--r-- 1 root root 11011 May 19 10:37 Client.java
    -rw-r--r-- 1 root root 785 May 19 10:37 ProcessingErrorException.java
    -rw-r--r-- 1 root root 1986 May 19 10:37 RMILoggerImpl.java
    -rw-r--r-- 1 root root 413 May 19 10:37 RMILogger.java
    I commented out the package specification in the first set:
    // package examples.tutorials.migration.banking;
    since it appears to reflect the organization of the second set; class files are consequently
    compiled into /bea/wlserver6.1/samples/examples/tutorials/banking/deploy:
    root@localhost ejb]# pwd
    /bea/wlserver6.1/samples/examples/tutorials/banking/deploy/ejb
    [root@localhost ejb]# ls -al
    total 48 (hmm?..)
    drwxrwxrwx 3 root root 4096 May 20 17:53 .
    drwxrwxrwx 5 root root 4096 Nov 29 15:25 ..
    -rw-r--r-- 1 root root 3812 May 20 17:55 AccountBean.class
    -rw-r--r-- 1 root root 350 May 20 17:55 Account.class
    -rw-r--r-- 1 root root 567 May 20 17:55 AccountHome.class
    -rw-r--r-- 1 root root 428 May 20 17:55 BankConstants.class
    -rw-r--r-- 1 root root 7096 May 20 17:55 Client.class
    drwxrwxrwx 2 root root 4096 Dec 4 14:11 META-INF
    -rw-r--r-- 1 root root 303 May 20 17:55 ProcessingErrorException.class
    -rw-r--r-- 1 root root 221 May 20 17:55 RMILogger.class
    -rw-r--r-- 1 root root 1366 May 20 17:55 RMILoggerImpl.class
    What the heck?
    And I just thought I'd mention that "samples/examples/tutorials" seems a bit redundant...
    and it'd be nice to have a preview function here.

  • Error during java.exe, javac.exe,etc... execution

    Hi,
    I recently installed JSK1.2.1 on a PC with windows 2000.
    I correctly configured the PATH and CLASSPATH.
    When i compile or try to run java.exe, the system returns the following error in a window:
    "javac.exe has generated errors and will be closed by windows. You will need to restart he program.
    An error log is being created."
    The execution in the dos window stops as if nothing has happenned but the compilation doesn't work.
    What can be the problem?

    Does anyone have an answer to this problem. I am experiencing the same problem trying to use jdk1.1.6 (I know it's old but the contract I'm working on is forcing me to use it). I have done everything possible with the PATH and CLASSPATH. Still, nothing works.

  • Java.lang.ClassNotFoundException -- CLASSPATH

    On my Linux machine, when I create a simple java file in the current directory, compile it, and run it, it works fine. Here are the steps that I take:
    javac simple.java
    java simple
    When I do the same on my Windows machine, I "get java.lang.ClassNotFoundException : simple" when I do java simple. I don't understand, both src and binary files are in the same folder. How do I fix it?

    aurir_ wrote:
    I noticed that I get this error when I set my CLASSPATH=c:\Sun\SDK\jdk\bin.
    That is a folder where I have JavaEE installed.
    You do not need that Classpath setting unless you plan to put your classes into the jdk\bin directory, which is a horrible idea.
    When I clear that entry from the CLASSPATH or do this: "java -cp . Test" it probably finds some other jdk and uses it, and it works fine.It is the recommendation to use -cp to set the classpath instead of the system environmental variable. But that does not change the "jdk" being used. Here's two links you might find useful.
    [http://www.kevinboone.com/classpath.html]
    [http://java.sun.com/javase/6/docs/technotes/tools/findingclasses.html]
    Edited by: atmguy on Aug 28, 2008 9:34 AM

  • Can't run java or javac from dos prompt

    I just installed j2sdk1.4.1 on win98SE. I have a problem where I can't seem to be able to compile or run an application from the dos prompt. I can do both in Visualage for Java or in JGrasp but not at the DOS Prompt. I have set the PATH statement to PATH=c:\j2dsk1.4.1\bin and the classpath=c:\j2sdk1.4.1\lib. The following is a typical error message:
    javac RunApplet.java
    RunApplet.java:8: cannot resolve symbol
    symbol : class MyApplet
    location: class RunApplet
    MyApplet myApplet = new MyApplet():
    RunApplet..java:8: cannot resolve symbol
    symbol : class MyApplet
    location: class RunApplet
    MyApplet myApplet = new MyApplet()
    2 errors
    java RunApplet.class
    Exception in thread "main" java.lang.NoClassDefFoundError: RunApplet/class
    It seems like the system can't locate the class files?
    Also is there away to use more than the standard 8.3 charecter set in the DOS prompt window?
    TIA

    javac RunApplet.java
    RunApplet.java:8: cannot resolve symbol
    symbol : class MyApplet
    location: class RunApplet
    MyApplet myApplet = new MyApplet():
    RunApplet..java:8: cannot resolve symbol
    symbol : class MyApplet
    location: class RunApplet
    MyApplet myApplet = new MyApplet()
    2 errorsMost likely a Classpath problem. I suggest changing your classpath to:
    classpath=.;c:\j2sdk1.4.1\lib
    java RunApplet.class
    Exception in thread "main"
    java.lang.NoClassDefFoundError: RunApplet/class2 problems. As ChuckBing says, the command needs to be "java RunApplet" with no .class. The argument to the java command is the class name, not a file name. The second problem - if you do not have a successful compilation, there won't be any .class file to run.

  • Java and javac fullpath

    For a class I'm in we're creating a program that lets you compile a java program. It uses the full path name. ie
    javac <pathname>/file.java
    This works but when I change it to run it
    java <pathname>/file
    It doesn't like it and I get a Exception in thread "main" java.lang.NoClassDefFoundError:. I know it exists because when I remove the pathname it works and I know I'm not making a mistake like putting .java or .class at the end.
    Is there some option that would allow the java command to accept full path name (I tried this on my personal computer, which is linux, and connected to my school's unix system with both the same result). Or is there some way to get the program to point to the right directory so all I have to do is put java file. If I figure out a solution to the problem I'll type it here but I'm not sure if I will.
    Thanks

    Either
    1) Make sure that there is no permanent CLASSPATH environment variable set and execute the java command from the directory that contains the .class file, or
    2) Use the command java -cp . <yourClass> from the directory that contains your .class file.
    (be sure to type the period and spaces), or
    3) Set a permanent CLASSPATH
    Read these topics to understand classpath and prevent further problems of this kind:
    Setting the Classpath, and
    How Classes are Found
    on http://java.sun.com/j2se/1.4.2/docs/tooldocs/tools.html

  • Sar ignored in javac classpath

    We are in the process of moving from Java 1.4 (1.4.2_02 on Linux) to Java 5 (1.5.0_12) and since we deploy to a JBoss environment we generate .sar files. In some cases those .sar files are used in the classpath when compiling other packages. Using the javac in Sun JDK on Linux version 1.5.0_12 the .sar files in the classpath are ignored. If I do a javac -verbose I can see that the .sar files are left out of the classpath even though they ar epresent on the command line. Does anyone know if this is a bug in the JDK or is intended behavior?

    Hi,
    are there any clues on this issue?
    I have the same problem while moving from 1.5.0_06 to 1.5.0_14.
    You can even reference very uncommon extentions (i.e. rename a *.jar to *.bug) in the 06 version. The newer version quietly ignores this reference and leaves you with a "cannot find symbol".

Maybe you are looking for

  • Mapping problems with custom characteristics in CCM

    Hello, We are on SRM5.0 CCM2.0 and I have created three custom characteristics with related OCI fields. These characteristics have been uploaded in the catalogs and mapped on schema level in supplier catalog and procurement catalog. When uplaoding it

  • Dynadock u3.0 latest drivers prevent Google chrome from connecting to internet

    I am using the Dynadock u3.0 on a Toshiba u845w-s400 and a 17R Dell. Both have Win 7, 64bit. When I initially let the windows find the drivers and figure things itself, Google Chrome worked just fine with Dynadock. The computers told me that I should

  • No sound in ffox/comcast, ok on desktop,msn/ie have downloaded 3.6 and flash 10.1...

    all working fine until a week or so ago. lost sound on comcast. Have ver 3.6 fore fox & flash player 10.1. Have only been in W7 for a month or so.

  • Crash issues/pl

    Hey there, Just got a 2011 brand new 27 incgh imac with full ram/ full processing speed. I am using after effects and premiere to edit a project. I am currently experiencing over the top crash issues/ slow rendering/ general reas issues when I attemp

  • JMS service on UCCX 10.5

    Hey. working with the JMS (Java Message Service) for live data reporting on UCCX 10.5. Does anybody know where to find documentation on this service (Can't fint the TeamName/Id on resources). Best regards Thomas Johannesen