Click to See Complete Forum and Search --> : find javac in bat file
hagay
September 21st, 2000, 03:02 AM
I want to create bat file that finding javac (only one ,in my computer there is
some jdk)then compile myProg.java with the founded javac.
then run the file myProg.class.
Phill
September 21st, 2000, 03:39 AM
Hi there
Ok here is how you can do it.
In this example your java file is on Windows
desktop.
Step 1:
Open a new file in notepad.
Step 2:
Type the following line in notepad>
cd\windows\desktop
Step 3:
On the next line type the following>
javac yourFile.java
Step 4:
On the next line type the following>
java yourFile
Step 5:
Save this file as "Whatever.bat" on windows
desktop, make sure you put the quotation marks around it as somtimes it will save
the file as Whatever.bat.txt and you will be wondering why it wont work.
Then you simply just double click on the batch file.
You can also create a shortcut to this batch file.
Good Luck Phill
hagay
September 21st, 2000, 04:31 AM
Hi,
Thanks.
I know how to create simple bat file and how to compile java code.
My question is how to build th bat that searching in the computre
javac and when finding some javac ,choose one
and compile .
I dont know where the jdk in the computre of the man that compile.
Phill
September 21st, 2000, 04:38 AM
Hi there
If the man with the computer has
his "Path" set correctly,
then the batch file that i posted is all
that you need.
It changes the working directory to where the class file is,
and dos will find javac.exe and java.exe if he has set his path correctly.
Phill.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.