Simple question: Setup CLASSPATH
Hi, I download javamail API, and copy mail.jar to jdk1.2/lib directory. I add the CLASSPATH in my .bash_profile : CLASSPATH=/jdk1.2/lib/mail.jar After that, I compile the demo file, and it give me error : Package javax.mail not found in import I'm not sure how to set the classpath. Please tell me how to do that. Thanks Louis
Re: Simple question: Setup CLASSPATH
> Hi, > I download javamail API, and copy mail.jar to jdk1.2/lib directory. > I add the CLASSPATH in my .bash_profile : > CLASSPATH=/jdk1.2/lib/mail.jar > > After that, I compile the demo file, and it give me error : Package > javax.mail not found in import. I'm not sure how to set the classpath. If you're using JDK 1.2, you don't have to set the CLASSPATH - it's enough, if you put mail.jar in the jdk1.2/jre/lib/ext directory. Note, that you will also need activation.jar (from the Java Activation Framework available separately from Sun) to use JavaMail. Cheers, Oliver -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Java and Redhat 6.1
I'm thinking about upgrading my Linux machine from Redhat 6.0 to version 6.1, but I don't want to break my Java setup in the process. I'm using Blackdown Java 1.1.7v3 with the xx libraries, and I don't want to go to Java 1.2 until Blackdown makes a stable release. Will Redhat 6.1 support my current Java configuration? -- Roland Silver <[EMAIL PROTECTED]> -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
query
In java explicit typecasting is allowed. Now if I have 1. Instance of Base class 2. Name of derived class Can I call a method of a derived class object through the base class instance. theComponentApp = selAppComp[i].getInstance(); //Base class instance. try{ String compName = selAppComp[i].getComponentName(); //Derived class Name. Vector template = (???)theComponentApp.templateInfo(); } //What to do here? templateInfo is a function of Derived class.. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: IBM jdk1.1.8 Linux port
Renzo Pecoraro wrote: > Can someone tell me what the differences are between IBMs port and the > blackdown port? I am thinking speed, licensing, stability, etc. speed, speed, speed, speed, speed ... The license is pretty much the same, while I personally find blackdown's green threads more stable than ibm's native. -- dimitris -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Explicit type casting.
I have 3 files to test this. //A.java public class A { public void method(){ System.out.println("In A"); } } //B.java public class B extends A { public void method() { System.out.println("hello world"); } } //mymain.java import A; import B; public class mymain{ public static void main(String args[]) { B b=new B(); A a=new A(); b = (B)a; b.method(); } } Since this requires an explicit cast I did just that But I get a runtime error Exception in thread "main" java.lang.ClassCastException: A at mymain.main(Compiled Code) Any help? -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: query
SABYASACHI, The derived class is more specialized than the base-class. An instance of the Base class cannot be as specialized as the derived class, so you can't call methods of the derived class. The other way around is OK however. The more specialized derived class has features available from the base class. If the method you're trying to call doesn't use the more sepcializzed features of the derived class, or has nothing to do with being more specialized, you should consider moving the method up to the base-class. If you do so, you wille be able to call this method, as the base-class implements it. good luck, Joost Helberg > "SABYASACHI" == SABYASACHI S GUPTA <[EMAIL PROTECTED]> writes: SABYASACHI> In java explicit typecasting is allowed. Now if I have SABYASACHI> 1. Instance of Base class SABYASACHI> 2. Name of derived class SABYASACHI> Can I call a method of a derived class object through the base SABYASACHI> class instance. SABYASACHI> theComponentApp = selAppComp[i].getInstance(); //Base class instance. SABYASACHI> try{ SABYASACHI> String compName = selAppComp[i].getComponentName(); //Derived SABYASACHI> class Name. SABYASACHI> Vector template = (???)theComponentApp.templateInfo(); SABYASACHI> } //What to do here? templateInfo is a function of Derived class.. SABYASACHI> -- SABYASACHI> To UNSUBSCRIBE, email to [EMAIL PROTECTED] SABYASACHI> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] -- Joost Helberg Unix consultants v v [EMAIL PROTECTED] OO developers \ / ### #### # >---X---< http://snow.nl # # # # # # # # / \ Snow B.V.## # # # # # # # ^ ^ Tel. 0418-65 # # # # # # # # Fax. 0418-653666### # # ## ## ## PGP PblKey fprnt=4D BD 6A 45 6A 86 81 59 0D BA 7D D4 B2 F8 63 34 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Explicit type casting.
On Wed, 3 Nov 1999 15:11:16 +0530 (IST), SABYASACHI S GUPTA wrote: > >I have 3 files to test this. > >//A.java >public class A { > public void method(){ > System.out.println("In A"); > } >} > > >//B.java >public class B extends A { > > public void method() > { > System.out.println("hello world"); > } >} > >//mymain.java > >import A; >import B; > >public class mymain{ > >public static void main(String args[]) >{ >B b=new B(); >A a=new A(); > >b = (B)a; > >b.method(); >} >} > >Since this requires an explicit cast I did just that >But I get a runtime error > >Exception in thread "main" java.lang.ClassCastException: A >at mymain.main(Compiled Code) This is a generic Java question... The answer is that "a" is not a "B" object. You can not cast something to something it is not. B is a subclass of A which means that "b" (which is of class B) can also be considered to be of class A but "a" (which is of class A) can not be considered of class B. This is SOP in object oriented languages. In C++ the compiler may be able to catch this at compile time or RTTI will catch it at run time. In Java it is usually just caught at run time since it checks the actual reference. For example, if you coded: B b; A a=new B(); b=(B) a; This would work since the object stored in a is actually more than just of class A it is of class B (which is a subclass of A and thus also of class A thus the first assignment is valid) In this case the a references an object that can be "cast" to a object reference of class B and thus at run time it will work. If you later do: a=new A(); b=(B) a; This would fail since a now contains an object that can not be looked at as an object reference to a class B object. -- Michael Sinz Technology and Engineering Director/Consultant "Starting Startups" mailto:[EMAIL PROTECTED] My place on the web ---> http://www.users.fast.net/~michael_sinz -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
RE: Explicit type casting.
You can't cast upwards i.e. there is no way to cast A to a child B. Class A doesn't know anything about B. It works other way round. It is possible to cast B downwards to A, because B includes the information of A. Jari > -Original Message- > From: EXT SABYASACHI S GUPTA > [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, November 03, 1999 11:41 AM > To: [EMAIL PROTECTED] > Subject: Explicit type casting. > > > > I have 3 files to test this. > > //A.java > public class A { > public void method(){ > System.out.println("In A"); > } > } > > > //B.java > public class B extends A { > > public void method() > { > System.out.println("hello world"); > } > } > > //mymain.java > > import A; > import B; > > public class mymain{ > > public static void main(String args[]) > { > B b=new B(); > A a=new A(); > > b = (B)a; > > b.method(); > } > } > > Since this requires an explicit cast I did just that > But I get a runtime error > > Exception in thread "main" java.lang.ClassCastException: A > at mymain.main(Compiled Code) > > Any help? > > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] > -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Simple question: Setup CLASSPATH
> John Louis wrote: > > Hi, > I download javamail API, and copy mail.jar to jdk1.2/lib directory. > I add the CLASSPATH in my > .bash_profile : > CLASSPATH=/jdk1.2/lib/mail.jar > > After that, I compile the demo file, and it give me error : Package > javax.mail not found in import > I'm not sure how to set the classpath. > >Please tell me how to do that. Thanks Move the jarfile into jdk1.2/jre/lib/ext/ . You don't need to add it to your CLASSPATH; it will be automatically found in that directory. Nathan -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
policytool
Could someone please tell me how to use the policy tool to set permissions for classes I run from my filesystem? I thought this entry in jdk/jre/lib/security/java.policy would take care of that, but apparently it does not. The documentation for this is scanty and driving me nuts (I had to add an AllPermission to the default property list in order to get anything to work). grant codeBase "file:" { permission java.security.AllPermission; }; -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Question
Dear Sirs: I am junior JAVA programmer, one question need your help. I had RedHat Linux 6.0 with Java 1.2 SDK and PostgreSQL database, I had copy the postgresql.jar into /jdk1.2/jre/lib/ext. then, I wrote an applet just query the data from PostgreSql database, and show the result on screen, then created the test.html file, and include the class , when I use appletviewer test.html, I can see the data everything is OK, but when I put the html on my web, then I can see the applet area show "Can't find Database Driver .. postgresql.drive" It's anything Linux envirounment setting error? Tks! Jones Chang -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
qestion
can you help me? my machine had two OS : linux2.0(redhat 6.0) & NT4.0 boot using lilo Xwindows can AutoStart in Linux befre. I using "Fdisk /mbr" (Windows98) to del lilo, and install lilo using CDROM again . now lilo is recovery. linux can boot . but Xwindows can not AutoStart in Linux (I not know how manual start Xwindows in linex ) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Question
> Dear Sirs: > I am junior JAVA programmer, one question need your help. > I had RedHat Linux 6.0 with Java 1.2 SDK and PostgreSQL database, > and my web server is Apache 1.3.6 version. > I had copy the postgresql.jar into /jdk1.2/jre/lib/ext. > > then, I wrote an applet just query the data from PostgreSql database, > and show the result on screen, then created the test.html file, > and include the class , when I use appletviewer test.html, I can see > the data everything is OK, > > but when I put the html on my web, then I can see the applet area show > "Can't find Database Driver .. postgresql.drive" > It's anything Linux envirounment setting error? > Tks! > > Jones Chang > -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Help SCJD.
Hello Java Developers, I'm going to take the Sun Certificate JAVA Developer exam. Is there any senior developers would kindly show me some sample programs or hints and references? Thanks in advanced to all. -- Best regards, Hollis mailto:[EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]