Cannot Be Resolved To A Type

by -73 views



masijade


one,351




Industrious Poster



Squad Colleague



Featured Poster



Y’all are missing a library.





Love Masijade,
What library could exist missing ya? Whatever idea delight? Give thanks y’all.




masijade


ane,351




Industrious Poster



Team Colleague



Featured Poster



Whatever library this “SMSClient” is a part of. I have no thought what library it comes from. All I can say is to search through the jars used on “your other PC” and or to try and find it with Google.





Dearest Masijade,
I accept closed all the codes but the basic call of the SMSClient from the other grade too gives the same error. Then what fundamental mistake could it be?




masijade


one,351




Industrious Affiche



Squad Colleague



Featured Poster



What I have already said. That yous do non take the jar containing this SMSClient course on your classpath.




masijade


i,351




Industrious Poster



Team Colleague



Featured Poster



Information technology has zero to do with the code. You are missing a library.





Dear Masijade,
So is that my java installation take problem is it? How can I trace which library am I missing? I am using centos 5.5. Whatsoever help on that?




masijade


1,351




Industrious Poster



Squad Colleague



Featured Affiche



Nevermind. I run across (now) that this SMSClient class is one you’ve copied off the spider web. Do you, personally, know
annihilation
almost Coffee? Because at present it looks as though the problem is simply that yous take not given the classes packages and that yous probably practise not have cwd (i.e. . ) in your classpath. try “executing” with “-cp .”.





Dear Masijade,
Yeah I argee I copied from the net and trying to play effectually it to acquire further. To exist frank I am non whatsoever expert in java aye I know the nuts though. So when you say the packages is the java comm parcel is it? That I accept configured accordingly and I quite certain information technology works well because I have my own short code and it is able to transport sms via that. The problem I am not skillful with packages. I dont become you when you say effort executing with -cp. Did you mean java -cp callSMSClient.java?




masijade


ane,351




Industrious Poster



Team Colleague



Featured Poster



No. I meant to give
your
classes a package.
Any
package. The first lawmaking line in your lawmaking should exist “package whatsoever.parcel.name.you lot.want;” If you exercise non have that the classes are in the “default” (i.due east. no packet) bundle and there are problems including classes from that packet (which the smaller class is attempting to do and is probably the reason for the “cannot exist resolved”. Now I really take a beef with schools (if that is where you are “learning”). They always have students first out in the “default” bundle and then, every bit soons as they try annihilation else, this sort of affair starts to happen and they accept no inkling what is happening (non to mention the fact that they have them using IDEs and so the students no nothing nearly the classpath, the second part of this problem), they should learn packages (at least this role of it) every bit one of the first things. Equally far as the classpath goes, besides, no. I assume y’all have both of these classes in the same place? In that case

            coffee -cp . callSMSClient
          

As I said, use “-cp . “.





Dear Masijade,
Yes y’all are the right guru I take added the statement package sms; in the commencement line of the both the codes and it works. The problem at present when I compile I write like this javac sms/callSMSClient.java sms/SMSClient.coffee. So if your find this in that location altogether vi codes from the web. And so I have added in each of information technology the package statement. How do I compile it now? Thank you lot.




masijade


one,351




Industrious Affiche



Team Colleague



Featured Poster



Did you lot move the source files into a subdirectory of the current directory chosen sms? if not (and yous do not necessarily, take to) then you practice not need to use sms/SMSClient.java, just rather still, simply, SMSClient.java past compilation a sms subdirectory volition exist created (if it doesn’t eixst, and the classfiles will be found at that place, and the execute command volition then be

            java -cp . sms.SMSClient
          





Dear Masijade,
Aye I have moved all into the a folder called sms. So what command must I run to compile all the files named every bit callSMSClient.coffee,SMSClient.java,Sender.java,SerialConnection.java,SerialParameters.java and SerialConnectionException.coffee.In each of the code at the peak I have added the statement package sms.




masijade


1,351




Industrious Poster



Team Colleague



Featured Poster







Dear Masijade,
Ok I would like to learn what is the -cp . is for? On the other hand I now tried both the codes with the package argument and without both is able to be compiled without whatsoever error? Can I know why this happens?

Source: https://www.daniweb.com/programming/software-development/threads/344183/class-name-cannot-be-resolved-to-a-type