Guest User

Untitled

a guest
Jan 22nd, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2. use strict;
  3.  
  4. if(!defined $ARGV[0] || $ARGV[0] eq ''){
  5. print "Useage: $0 sourse_file target_dir\n";exit 0;
  6. }elsif(!defined $ARGV[1] || $ARGV[1] eq ''){
  7. print "Useage: $0 sourse_file target_dir\n";exit 0;
  8. }elsif($ARGV[0] !~/.+\/(.+)\.java/){
  9. print "Useage: $0 sourse_file target_dir\n";
  10. print "And sourse_file must be a .java file\n";
  11. exit 0;
  12. }elsif($ARGV[1] !~/\/$/){
  13. print "Useage: $0 sourse_file target_dir\n";
  14. print "And target_dir must have '/' at the end.\n";
  15. exit 0;
  16. }
  17. my ($file_java,$dir) = ($ARGV[0],$ARGV[1]);
  18. system 'javac -classpath /opt/hadoop/lab.jar -d '.$dir.' '.$file_java;
  19.  
  20. $file_java =~/.+\/(.+)\.java/;
  21. my $file_name;
  22. $file_name = $1;
  23.  
  24. system 'jar -cvf '.$dir.$file_name.'.jar '.$dir.$file_name.'*.class';
  25. system 'rm '.$dir.$file_name.'*.class';
Add Comment
Please, Sign In to add comment