how to add a new pacakage

T

Tor Iver Wilhelmsen

naren said:

Then add the jar or dirs to the classpath as you compile and run,
using the -classpath command-line switch.

javac -classpath SomeLibrary.jar com/mypackage/MyClass.java

java -classpath .;SomeLibrary.jar com.mypackage.MyClass
 
N

naren

i am not able to rum my prog in cmd, its getting compiled but not
running showing the error
 
H

Hendrik Maryns

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

naren schreef:
i am not able to rum my prog in cmd, its getting compiled but not
running showing the error

Yes?

- --
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFFGNp5e+7xMGD3itQRAtBtAJ9EyDjpqmH4Y32Nhb0BjvEOGzjQpgCdE3R0
I0FM0FIC9vsONBT0I593qbQ=
=CgH6
-----END PGP SIGNATURE-----
 
T

Tor Iver Wilhelmsen

naren said:
i am not able to rum my prog in cmd, its getting compiled but not
running showing the error

You forgot to show us the error message; but you need the same
classpath when running as when you compiled. If you use a CLASSPATH
env var you should be fine - but remember to also add the dir that is
the root of you class' package, e.g.

java -classpath some\directory;%CLASSPATH% your.package.and.Class

on Windows.
 

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
473,780
Messages
2,569,611
Members
45,282
Latest member
RoseannaBa

Latest Threads

Top