I would like to add to what Richard said, assuming u work in a windows environment java -classpath %CLASSPATH%;. MyConnection. ( you could also switch the dot(.) for your actual working directory name)
Deepak -----Original Message----- From: Richard Yee [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 30, 2002 1:51 PM To: [EMAIL PROTECTED] Subject: Re: Working with JSP not with JAVA Vaishali, This is a basic Java question. The problem is that you don't have your current directory mapped in your classpath. Try java -classpath . MyConnection Regards, Richard At 02:23 PM 4/30/2002 +0530, you wrote: >I have writen a connection class in .java and created a class file >the same code i have writen in jsp and import it whenever required. >in jsp it is working but when i try to run class file it gives me error >like > >import java.lang.*; >import java.sql.*; >public class MyConnection{ > public static void main(String s[]){ > Connection con=null; > Statement stmt=null; > ResultSet rs=null; > String code = ""; > String name = ""; > try{ > Class.forName("com.informix.jdbc.IfxDriver"); > } > catch(Exception e){ > System.out.println("Error 1"); > System.out.println(e); > } > try{ >con=DriverManager.getConnection("*************"); > stmt = con.createStatement(); > rs = stmt.executeQuery("SELECT emp_login_id,emp_name FROM >login_mst"); > while (rs.next()) { > code = rs.getString("emp_login_id"); > name = rs.getString("emp_name"); > System.out.println(code); > System.out.println(name); > } >// return stmt; > } > catch(Exception e){ > System.out.println("Error 2"); > System.out.println(e); > } > } >} >javac MyConnection.java > >java MyConnection >Exception in thread "main" java.lang.NoClassDefFoundError: MyConnection > >why? > >Regards >Vaishali >Reliance Industries Ltd. >India > >=========================================================================== >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff >JSP-INTEREST". >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". >Some relevant FAQs on JSP/Servlets can be found at: > > http://archives.java.sun.com/jsp-interest.html > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.jsp > http://www.jguru.com/faq/index.jsp > http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
