run question.

S

stevek

Think I have my path variables set up ok until I try to run an app. I
need to enter java -cp . <app name>.

What am I missing.

TIA
 
M

Matt Humphrey

stevek said:
Think I have my path variables set up ok until I try to run an app. I
need to enter java -cp . <app name>.

What am I missing.

A question.

Presuming that you're writing because your app doesn't work, what happens
when you try to make it run? Error messages, JVM, expected behavior, etc.

Cheers,
Matt Humphrey (e-mail address removed) http://www.iviz.com/
 
U

Ulf Nordlund

stevek skrev:
Think I have my path variables set up ok until I try to run an app. I
need to enter java -cp . <app name>.

What am I missing.

TIA

Have you set the environment variable CLASSPATH to include '.' ?
/ulf
 
S

stevek

Thought so. I the following not correct?

CLASSPATH=C:\.;C:\Program Files\j2sdk1.4.2_01\bin;E:\.;C:\Program
Files\sql2kjdbc\lib\msbase.jar;c:\program fi
les\sql2kjdbc\lib\mssqlserver.jar;c:\program files\sql2kjdbc\lib\msutil.jar
 
D

Dag Sunde

stevek said:
Thought so. I the following not correct?

CLASSPATH=C:\.;C:\Program Files\j2sdk1.4.2_01\bin;E:\.;C:\Program
Files\sql2kjdbc\lib\msbase.jar;c:\program fi
les\sql2kjdbc\lib\mssqlserver.jar;c:\program files\sql2kjdbc\lib\msutil.jar

Try to set "." as suggested...
The "C:\.;" does not set ".", it is just the same as "C:\;"
Try: CLASSPATH=.;C:\.;C:\Program...
 
X

xterm

Try to set "." as suggested...
The "C:\.;" does not set ".", it is just the same as "C:\;"
Try: CLASSPATH=.;C:\.;C:\Program...

Would work, though you don't need the "C:\."
try: java -classpath . Test1
 
M

Michael Borgwardt

stevek said:
Thought so. I the following not correct?

CLASSPATH=C:\.;C:\Program Files\j2sdk1.4.2_01\bin;E:\.;C:\Program
Files\sql2kjdbc\lib\msbase.jar;c:\program fi
les\sql2kjdbc\lib\mssqlserver.jar;c:\program files\sql2kjdbc\lib\msutil.jar

No, it is not. This is the reason why using CLASSPATH at all is a bad idea.
Besides, you've mixed up PATH and CLASSPATH.
 
T

Tony Morris

Michael Borgwardt said:
files\sql2kjdbc\lib\msutil.jar

No, it is not. This is the reason why using CLASSPATH at all is a bad idea.
Besides, you've mixed up PATH and CLASSPATH.

The main reason is that you don't have a portable build because you have a
dependency on the build machine and/or that you might accidentally compile
against the wrong libraries on the given dependant build machine.
 
T

Tony Morris

stevek said:
Think I have my path variables set up ok until I try to run an app. I
need to enter java -cp . <app name>.

What am I missing.


You have done the typical beginner's mistake of setting the CLASSPATH
environment variable.
Unset it.

http://www.xdweb.net/~dibblego/java/faq/answers.html#q5
"Generally, you do not set the CLASSPATH environment variable for a standard
SDK or JRE installation. The CLASSPATH environment variable is set for other
reasons, usually the installation of third-party libraries. Some people
(including myself) argue that setting the CLASSPATH environment variable at
all is bad practice; it should be set dynamically at each build. This keeps
the build machine clean from potential "contamination" from libraries in the
CLASSPATH. Setting the CLASSPATH environment variable was required for
installation of the SDK in versions prior to 1.2. This "myth" has
unfortunately carried over to later versions of Java and confusion has
resulted. A good rule of thumb is, "If you don't know how to set the
CLASSPATH (since you are relatively new to Java), don't set the CLASSPATH at
all". More information on the CLASSPATH environment variable can be found at
http://java.sun.com/j2se/1.4.2/docs/tooldocs/tools.html"
 
S

stevek

Thanks Tony. I will give your e-mail some thought. I used the tools.html
to get me where I was with setting the classpath. Dag's suggestion work
fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top