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
posted
0
You are supposed to add the jar to the classpath -not the path.
And please UseCodeTags when posting code or configuration--thanks!
Dharmendran Govind
Greenhorn
Joined: Sep 08, 2008
Posts: 10
posted
0
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.
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
posted
0
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.