Avinash Haridasu

Ranch Hand
+ Follow
since Jul 12, 2011
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Avinash Haridasu

Tony Docherty wrote:I guess you could write your own ClassLoader which kept track of which jar files it had loaded classes from (although I'm not sure how you would handle classes loaded by the bootstrap clas loader), but why do you want to know?

I am interested to know the order of loading of jars and when they are loaded..

I mean does all the jars in the lib, classpath, ext get loaded at the same time the jvm is up or do they get loaded on demand like when a class in the jar is invoked
10 years ago
Is there any way to know what all the jar files which got loaded/ added to classpath while the java program is executing..
10 years ago
Thanks for the information..

How does the javac (not java) pick the libraries it needs, to compile the application given to it.

What i am still not clear is why the javac command is compiling the application when the libraries are added to jre\ext.

My only concern is when we issue a javac command it should search for libraries in the folders present in the jdk, why is the jdk command java getting into the ext folders of jre and then trying to compile the application...

javac is specific to jdk, so it should search for libraries present in -classpath only. But i have not added the jars to classpath instead i have added to jre/ext folder and then compiled the application.
Now the compilation is successful.

I am not understanding why the javac command is picking jars in jre/ext..
10 years ago

Tony Docherty wrote:

javac is a command of JDK not JRE so why is the javac command picking up jars from the ext folder of jre when we have an internal lib folder of jdk.

Have you tried looking in the two lib folders and see what they contain and why do you think the jdk/lib folder should contain the java runtime jars?.

Yes, i did check two folders present in jdk and Jre.

I am not expecting the jre jars to be present in the jdk/lib folder as all the files present in the jdk is only for compiling the application and for running the application we use jre.

Here i am not trying to run the java file, i am just trying to compile the java file i have which depends on few 3rd party api's.

My only concern is when a file is getting compiled why is the javac checking for libraries (3rd party api's) present in the ext/lib folder of jre instead of the files present in the lib folder of jdk.

I have first added the 3rd party jars to the lib folder of jdk and then compiled the application which resulted in class not found errors. However when i copy the jars to the ext folder of jre the "compiling" is successful and also copying the files to jre/lib also did not work only copying to ext folder worked.
10 years ago
Thanks for the reply! I found good information on the jar's.

Below is what i am trying to do:

1. Added the commons jars to the jdk lib
2. use the javac command to compile, which throws out errors

The code compiles and runs successfully when i add few external api jar's like commons to the classpath or jre/lib/ext.

javac is a command of JDK not JRE so why is the javac command picking up jars from the ext folder of jre when we have an internal lib folder of jdk.
10 years ago

I am trying to compile an application dependent on few external jar and added them to jdk1.7.0_21\lib firstly and compiled the code. However it threw error class not found.

To my surprise when i added the jars to jre\lib the application compiled successfully. My questions is when the program is being compiled why would java require jars of jre.. as jre is only used for running the java applicatoins..

Below is the list of the directories which i am really consued to work with:
1. jdk1.7.0_21\lib
2. jdk1.7.0_21\jre\lib
3. jdk1.7.0_21\jre\lib\ext
10 years ago
yes, i have posted it here after doing that .
11 years ago
Hi All

I am using the below program to just list the files

24. FTPClient f = new FTPClient();
25. f.connect("");//i have ftp server configured at which is a linux machine and i am running the program from windows machine
26. f.login("<<USER>>", "<<PWD>>"); //
27. for (FTPFile kk : f.listFiles()){
28. System.out.println(kk.getName());
29. }
30. f.logout();

And it is returning the below exception

Exception in thread "main" java.net.SocketException: Software caused connection abort: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
at sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source)
at sun.nio.cs.StreamEncoder.implFlush(Unknown Source)
at sun.nio.cs.StreamEncoder.flush(Unknown Source)
at java.io.OutputStreamWriter.flush(Unknown Source)
at java.io.BufferedWriter.flush(Unknown Source)
at org.apache.commons.net.ftp.FTP.__send(FTP.java:501)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:475)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:552)
at org.apache.commons.net.ftp.FTP.port(FTP.java:877)
at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:709)
at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:657)
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3097)
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3072)
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2731)
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2778)
at com.msat.FTPUtils.main(FTPUtils.java:27)

Please help me in getting rid of the exception.

Thanks in Advance.
11 years ago
Hi All

I have a requirement to get the list of all the Scheduled Tasks (Windows XP), their last executed time, executed status, next run time ..etc

Could you please suggest me any api .. or any comments on how may i proceed with this.

Thank you.
11 years ago
Hi Friends

I recently started learning Hibernate.

I want to know whether Hibernate is better over MyBatis or vice - versa.

Could any one suggest me any Book on Hibernate.

It did not give me any error. But the message was not delivered to my mobile.

The below url the wsdl is present at that location b http://www.webservicex.net/sendsmsworld.asmx?WSDL

The below is the code for using the method available in that Web Service.
sun.rmi.SendSMSWorld service = new sun.rmi.SendSMSWorld();

QName portQName = new QName("http://www.webserviceX.NET" , "SendSMSWorldSoap");
String req = "<sendSMS xmlns=\"http://www.webserviceX.NET\"><fromEmailAddress>ENTER VALUE</fromEmailAddress><countryCode>ENTER VALUE</countryCode><mobileNumber>ENTER VALUE</mobileNumber><message>ENTER VALUE</message></sendSMS>";

try { // Call Web Service Operation

Dispatch<Source> sourceDispatch = null;

= service.createDispatch(portQName, Source.class

, Service.Mode.PAYLOAD);
Source result = sourceDispatch.invoke(new StreamSource(new StringReader(req)));
catch (Exception ex) {
// TODO handle custom exceptions here

The url below is not working. I got to know about this when i pasted the same in the browser address bar.




When i tried to use Way2Sms API i got the following error.

java.io.FileNotFoundException: http://wwwd.way2sms.com/auth.cl
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1610)
at SMS.login(NewClass1.java:131)
at SMS.send(NewClass1.java:74)
at NewClass1.main(NewClass1.java:531)

I have to send an SMS from a Java Application ( Web / Desktop ).

I don't want to use a Modem. I want to use a Web Service or any SMS API available.

Can any one help me in that ???
12 years ago

I searched in google and found two web services that can send sms to mobile phones.

But when i tried working on them both of them failed to work.



I even searched for SMS API in google. I found many, but none worked.

Does any one know how to send SMS through a Java Application using Web Service ??

12 years ago
In Java,

When a file contains public class

public class Demo{

The code above should be saved with a file name Demo.java

Why it does not get compiled if the file name is not Demo.java ??
Is there any reason for that ??
12 years ago

Campbell Ritchie wrote:It's all in the Java Language Specification.
There is no such thing as -0. That is the integer value 0 changed to negative, but integer 0 does no support a sign, so it turns back to 0. You are not doing double arithmetic, but promoting the negative int to 0.0.

Try changing it to -0.0

It Worked.

Thank You.
12 years ago
Can any one please explain the output of the below two statements???

System.out.println(-1.0/0);//Output: -Infinity = Line 1

System.out.println(1.0/-0);// Output: Infinity = Line 2

Why is the output of Line 1 and Line 2 not Equal ?
12 years ago