Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
    Bookmark Topic Watch Topic
  • New Topic

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

 
Dharmendran Govind
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 618
  • Mark post as helpful
  • send pies
  • Report post to moderator
You are supposed to add the jar to the classpath -not the path.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Report post to moderator
And please UseCodeTags when posting code or configuration--thanks!
 
Dharmendran Govind
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Report post to moderator
No, it just needs to be on your compilation classpath in NetBeans. (And your execution class path when you run it.)
 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic