Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

#ActualRipiz

Posted 10 May 2012 - 09:05 AM

It's in the original post. If you wish everything then here it is:

import java.sql.*;
public class Main {
	public static void main(String[] args) {
		try {
			Class.forName("org.postgresql.Driver");
			Connection con = DriverManager.getConnection(url_removed);
		} catch (SQLException ex) {
			System.out.println(ex.getMessage());
		} catch (ClassNotFoundException ex) {
			System.out.println(ex.getMessage());
		}
	}
}
When I use java Main it throws ClassNotFoundException, as it cannot find class org.postgresql.Driver, meaning I have to tell where it's located (the .jar file), but I don't know how to do that.

#4Ripiz

Posted 10 May 2012 - 09:04 AM

It's in the original post. If you wish everything then here it is:

import java.sql.*;
public class Main {
	public static void main(String[] args) {
		try {
			Class.forName("org.postgresql.Driver");
			Connection con = DriverManager.getConnection(url_removed);
		} catch (SQLException ex) {
			System.out.println(ex.getMessage());
		} catch (ClassNotFoundException ex) {
			System.out.println(ex.getMessage());
		}
	}
}
When I use java Main it throws ClassNotFoundException without the .jar, as it cannot find class org.postgresql.Driver, meaning I have to tell where it's located (the .jar file), but I don't know how to do that.

#3Ripiz

Posted 10 May 2012 - 09:01 AM

It's in the original post. If you wish everything then here it is:

import java.sql.*;
public class Main {
	public static void main(String[] args) {
		try {
			Class.forName("org.postgresql.Driver");
			Connection con = DriverManager.getConnection(url_removed);
		} catch (SQLException ex) {
			System.out.println(ex.getMessage());
		} catch (ClassNotFoundException ex) {
			System.out.println(ex.getMessage());
		}
	}
}

It throws ClassNotFoundException without the .jar, as it cannot find class org.postgresql.Driver.

#2Ripiz

Posted 10 May 2012 - 09:00 AM

It's in the original post. If you wish everything then here it is:

import java.sql.*;
public class Main {
	public static void main(String[] args) {
		try {
			Class.forName("org.postgresql.Driver");
			Connection con = DriverManager.getConnection(url_removed);
		} catch (SQLException ex) {
			System.out.println(ex.getMessage());
		} catch (ClassNotFoundException ex) {
			System.out.println(ex.getMessage());
		}
	}
}

It throws ClassNotFoundException without the .jar, as it cannot find classes.

#1Ripiz

Posted 10 May 2012 - 08:59 AM

It's in the original post. If you wish everything then here it is:

import java.sql.*;
public class Main {
    public static void main(String[] args) {
	    try {
		    Class.forName("org.postgresql.Driver");
		    Connection con = DriverManager.getConnection(url_removed);
	    } catch (SQLException ex) {
		    System.out.println(ex.getMessage());
	    } catch (ClassNotFoundException ex) {
		    System.out.println(ex.getMessage());
	    }
    }
}

PARTNERS