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
Re: problem running java program
Quote:
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
Re: problem running java program
what do I type after that?
with the command:
java ... <- what comes after?
Re: problem running java program
is there another way just from the java.exe command?
without having to type path=%....
Re: problem running java program
Quote:
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
Re: problem running java program
You can always set the classpath in your environment variables.
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?