Help Request: Getting Batch Java Compiler Finished To Work
Ok, So I have been making this All-in-One Batch File Compiler for Java Files, to compile the Class Files, Manifest files, and the Jar Files. Everything works but one thing... I can't seem to figure out how to call another path in certain cases.. I will explain a case example below the Batch Code:
@ echo off
COLOR 0a
Title Leaum's All-In-One Java Compiler
echo Compiling The Class Files...
"Whattt to do here?!" C:\JavaApps
javac -classpath . *.java
Pause
cls
echo Type the CLASS File Name Exactly...
set Man=
set /p Man=Type CLASS File Name: %=%
pause
echo Compiling The Manfiest File...
echo Main-Class: %Man%>>manifest.txt
pause
cls
I posted it in pastebin because the code thing was being weird. Anyway, Line 6 for example, let's say I want it to call that Folder to Search for certain .Java Files when it needs to. When ever I am compiling a Java file that contains for example "TextIO.putln" Code, I would need it to call the TextIO.java/Class file in order for it开发者_如何学Go to compile correctly, and I just want to store all the standalone/applet files in a separate directory... And have it include that in the Class Compiler, But still create the Class Files in what ever directory the Current project .Java is in.. If any of this makes sense? I can't seem to find a way to make it call the TextIO though :3.
Any help would be great. Thank you!
Don't re-invent this wheel, especially in a platform specific language!
Learn Maven 3 or at least Ant or even Gradle. SCons would even be preferable to Windows specific batch files, there is nothing of value to learn from the approach you are taking.
If I'm understanding your question right, you simply need to add the directory containing your utility classes to the classpath for the compiler, e.g.:
javac -classpath .;C:\JavaApps *.java
But I do agree with Jarrod and others that, in the long run, it is better to learn to use a build tool.
精彩评论