Results 1 to 3 of 3
- 11-16-2012, 03:34 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 7
- Rep Power
- 0
Error: Could not find or load main class Test
I got the message as the title of this thread shows.
The program I have written is as follows:
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class Test {
public static void main(String [] args) {
String connUrl = "jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks2012;use r=sa;password=chai;";
try {
Connection conn = DriverManager.getConnection(connUrl);
}catch(SQLException e) {
JOptionPane.showMessageDialog(null,e.toString());
}
}
};
================================================== =====================
Can anyone tell me how to fix this and let the compiler find and load the main class Test successfully?
- 11-16-2012, 03:43 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,480
- Rep Power
- 16
Re: Error: Could not find or load main class Test
Please use [code] tags [/code] when posting code.
That is a runtime error, not a compile time error.
How are you running this?
Have you compile this already?Please do not ask for code as refusal often offends.
- 11-17-2012, 10:25 AM #3
Member
- Join Date
- Oct 2011
- Posts
- 7
- Rep Power
- 0
Similar Threads
-
Error:Could Not Find or Load Main Class
By vickyv200 in forum New To JavaReplies: 3Last Post: 08-29-2012, 01:10 AM -
Error: could not find or load main class
By sloppygecko in forum New To JavaReplies: 3Last Post: 08-08-2012, 03:11 PM -
Error: Could not find or load main class
By Tybald in forum EclipseReplies: 5Last Post: 05-28-2012, 11:22 AM -
Please help! Cannot find or load main class error
By BenH in forum New To JavaReplies: 3Last Post: 12-09-2011, 03:51 AM -
Error: Could not find or load main class
By ITSlave in forum New To JavaReplies: 4Last Post: 09-15-2011, 09:47 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks