Advertisement
Guest User

Untitled

a guest
Aug 5th, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. this.getClass().classLoader.rootLoader.addURL(new File("file.jar").toURL())
  2.  
  3. #!/bin/bash
  4. //usr/bin/env groovy -cp extra.jar:spring.jar:etc.jar -d -Dlog4j.configuration=file:/etc/myapp/log4j.xml "$0" $@; exit $?
  5.  
  6. import org.springframework.class.from.jar
  7. //other groovy code
  8. println 'Hello'
  9.  
  10. @Grab(group='com.google.collections', module='google-collections', version='1.0')
  11.  
  12. #!/bin/bash
  13. //bin/true && OPTS="-cp blah.jar -Dmyopt=value"
  14. //bin/true && OPTS="$OPTS -Dmoreopts=value2"
  15. //usr/bin/env groovy $OPTS "$0" $@; exit $?
  16.  
  17. println "inside my groovy script"
  18.  
  19. // printEmployees.groovy
  20. this.class.classLoader.rootLoader.addURL(
  21. new URL("file:///C:/app/Dustin/product/11.1.0/db_1/jdbc/lib/ojdbc6.jar"))
  22. import groovy.sql.Sql
  23. sql = Sql.newInstance("jdbc:oracle:thin:@localhost:1521:orcl", "hr", "hr",
  24. "oracle.jdbc.pool.OracleDataSource")
  25. sql.eachRow("SELECT employee_id, last_name, first_name FROM employees")
  26. {
  27. println "The employee's name is ${it.first_name} ${it.last_name}."
  28. }
  29.  
  30. #!/bin/bash
  31. // 2>/dev/null; SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
  32. // 2>/dev/null; OPTS="-cp $SCRIPT_DIR/lib/extra.jar:$SCRIPT_DIR/lib/spring.jar"
  33. // 2>/dev/null; OPTS="$OPTS -d"
  34. // 2>/dev/null; OPTS="$OPTS -Dlog4j.configuration=file:/etc/myapp/log4j.xml"
  35. // 2>/dev/null; exec groovy $OPTS "$0" "$@"; exit $?
  36.  
  37. import org.springframework.class.from.jar
  38. //other groovy code
  39. println 'Hello'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement