Results 1 to 2 of 2
Thread: Could not find Main Class
- 11-03-2011, 01:50 PM #1
Member
- Join Date
- Nov 2011
- Posts
- 1
- Rep Power
- 0
Could not find Main Class
I'm developing on Linux SUSE... I'm pretty green to Java. I'm writing a Java application to interface with an OpenEdge v10 database. I'm trying to use the JDBC drivers to do so.
I have a VERY simple Java application setup, all I'm trying to do is simply load the driver and connect to the database. (I'm sure once I get that far, I'll be good to go with the rest of Java as I am familar with C/C++) What I'm finding in the OpenEdge documentation is that there is a fairly significant difference between using the JDBC drives with OpenEdge 9 vs. 10... and I'm getting confused. Bottom line...my app is getting runtime errors that I'm not really sure how to go about addressing.
Here is the code that I'm using:
I'm sure these pieces of information are more suited for OpenEdge developers, but I'll give them to you anyway... in case they help. The OpenEdge documentation says I need to include the CLASSPATH environment to point to the location of my JDBC drivers, which are located in my /fiscal/dlc/java/lib directory.Java Code:import java.net.URL; import java.sql.*; import java.io.*; import java.util.Properties; public class ProgressTest { public static String dbUrl = "jdbc:datadirect:openedge://stdblprovwv:6012;DatabaseName=cis"; public static Connection con = null; public static void main (String args[]) { try { // Load the driver Driver dbDriver = (Driver)Class.forName("com.ddtek.jdbcx.openedge.OpenEdgeDataSource").newInstance(); Properties props = new Properties(); props.put("user", "cis"); props.put("password", ""); con = dbDriver.connect(dbUrl, props); } catch (Exception e) { e.printStackTrace(); System.out.println("Error: " + e.getMessage()); } } }
When I execute the application prior to loading the supposed enviroment CLASSPATH, I get the following output:
It looks to me there that it simply cannot find the OpenEdge driver, and throws an excpetion saying so.Java Code:mxb931@mxbscs:~/queue/java> java ProgressTest java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at ProgressTest.main(ProgressTest.java:33) Error: oracle.jdbc.driver.OracleDriver
Following the documentation and adding my CLASSPATH variable, I get a different output:
Here it appears that it cannot find the defined class in the first place... Why can't it find the main class... when the main class is the program itself?Java Code:mxb931@mxbscs:~/queue/java> java ProgressTest Exception in thread "main" java.lang.NoClassDefFoundError: ProgressTest Caused by: java.lang.ClassNotFoundException: ProgressTest at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) Could not find the main class: ProgressTest. Program will exit.
Thank you for your help.
- 11-04-2011, 09:37 PM #2
Similar Threads
-
Could not find the main class
By RudeOil in forum New To JavaReplies: 1Last Post: 10-13-2011, 09:37 PM -
Could not find the main class:
By Kareng in forum JavaServer Pages (JSP) and JSTLReplies: 3Last Post: 10-01-2011, 08:04 AM -
Could not find or load main class BubbleSort.class
By blaqkout in forum New To JavaReplies: 5Last Post: 09-12-2011, 07:54 PM -
Could not find main class
By Andyj in forum New To JavaReplies: 2Last Post: 10-06-2009, 12:47 AM -
Could not find main class - JDK 1.6
By Syranno in forum New To JavaReplies: 1Last Post: 07-25-2008, 04:07 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks