Results 1 to 3 of 3
- 02-10-2009, 02:09 PM #1
Member
- Join Date
- Feb 2009
- Posts
- 5
- Rep Power
- 0
Executing a java .class file from outside the containing folder
I'm trying to run a java .class file from the command line in XP from outside the containing folder but I'm having trouble making it work.
Say the file is:
H:\Java\HelloWorld.class
I'm at the command prompt in C:\ and I type:
java -cp H:\Java\HelloWorld
I get that class definition not found error. Of course it works fine when I run the file from the same folder.
The reason I need to do this is that I need to run the file from another program, by opening java.exe and passing it the filepath and other arguments.
I hope someone can help, it's probably very basic but it's soooo frustrating! :confused:
Thanks!
- 02-10-2009, 02:19 PM #2
Member
- Join Date
- Feb 2009
- Location
- Finland
- Posts
- 13
- Rep Power
- 0
The classpath and class name are two different things and hence given as two separate parameters.
Try:
java -classpath H:\Java\ HelloWorld
- 02-10-2009, 02:37 PM #3
Member
- Join Date
- Feb 2009
- Posts
- 5
- Rep Power
- 0
Similar Threads
-
Creating Folder in JAVA and Copying File
By fnoman in forum New To JavaReplies: 8Last Post: 10-18-2008, 07:33 AM -
executing a method in main class
By rangers27 in forum New To JavaReplies: 3Last Post: 07-19-2008, 05:04 AM -
executing the java file
By TheBayWatchMan in forum New To JavaReplies: 4Last Post: 01-12-2008, 09:31 AM -
how to use class in upper folder
By osval in forum New To JavaReplies: 1Last Post: 08-06-2007, 08:55 PM -
Executing a jar file
By peiceonly in forum New To JavaReplies: 2Last Post: 04-06-2007, 02:32 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks