• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

classpath

 
Sandy Elizabeth
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
/**from here**/
try
{

Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/db","loginName","password");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from test");
while(rs.next())
{
System.out.println(rs.getString("name"));
}
}

catch(Exception e)
{
System.out.println(e);
}
/**toHere**/
running, the portion in a pgm in jboss( written in jsp - deployed in a war file ) I get the error
java.lang.ClassNotFoundException: jdbc:mysql://localhost:3306/db
The error is surely because the class path was not set. I'm working on windows.Plz tell me where to set The classpath. I have put the jar file in the lib directory of both jboss and pgm.
I had set Path before executing the run.bat file of jboss

[ February 13, 2005: Message edited by: CS Techno ]
[ February 14, 2005: Message edited by: Bear Bibeault ]
 
Hareesh Ram Chanchali
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

1. go to my computer right click on it go to Advanced Tab click environment variables and then ...if there is classpath edit it or u create it using New button

2. u can use set CLASSPATH=%CLASSPATH%;ur_path;
here first %CLASSPATH% retains current path and then u can include ur locations (i just named it ur_path ..it is not keyword rather my word)

try and tell
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"CS Techno",

We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hareesh,

JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

thanks,
bear
Forum Bartender
 
Hareesh Ram Chanchali
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sure,

i will confine to the policies

Thanks & regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic