masijade 1,351 Industrious Poster Team Colleague Featured Poster

Nevermind. I see (now) that this SMSClient class is one you've copied off the web. Do you, personally, know anything about Java? Because now it looks as though the problem is simply that you have not given the classes packages and that you probably do not have cwd (i.e. . ) in your classpath. try "executing" with "-cp .".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It has nothing to do with the code. You are missing a library.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Your points 2 and 3 will become painfully clear to you after you read the Tutorial.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Closing this abused zombie now.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course that documentation is only valid for tomcat. There are many other web containers. Which is the reason I told you to read the documentation, as each container has their own admin interfaces.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Read the documentation for your web container.

Edit: If it is that it is a service from some third party provider, than ask them.

Shanti C commented: thanks for your quick response. +4
masijade 1,351 Industrious Poster Team Colleague Featured Poster

You need to restart the application after loading new classfiles. This happens automatically when you deploy a war file.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay. I guess all you wanted was cut-n-paste code. Well, another user for the ignore list.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It all depends on what this "60 character" bs actually means. ;-)

He doesn't state it very well.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, StringTokenizer won't help. Create an array of ((string.length() / 60) + 1) then use substring and a counter (starting at 0) to populate the elements. See the API docs for String, give it a try, and post that code.

Edit: Nevermind, the problem is something completely different. String tokenizer is still not the way.

Create a List<String> and a StringBuilder, then use charAt on the original String in a loop and populate the StringBuilder until it has these "60" characters, then call toString on that placing the result into the list, then, after you're finished with the String, call toArray on the List. See the API docs for String, StringBuilder, and List/ArrayList. Give that a try, then post your code here with the "problems" you're experiencing with it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? So where is your code and what is your problem?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What I have already said. That you do not have the jar containing this SMSClient class on your classpath.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, look at the API docs. All components have a getParent method, what do you think that does? Could that possibly return the container in which that component resides? Well, yes, I believe it does.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because, according to your logic, you are only displaying an error when the username matches but the password does not. Why do you not simply query with the username and password and let the DB do the work? Also, you should not be storing plaintext passwords anywhere. Use MD5 and hash them and store that hash, then hash what the user enters and compare those hashes.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

call validate and/or repaint on the container that contains those components.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That was just a guess (although DIAERESIS is the umlaut). Upon further investigation, KeyEvent is able to retreive the character (getKeyChar), but it cannot retrieve the code (getKeyCode) which is the int that needs to be used in Robot, and everything I've searched seems to point to the unfortunate circumstance that those keys simply are not provided a KeyCode and so cannot be used by Robot. The only thing I can say is to submit a "Request For Enhancement (RFE)" (or vote for any you can find on this topic). Through Sun it was handled in the bug database, not sure how it is handled through Oracle, though.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

combine the VK_O, etc, with VK_DEAD_DIAERESIS.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then you may have declared the variable outside the loop, but you didn't initialise (i.e. define) it. IOW if you do

String bogus;
while (true) {
  if (bogus.equals("Whatever")) {
    break;
  }
}

(as a contrived example)
you will get that compiler message, whereas with

String bogus = ""; // or even null
while (true) {
  if (bogus.equals("Whatever")) {
    break;
  }
}

you won't. Do you see the difference?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

hey freaky you for example if you have

No idea what you mean with that.

preparedstatment ps = new preparestatment("insert into student values( "x" , "y" )");

For one, you forgot the pluses in that statement (as well as mentioning that single quotes will need to be included for non-numeric values and to_date functions for dates), for another, if the statement is complete (i.e. there are no ?'s), and is not going to be used repeatedly in the same DB session, then use Statement not PreparedStatement (there is no reason to allow even the minimal overhead that PreparedStatement needs when you don't need to). And to make it clear to the OP, do not do it this way if these values come from anywhere other than hard-coded values or you run a large risk of sporadic SQL syntax errors and/or (intentional or unintentional) SQL Injection attacks.

Edit: Besides the fact that don't create either Statements or PreparedStatements with a call to constructor. Those are interfaces they don't have constructors.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

For the create statement you need only know how deep the second dimension is (i.e. the array[0].length) then use a loop to use String concatenation (or better two StringBuilders, but I don't know if you're ready for those) to create the sql for a CREATE TABLE statement and an INSERT statement (with the INSERT sql being usable in a PreparedStaatement, see the API docs and JDBC Tutorials for more information on PreparedStatement).

Now, using that information (and hopefully you know sql well enough to know how to make CREATE TABLE and INSERT sql statements) give it a try and the post that code here and we will help you to correct it (if it doesn't "work", but give us complete information as to the exception/compiler message(s)).

masijade 1,351 Industrious Poster Team Colleague Featured Poster
myName = myName.charAt(i) + myName.substring(0, i) + myName.substring(i + 1)

I did say two calls to substring (the only thing I left out was the charAt call).

Of course it is not the most effecient process in the world, but I believe this is what your instructor was looking for. Now, study this line, and post back to me how you think it is working. See the API docs for substring (the String class, of course).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That's what the ArrayIndexOutOfBounds was. If you want your program to through a "special" exception due to the lack of command line arguments than add an if statement checking the length of the args array and throw one if it is not at least as long as you expect.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

In this regard I am here to help you learn, and part of that is doing research. The ability, but more importantly the willingness, to do research is a boon to any occupation and the opposite is a hindrance.

Edit: And FYI, everything I have posted here has been relevant to the topic. That you claim it isn't is part of the problem.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You claimed to have searched already, but seemingly not properly, as you asked abut "boundaries" without ever mentioning anything that even came close to collision detection, so I gave you a term to search. You didn't want to so I did the search for you and provided you with a list of links, and you didn't like that either. And, as soon as someone here regurgitated the same principles tht were to be found in the first link you said "cool I'll try that", so the only thing I can assume is that you have neither the will, nor the wherewithal to do any research. Well, then, good luck as you'll never make it as a developer if you can't take a few words as a guide and do some research. That is at least 50% of a developers job.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Could be two different clients, could be two different threads, could be a few things. From the way this sounds it should be "achievable" with a single sql statement which should elimanate the race-condition possibility.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Probably just simply two different instances of the program running at the same time. A so-called race-condition. Both checked table b and did not find a record and so both added it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because the package path has nothing to do with file location. If you want to open a file based on package path use getResource to get a URL and the new File with the toURI method of that URL. (see the API docs for those). If you are only going to be readaing, then use getResourceAsStream to get an InputStream directly. If you plan on writing to it you don't want to use that and you won't be able to jar this file into the app (and if you do plan on jarring the file into the app you have to use getReourceAsStream as it will no longer be a File, but rather an entry inside of a jarfile).

Edit: I did explicitly state full path and I also gave an explicit example.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

dispose()

after hiding.

setVisisble(false) simply "hides" it, it does not "get rid of it".

masijade 1,351 Industrious Poster Team Colleague Featured Poster
Exception in thread "main" java.io.FileNotFoundException: gridp.ip.txt (The system cannot find the file specified)

"gridp.ip.txt" is not the full path. The full path would be "C:/whatever/directory/the/file/is/in/gridp.ip.txt".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, override the method?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Type the full path to the file (use forward slants "/" not backslants "\", and yes, even on windows).

That means the file either does not exist under the path given, or it cannot be accessed (user permissions).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Try the tutorials.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I am working in Netbeans IDE. I cannot type in output window.

Look at the project properties. There is a way to either "hard code" arguments or to get it to pop up a dialog asking for them.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I guess i have to give a command line argument.

As already siad here.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, it's doing what you want, right? Except for the last of course where the method has not been overriden.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sorry, but that is not really a fix. As far as the error, sorry, never seen it, I would need to Google it myself to be able to give you a possible, and I think we both know where I am going with that comment.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because i is defined within the loop and the condition of the lopp is, technically, outside the loop. A variable only "exists" within the scope in which it is created, in this case only inside the loop and not outside.

Edit: Do note, however, that a variable created outside the loop is visible within because the loop is contained within the scope in which the variable was created.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, an array cannot create objects. After you "get the data from the user" use an if statement to check if the element of the array to which you want to assign the data is null, and if so, create an instance of the "object" assign it to that element. After the check and possible creation, then assign the data.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

By writing a class with a main method and another method, and three other classes that extend that class and override that "other" method. In the main you create four references to the original class by creating an instance of each of the four classes you've created than call the "other" method on all four instances.

Just the instructions in other words. The instructions are pretty clear. Make an attempt and post that code and we will help you to correct it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sorry, but judging by those constructors and some of the other things from those posts it doesn't look like you "know Java". Who knows, maybe you were just "having a bad hair day", but people can only make assumptions from what they've been shown.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Whatever library this "SMSClient" is a part of. I have no idea 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.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

All of which the first hit on the google search would have told you (and much more) had you bothered to look. All I'm asking for is some visible effort on your part.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No. You're fine. I, actually, have no problem with your post. You only provided an outline anyway.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, no. I've given you hint, at least give it a try. How are you going to learn anything if I just give you the answer.

Like I said, give a try (a real try) and then post that code and we will help you to correct it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No. You can use the "length" together with a for loop and combination of two calls to substring with each iteration.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Oh, someone was seemingly unhappy that they didn't get cut-n-paste code. Well, I'm sorry. You are the one asking the question, you are the one that should make the effort. Look at the API docs, the tutorials and Google. If you can't figure it out come back. I gave you the classname you need to research, so research it. That is one of the major responsibilities for a developer.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well then, let's see how much you have learned using Google. Without thinking of any specific language, what is collision detection and how might it be used in this situation? Where you have a moving object that you don't want to cross certain areas?

IOW, I have told you what it is you need to use to accomplish this feat, and even pointed you to resources to learn something about it, and you don't seem to want to do that. It seems to me as though you want "teh codez". Well, you are not going to get them here.

Designate coordinates that should not be crossed then use collision detection to determine when your "moving" object has reached them. The principle is simple, now start studying.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

See the jdbc tutorials paying attention to the preparedstatement portion.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

In other words, think of a logical "default" value to be returned and add that as a return line at the end of the method. The compiler is complaining because you have declared the method to return a boolean, but, logically, paths exist where nothing would be returned.

masijade 1,351 Industrious Poster Team Colleague Featured Poster