Building a sample HelloWorld.java using Jenkins

1,502 views
Skip to first unread message

ajith...@gmail.com

unread,
Sep 29, 2015, 6:25:24 AM9/29/15
to Jenkins Users
Hi,

I am using Jenkins Software for building my HelloWorld.java code.

I can see that it shows Build success, but no .class files got generated.

I have followed the below steps:

1. I have stored HelloWorld.java in my /home/myuser/

2. Under Source code management I have selected 'None' option
 
3. Under Advanced Project Options in the 'Display Name' I am giving the path
where my source file is located.

4. I applied the above changes and saved by clicking save.

5. Then I tried to build the project using BuildNow button.

It gives as build success and the console output is shown below.

   Started by user anonymous
   Building in workspace
/usr/share/tomcat7/.jenkins/jobs/Ievcs_build1/workspace
   Finished: SUCCESS

But I checked in /usr/share/tomcat7/.jenkins/jobs/Ievcs_build1/workspace
there are no .class files present.

Please teach me how to build and generate .class files using jenkins.

 Regards,
 Ajith

ajith...@gmail.com

unread,
Sep 30, 2015, 2:59:39 AM9/30/15
to Jenkins Users
Any help regarding this post?

Victor Martinez

unread,
Sep 30, 2015, 3:40:46 AM9/30/15
to Jenkins Users
Hi there,

 As far as I see your use case won't work without adding some further build steps. BuildNow button doesn't mean it will compile your java code unless you add your javac command. Build Now button means it will execute the job and will run whatever you define within your Jenkins job. 

 In your case, you might read the below references which might introduce you some Jenkins concepts:


I hope it helps

Cheers

Nayan Jyoti Gogoi

unread,
Sep 30, 2015, 5:38:59 AM9/30/15
to Jenkins Users

Hi,

As per your query it is seen that you are not using any build tool,first you have install a build tool and accordingly have to set the environment path to that machine,and then you have define required targets there,for example you want to compile your .java program and put class files in another folder,then you have to write a target which will carry out your intended work.You can't directly put java file name to the build options,you have to provide the target name which you want to run.A best tool i am providing you is Apache ANT.Any query you can ask.


Regards,
Nayan
Reply all
Reply to author
Forward
0 new messages