title: "Error: Could not find or load main class” in jenkins
body: <p>i am using jenkins  in ubuntu and i need to call a java class from python script. The code: </p>
  
  <pre><code>import os 
  import shutil
  import sys
  from subprocess import call, STDOUT
  
  param1=os.getenv(‘PARAM1’)
  param2=os.getenv(‘PARAM2’)
  param3=os.getenv(‘PARAM3’)
  
  cmd1 =”cp /…/Class.class $JENKINS_HOME/jobs/$JOB_NAME/builds/$BUILD_NUMBER/Class.class ”
  
  
  cmd2=”java  $JENKINS_HOME/jobs/$JOB_NAME/builds/$BUILD_NUMBER/Class ” +””+param1+””+param2””+param3
  
  print&gt;&gt;&gt; sys.stder, “Launching command: “ + cmd2
  call(cmd1,shell=True)
  call(cmd2,shell=True)
  </code></pre>
  
  <p>But the console output shows “Error: Could not find or load main class” 
  I have checked an the file was copied, and Jenkis have installed the Java SE Development Kit 8u31 version.
  I have try build the process in two step, first copy the java file and later set up the variables and do the second call but appears the same error. 
  Thanks,</p>
  
  <p>i have changed the code to:</p>
  
  <pre><code>classpath=os.path.join(os.getenv('JENKINS_HOME'),"jobs",os.getenv(JOB_NAME'),"builds",os.getenv('BUILD_NUMBER'))
  cmd2=[“java”,”-classpath”,classpath,”Class”,param1,param2,param3]
  call(cmd2)
  </code></pre>
  
  <p>The code Works!!!</p>
  
  <p>When i build with parameters the console output shows "Usage_ java [- options] class [args...]..." </p>