Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / February 2005

Tip: Looking for answers? Try searching our database.

run any location?

Thread view: 
Pete - 25 Feb 2005 04:36 GMT
do you have to be in the directory of the .class file you're trying to
run?  or can i be somewhere else, as so:

file location:
C:\javaprograms>helloWorld.class

my location:
C:\

can i do this or something like it?
java javaprograms\helloWorld

it has allowed me to compile that way as so:
javac javaprograms\helloWorld.java
while in the aforementioned user location, i.e. C:\ with the file in
the preceding file location, i.e. C:\javaprograms>helloWorld.class

but i have not been able to execute a program that way.....  so can i
run a .class file without being in the current directory of that
file???

if not, i don't understand why the j2sdk-1_4_2_07 would allow
compilation, but not execution in that manner.....

Thanks!

Pete
Wiseguy - 25 Feb 2005 04:48 GMT
"Pete" <pete@ima-web.com> scribbled on the stall wall:
> do you have to be in the directory of the .class file you're trying to
> run?  or can i be somewhere else, as so:
[quoted text clipped - 7 lines]
> can i do this or something like it?
> java javaprograms\helloWorld

try

java -cp c:\javaprograms helloWorld

As long as the location of your class file is in the classpath it should
find it.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.