File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Package not found com.ibm.as400.access.*; Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

Package not found com.ibm.as400.access.*;

Dharmendran Govind
Greenhorn

Joined: Sep 08, 2008
Posts: 10
Hello,

I am getting error package not found com.ibm.as400.access.* when trying to compile or when opened in netbeans.
Any info is greatly appreciated. I spent whole of today trying to resolve this one.

Steps done:
1) I downloaded jtopen_7_1.zip and unziped into folder c:\jtopen_7_1
2) Added C:\jtopen_7_1\lib\jt400.jar in my path environment variable.
3) Restarted my computer.
4) Net beans keeps giving error msg cannot find package.

code is

public class AS400Access {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
System.out.println("Inside JDBC Test");
try {
DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver());
} catch (SQLException e) {
System.out.println("AS/400 JDBC Driver not found");
System.out.println(e);
System.exit(0);
}
try {
conn = DriverManager.getConnection("jdbc:as400://DVLPMNT");
} catch (SQLException e) {
System.out.println("Connection failed with " + e.getMessage() + " ");
System.exit(0);
}

System.out.println("Connected to the AS400 OK...");
}
}

Please help

Regards
DGOVI
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
You are supposed to add the jar to the classpath -not the path.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

And please UseCodeTags when posting code or configuration--thanks!
Dharmendran Govind
Greenhorn

Joined: Sep 08, 2008
Posts: 10
Thank you Tom for your reply.
First of all I am new to java. My computer does not have a CLASSPATH env variable. It has only the PATH variable and I added JDK to the path variable and I was able to complie simple java programs. so are you saying I need an env variable called CLASSPATH.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No, it just needs to be on your compilation classpath in NetBeans. (And your execution class path when you run it.)
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
Here's a quote from wikipedia:
The Classpath is an argument - set either on the command-line, or through an environment variable - that tells the Java Virtual Machine where to look for user-defined classes and packages when running Java programs.
That artticle looks like it has what you need but there are tons of others too. When Googling, I even also saw a youtube video on how to set the classpath in NetBeans.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Package not found com.ibm.as400.access.*;
 
Similar Threads
FTP: Transfer is working but all TXT files have no content
Novice in JDBC
JDBC/ODBC MS Access connection
Another executeUpdate() ?
Bug in Suns 1.6 server VM (I think)