PDA

View Full Version : Class not found



Guest.Visitor
01-01-1995, 02:00 AM
I've just upgraded my JDK from 1.1.6 to 1.1.7B, and started using Swing (1.1.1 beta1) for the first time. I've changed all the path/classpath values to point to the right directories. A few simple java classes I put together compile and execute ok, but when I tried to run the GUIExample class described in the JT400 documentation, I get a 'GUIExample class not found' error. This class compiled cleanly, and shows up as a class file in the directory. One of the differences between this class and others that work fine, is that this class uses an inner class (for an adapter). Anyone struck this?

J.Pluta
03-20-1999, 10:20 PM
<font color=blue>On Saturday, March 20, 1999, 07:15 PM, J V Thompson wrote: I've just upgraded my JDK from 1.1.6 to 1.1.7B, and started using Swing (1.1.1 beta1) for the first time. I've changed all the path/classpath values to point to the right directories. A few simple java classes I put together compile and execute ok, but when I tried to run the GUIExample class described in the JT400 documentation, I get a 'GUIExample class not found' error. This class compiled cleanly, and shows up as a class file in the directory. One of the differences between this class and others that work fine, is that this class uses an inner class (for an adapter). Anyone struck this? </font><hr> John, I use several inner classes in my code, and they seem to be working fine. Did you get a separate .class file for the inner class? A named inner classes will generate something like Outer$Inner.class, while an anonymous inner class will be Outer$1.class. I have both in one of my examples, and they work fine. Can you remove the inner class just for testing and see if that helps the situation? Also, the IBM visual classes will NOT work with Swing1.1.1, because of the Swing package naming change (from com.sun.java.swing to javax.swing), although normally you would get a compiler failure right away because of a bad import statement. <a > href="//www.zappie.net/java"><img > src="//www.zappie.net/java/_derived/index.htm_cmp_zero110_vbtn_p.gif" width="140" height="60" border="0" alt="Zappie's Java Home" align="middle"></a>

Guest.Visitor
03-21-1999, 12:47 AM
Joe The inner class thing wasn't the problem after all - there was a package statement at the beginning of the class, and once I removed that, everything worked fine. Now I'm trying to figure out just what effect the package statement has, and why I would want to use it. Do you use it at all? On Saturday, March 20, 1999, 11:20 PM, Joe Pluta wrote: </font><hr> John, I use several inner classes in my code, and they seem to be working fine. Did you get a separate .class file for the inner class? A named inner classes will generate something like Outer$Inner.class, while an anonymous inner class will be Outer$1.class. I have both in one of my examples, and they work fine. Can you remove the inner class just for testing and see if that helps the situation? Also, the IBM visual classes will NOT work with Swing1.1.1, because of the Swing package naming change (from com.sun.java.swing to javax.swing), although normally you would get a compiler failure right away because of a bad import statement. <a > href="//www.zappie.net/java"><img > src="//www.zappie.net/java/_derived/index.htm_cmp_zero110_vbtn_p.gif" width="140" height="60" border="0" alt="Zappie's Java Home" align="middle"></a>

J.Pluta
03-21-1999, 05:27 PM
<font color=purple>On Sunday, March 21, 1999, 01:47 AM, J V Thompson wrote: The inner class thing wasn't the problem after all - there was a package statement at the beginning of the class, and once I removed that, everything worked fine. Now I'm trying to figure out just what effect the package statement has, and why I would want to use it. Do you use it at all? </font><hr> chuckle Funny you should mention the package statement, John. I just spent an entire day learning all about packages and how they affect both compiling and javadoc. I finally got JDB/400 v1.0P working, and I had to package it for delivery (it's on the website now - go <a > href="http://www.zappie.net/Java/Techniques/JDB400/com_pbd.htm">here</a> to take a look). It turns out that a package in effect changes the "effective name" of your class. By adding "package com.pbd.jdb400" to my source code, I changed the class from, for example, Jdb400File.class to com.pbd.jdb400.Jdb400File.class. When used properly, what it does is create classes WAY DOWN in the directory tree underneath your current source directory. That way, when I created my jar file, it put the appropriate /com/pbd/jdb400 in front of my classes. The only real help I found on the net was <a > href="http://developer.java.sun.com/developer/techDocs/SearchData/dd/lang/325.ht ml">here</a> on the Java Developer Connection. It's not REAL helpful, but it does tell you what to do. If you have a serious need to use packages, let me know and we can talk about it in some more detail. <a > href="//www.zappie.net/java"><img > src="//www.zappie.net/java/_derived/index.htm_cmp_zero110_vbtn_p.gif" width="140" height="60" border="0" alt="Zappie's Java Home" align="middle"></a>