Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #10332

Re: Java classpath question and how to run a program from command line?

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Java classpath question and how to run a program from command line?
Date 2011-11-29 12:08 -0800
Organization http://groups.google.com
Message-ID <32418883.575.1322597293001.JavaMail.geo-discussion-forums@preu18> (permalink)
References <85f06dad-9e66-42ef-a232-d98c72832318@cc2g2000vbb.googlegroups.com> <ed80ba1f-864b-4fda-b619-abcd90f6ce2c@gl2g2000vbb.googlegroups.com> <bb1769d4-8638-4f3c-9778-0f11b0b4956b@m7g2000vbc.googlegroups.com> <5431520.470.1322581431774.JavaMail.geo-discussion-forums@prij11> <89680c27-0ff8-4c84-b390-6b54ceb5e4cf@cc2g2000vbb.googlegroups.com>

Show all headers | View raw


www wrote:
> After learning that, there is one more correction in .bashrc file:
> using ":" not ";" to separate the two:
> 
> export CLASSPATH="/cygdrive/d/project/libs/*:/cygdrive/d/project/bin"

> Now, no matter which directory I am at, this command will run my
> program:
> 
> java -classpath `cygpath -wp $CLASSPATH` A.B.C.MainWindow

It's usually a bad idea to use CLASSPATH.  Java tries to read it by default, so you already made a mistake by applying cygpath after setting the variable instead of before.

 export CLASSPATH=`cygpath -wp "/cygdrive/d/project/libs/*:/cygdrive/d/project/bin"`

Besides that, using it in conjunction with -cp is silliness.  Just use -cp.

CLASSPATH is usually too global.

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Java classpath question and how to run a program from command line? www <xsli2@yahoo.com> - 2011-11-28 13:50 -0800
  Re: Java classpath question and how to run a program from command line? Robert Klemme <shortcutter@googlemail.com> - 2011-11-28 23:08 +0100
  Re: Java classpath question and how to run a program from command line? markspace <-@.> - 2011-11-28 14:21 -0800
  Re: Java classpath question and how to run a program from command line? Lew <lewbloch@gmail.com> - 2011-11-28 15:58 -0800
  Re: Java classpath question and how to run a program from command line? www <xsli2@yahoo.com> - 2011-11-29 06:14 -0800
    Re: Java classpath question and how to run a program from command line? www <xsli2@yahoo.com> - 2011-11-29 06:54 -0800
      Re: Java classpath question and how to run a program from command line? Lew <lewbloch@gmail.com> - 2011-11-29 07:43 -0800
        Re: Java classpath question and how to run a program from command line? www <xsli2@yahoo.com> - 2011-11-29 09:22 -0800
          Re: Java classpath question and how to run a program from command line? Lew <lewbloch@gmail.com> - 2011-11-29 12:08 -0800
  Re: Java classpath question and how to run a program from command line? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-29 13:57 -0800

csiph-web