How to compile and run a simple java file in jenkins on Windows
compilation, java, jenkins, windows
Solution
- Go to configuration page of your job/project
- Select "Execute Windows batch command" from "Add build step" combo
- Type the following on Command field: javac Hello.java java Hello
- Save configuration
- Keep Hello.java on the folder /Jenkins/workspace/
- Build the project/job by clicking "Build Now" link and see the Console Output
Problem
I have installed Jenkins on Windows and created a job in Jenkins. I want to compile and execute a simple java file (say Hello.java). How can I do that? My Hello.java contains the following code: ``` public class Hello { public static void main(String args[]){ System.out.println("I'm dancing"); } } ```