guyfromfl Posted February 13, 2008 Share Posted February 13, 2008 I am trying to make a batch file that will compile and execute my java projects. I just want to type javaBatch.bat HelloWorld.java then it runs javac and java compiler automatically by the passed variable (makes HelloWorld). Any ideas? Link to comment https://forums.phpfreaks.com/topic/90912-batch-programming/ Share on other sites More sharing options...
Daniel0 Posted February 13, 2008 Share Posted February 13, 2008 Why not just run javac directly? Link to comment https://forums.phpfreaks.com/topic/90912-batch-programming/#findComment-465932 Share on other sites More sharing options...
guyfromfl Posted February 13, 2008 Author Share Posted February 13, 2008 I wasnt thinking when i set all that up so instead of typing C:\progra~1\java\jdk1.6_04\bin\javac HelloWorld.java i could just run the batch file, then it would execute the compiled java app too.. also ive been wondering how you pass args in batch files since 1986 Link to comment https://forums.phpfreaks.com/topic/90912-batch-programming/#findComment-465944 Share on other sites More sharing options...
Daniel0 Posted February 13, 2008 Share Posted February 13, 2008 Put the path to javac.exe in PATH (it's an environment variable). Then you can run it by just typing javac(.exe) from anywhere. Link to comment https://forums.phpfreaks.com/topic/90912-batch-programming/#findComment-465954 Share on other sites More sharing options...
Barand Posted February 14, 2008 Share Posted February 14, 2008 1986 would be round about the time I last did this but if I remember correctily :: javabatch.bat :: javac %1 at the command line > javabatch helloworld.java Link to comment https://forums.phpfreaks.com/topic/90912-batch-programming/#findComment-467192 Share on other sites More sharing options...
guyfromfl Posted February 15, 2008 Author Share Posted February 15, 2008 Daniel, yea i know about path but there are 2 commands i need to compile and run so I just wanted to type 1 thing, and also its a reason to figure out how (ask how) arguments work with batch files. and Barand, that did it! thanks man Link to comment https://forums.phpfreaks.com/topic/90912-batch-programming/#findComment-467688 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.