|
-
Oct 27th, 2005, 04:25 PM
#1
Thread Starter
Frenzied Member
problem running java program
i can run my java program if the .class(which is the main) is in the bin directory of java. I just type:
java myprogram
but how do I run that same .class file if its in c:\myJavaProgram folder
by the way, when I compiled the .java file, I had to use a .jar file, basically this was my command line:
javac -cp "C:\Program Files\Java\jdk1.5.0_05\bin\stuff.jar" myprogram.java
Last edited by benmartin101; Oct 27th, 2005 at 04:32 PM.
-
Oct 27th, 2005, 04:29 PM
#2
Fanatic Member
Re: problem running java program
 Originally Posted by benmartin101
i can run my java program if the .class(which is the main) is in the bin directory of java. I just type:
java myprogram
but how do I run that same .class file if its in c:\myJavaProgram folder
you have to change the path which does looks in for the java.exe file. Do it like this (type this in DOS before executing your program):
path=%path%C:\myJavaProgram
-
Oct 27th, 2005, 04:33 PM
#3
Thread Starter
Frenzied Member
Re: problem running java program
what do I type after that?
with the command:
java ... <- what comes after?
-
Oct 27th, 2005, 04:35 PM
#4
Thread Starter
Frenzied Member
Re: problem running java program
is there another way just from the java.exe command?
without having to type path=%....
-
Oct 27th, 2005, 04:44 PM
#5
Fanatic Member
Re: problem running java program
 Originally Posted by benmartin101
is there another way just from the java.exe command?
without having to type path=%....
No, dos cant execute java.exe unless it knows where to look for it. Doing path=..... tells dos where to look for java.exe
-
Oct 27th, 2005, 06:26 PM
#6
Frenzied Member
Re: problem running java program
You can always set the classpath in your environment variables.
-
Oct 31st, 2005, 11:14 AM
#7
Thread Starter
Frenzied Member
Re: problem running java program
I wanted to do something like this to run the program:
java -cp "C:\Program Files\Java\jdk1.5.0_05\bin\stuff.jar" C:\myJavaProgram\myprogram
but it doesn't work. Shouldn't it work?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|