public static int getLineCount(String path)
	{
		//Firstly try to create the file
		File file = new File(path);

		//if the file exists
		if(file.exists())
		{
			@SuppressWarnings("unused")
			String line = "";
			int counter = -1;

			// Read the file and display it line by line. 
			BufferedReader in = null;

			try
			{
				//open stream to file
				in = new BufferedReader(new FileReader(file));

				try
				{
					// Prepare counter
					counter = 0;

					while ((line = in.readLine()) != null){ counter++; }
				}
				catch(IOException e){return -1;}
				finally{in.close();}

				if(counter == 0){ return -1; }
				else{ return counter; }
			}
			catch (FileNotFoundException e) { return -1; }
			catch (IOException e) { return -1; }
		}
		else
		{
			return -1;
		}
	}