Advertisement
Guest User

Untitled

a guest
Sep 5th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.07 KB | None | 0 0
  1. ./java -jar /Samplejavaprogram/Sample.jar
  2.  
  3. no main manifest attribute, in /Samplejavaprogram/Sample.jar
  4.  
  5. package org.myorg;
  6.  
  7. import java.io.*;
  8. import java.util.*;
  9. import java.sql.Connection;
  10. import java.sql.DriverManager;
  11. import java.sql.ResultSet;
  12. import java.sql.SQLException;
  13. import java.sql.Statement;
  14. import java.util.logging.Level;
  15. import java.util.*;
  16.  
  17. public class Sample {
  18. public static void main (String[] args) throws IOException {
  19. int CountComputers;
  20. FileInputStream fstream = new FileInputStream(
  21. "/export/hadoop-1.0.1/bin/countcomputers.txt");
  22. DataInputStream input = new DataInputStream(fstream);
  23. BufferedReader br = new BufferedReader(new InputStreamReader(input));
  24. String result=br.readLine();
  25. CountComputers=Integer.parseInt(result);
  26. input.close();
  27. fstream.close();
  28. Connection con = null;
  29. Statement st = null;
  30. ResultSet rs = null;
  31. String url = "jdbc:postgresql://192.168.1.8:5432/NexentaSearch";
  32. String user = "postgres";
  33. String password = "valter89";
  34. ArrayList<String> paths = new ArrayList<String>();
  35. try
  36. {
  37. con = DriverManager.getConnection(url, user, password);
  38. st = con.createStatement();
  39. rs = st.executeQuery("select path from tasks order by id");
  40. while (rs.next()) { paths.add(rs.getString(1)); };
  41. PrintWriter zzz = null;
  42. try
  43. {
  44. zzz = new PrintWriter(new FileOutputStream("/export/hadoop-1.0.1/bin/readwaysfromdatabase.txt"));
  45. }
  46. catch(FileNotFoundException e)
  47. {
  48. System.out.println("Error");
  49. System.exit(0);
  50. }
  51. for (int i=0; i<paths.size(); i++)
  52. {
  53. zzz.println("paths[i]=" + paths.get(i) + "n");
  54. }
  55. zzz.close();
  56.  
  57. }
  58. catch (SQLException e)
  59. {
  60. System.out.println("Connection Failed! Check output console");
  61. e.printStackTrace();
  62. }
  63. }
  64. }
  65.  
  66. group 'MyApplication'
  67. version '1.0-SNAPSHOT'
  68.  
  69. apply plugin: 'java'
  70. apply plugin: 'application'
  71.  
  72. sourceCompatibility = 1.8
  73. targetCompatibility = 1.8
  74.  
  75. mainClassName ="com.common.Application"
  76.  
  77. buildscript {
  78. repositories {
  79. mavenCentral()
  80. }
  81. }
  82.  
  83. repositories {
  84. mavenCentral()
  85. }
  86.  
  87. // Include dependent libraries in archive.
  88. jar {
  89. manifest {
  90. attributes "Main-Class": "$mainClassName"
  91. }
  92.  
  93. from {
  94. configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
  95. }
  96. }
  97.  
  98. dependencies {
  99. testCompile group: 'junit', name: 'junit', version: '4.12'
  100. //JSON
  101. compile group: 'org.json', name: 'json', version: '20090211'
  102.  
  103. //Log4j
  104. compile group: 'log4j', name: 'log4j', version: '1.2.16'
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement