masijade 1,351 Industrious Poster Team Colleague Featured Poster

That is how you create a jarfile, not how you "run it". Now, in which step are you having problems. When creating it, or when executing it?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Read the manual. I see no need to repeat information here that is freely, and readily, available from the same source from where you downloaded the software. It is also provided in the download. We would not be able to state it as well as the manual anyway.

Do you always ignore the documentation from the software you obtain?

masijade 1,351 Industrious Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, those we are not going to give you.

If you post your code and explain exactly what is going wrong with it (i.e. compile/error messages) we will help you with it, but we are not going to do it for you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What, exactly, are you having problems with?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Huh? What are talking about. Thread has no dispose method. GUI elements normally do, but that is something different. Those you have to call because some elements are held onto (i.e. referred to from somewhere) even after all your references have gone out of scope, and some information is sometimes held onto even after you remove them from the GUI. dispose will remove those references, thereby allowing the info to be garbage collected. Threads you simply let run out of scope, or, if the scope is going to continue long after the thread has been created, and long after the thread has finished its work, then set your reference to it to null.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That is an SQLite question.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, showing your code might help to correct it. But, please, construct a small compilable and executable program that demonstrates your problem. Don't post some 13 page long "production" code full of irrelevant info.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

This (!=p) is not a statement/expression. What is "not equal to" p?

sbhavan commented: Good Solution +1
masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sorry, but what do you think a ScrollPane is, if not simply a JPanel with ScrollBars?

masijade 1,351 Industrious Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster

By giving your JPanel a different layout, rather than using the default FlowLayout.

http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The SQLLite driver is, at best, a Type 2 JDBC Driver. It is only a JNI wrapper around the SQLite library, and that code shown does not use JDBC functionality, at all.

P.S. "func" is "function" and "agg" is "aggregate". The first is creating a function (seemingly a db function?), and the second is creating an aggregate function (again a db function?). If you do not SQLite in and of itself, you are probably going to have a very hard time understanding this "JDBC Driver". If you are simply looking for an embedded database, use JavaDB/Derby. They are at least complete JDBC Drivers.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I said read it, not, literally, use the read method. See the API docs for InputStream, and read that article I posted, and more things will come clear to you. There are a plethora of code examples in that article, as well.

And that "int" is a byte value. Once again, read the API docs and that article.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Open the InputStream and read it.

read the following thoroughly and implement its suggestions.
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

masijade 1,351 Industrious Poster Team Colleague Featured Poster

See the "printf" method of PrintWriter, or the format method of String in the API docs, then simply format the print so each number (with leading/separating/trailing whitespace) uses the same number of characters.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, well, afraid you're going to be asked to explain your code to your instructor? Or do you have to turn in a written explanation/description of it with the code?

In any case, if you had done your assignment, rather than copying it, you would probably understand it.

P.S. Whether any of the above is true, or not, don't bother protesting, as nobody here is going to believe it. We see far to many "do my assignment for me" requests to believe that you "got this from a friend" for anything other than a homework assignment.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Initiating an array simply creates "holding spaces" for the elements. Each of those elements is, however, currently "null". If you expect to have a "Player" predefined at every element, then you need to loop over the array and create one in each spot. i.e.

String[] array = new String[5];
for (int i = 0; i < array.length; i++) {
  array[i] = "";
}

Edit: The default values for the array elements are as follows:

boolean[] --> false
int[], short[], float[], double[], long[], char[], byte[] --> 0
Object[] --> null
masijade 1,351 Industrious Poster Team Colleague Featured Poster

You don't have to "write a classpath" for web apps.

You place any jar you need in the web-apps WEB-INF/lib directory, except JDBC libs may need to be placed in the "shared/lib" directory of tomcat.

Your own classes are to be placed in the WEB-INF/classes directory (with each package being a directory, as normal).

And give your class a package, that is a must. You should never write a class without a package. And classnames should be capitalised (not needed but it is standard, and, from most programmers, expected).

So, now assume you change valid to give it a package of authentication , and change the name from valid to Validator , the servlet-class would then be, of course, authentication.Validator , and that class will be located in WEB-INF/classes/authentication/Validator.class All of this (except the need for a package and classnames which are basic java) is explained in the linked to Manual.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So, waited until the last minute to do your project assignment, huh?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No idea what you're saying as http and a shared drive have nothing (at least not intrinsicly) to do with each other.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

http://tomcat.apache.org/tomcat-6.0-doc/index.html

And Read Chapters 1 - 4 of the User Guide portion.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Can't do it. I mean, don't you think that would be a huge security hole to be able to just write things onto the server?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sure there is someone who can. Whether or not you will find him/her here is another question, however. Also, whether or not (s)he will is yet another question, however.

Start with the tutorials and go through them from beginning to end.

http://java.sun.com/docs/books/tutorial/reallybigindex.html

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course, a Servlet/JSP. Or use JPCAP and try to write a sniffer (although C/C++ would be better for that). Even easier, however, is to read the access log of the gateway, as all "get" URL are logged there ("post" URLs, as well, but without the data, of course) Java is also for that overkill, though.

Edit: But what is it you really want to do? Are you simply trying to log what telephone number sent a message to the gateway?

Or are you trying to determine what telephone numbers the gateway is forwarding an SMS to (and the message itself)?

In both cases, look at the configuartion for the gateway, you can probably log the info somewhere, if it is not being logged already. But be very careful. There are probably all sorts of legal issues involved.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If you are getting the "response" then you also sent the "request" so you should already have "A and B".

You need to better explain your situation and your goal.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
peter_budo commented: Cookie goes to Sun admin for advertising Sun ;) +22
masijade 1,351 Industrious Poster Team Colleague Featured Poster

> python got strong typing ,but not security

I guess 'masijade' meant that Python is not statically typed like Java and hence you lose out on aggressive re-factoring and excellent IDE support.

Ahh, that's the word I was searching for. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

people who knows both java and python do say so. you just have to google it.

Qualified, trustworthy sources, please. You're the one making the argument here.

python got strong typing ,but not security

I know that it has very strict "indention" rules to enforce the block definitions, but, AFAIK (correct me if I am wrong), it still has an "eval" statement, which, IMHO, is far from "strongly-typed".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I wouldn't expect it to be. Don't have clue. I can only suggest checking out the MS sites.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

First, and foremost, change those cobbled together SQL queries with Statement to PreparedStatements (see the tutorial on PreparedStatements).

Secondly, if no error is occurring, than I can only assume the where clause is not matching anything (in the updates).

Other than that, try printing out the query and examining it, and executing it manually, to analyse further.

Also, use executeUpdate, rather than execute, and capture the returned int and print it out, that int lists the number of affected rows. If it is 0, then the updates where clause didn't match (for the updates).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Who says you can produce it in a quarter of the time?

And "more or less" can be a much larger discrepancy than you are attempting to make it sound.

And, AFAIK, neither of those languages have the strong-typing, nor security that Java does. Which, even if you could produce things "in a quarter of time", you'd could very likely be shooting yourself in the foot four times faster.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And the errors?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Code and exceptions would help.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Unless the table is huge, or the network insufferably slow, or there are a lot of queries to perform, I don't see the problem in using multiple queries, as the should be more than quick enough. I also, however, don't see a problem in "preloading", depending on the size of the data and whether or not it can change, but store it in an application context object rather than as an instance or class variable in the servlet.

Edit: And, do it in the init method of the servlet, rather than in any of the "do" methods.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

According to the API docs, countTokens() returns

the number of tokens remaining in the string using the current delimiter set

So, before you call nextToken on a "tokened String" with 5 elements it returns 5, after calling nextToken once it returns 4, so, what do you think is happening with your for loop?

Add

int size = tok.countTokens();

and use size in both places where you currently use countTokens() .

javaAddict commented: Good call. I didn't bother to examine it that closely +8
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay. And?

If that is an API in commons, then you might want to switch to it (it's liable to be a bit more flexible, and at the same time stable than yours), but whether it performs better than yours or not, or is just plain overkill or not (both of those dependant on what you are actually doing) are other questions.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What are you talking about? What from apache commons do you want to use? Are you thinking of using the FTP library from commons, or something else? The question, IMHO, doesn't make a lot of sense.

tux4life commented: Look at his username, I guess you'll have to guess it :P +21
masijade 1,351 Industrious Poster Team Colleague Featured Poster

That is bad coding. Don't reuse statement objects (i.e. don't make statement and resultset objects instance variables, they should be opened, used, and closed as narrowly as possible, and try not to share connections, use a connection pool and get, use, and close connections from the pool as narrowly as possible.

Closed resultsets and npe's will not result from queries from separate clients to the DB, so I can only assume this is a web app (or something similar) and all the actual DB requests are originating from the same VM, and probably using instance variables for statements and/or resultsets and are possibly sharing connections.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

the awt package. For 3D graphics you are going to need an external 3rd party library. Google a bit there are a few of them.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

An application context object.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Have you tried placing quotes around the portion of the classpath with the space in it? Or around the entire classpath? Also, make sure that the configuration for tomcat also has quotes around the portion of the path with spaces in it in it's definition of the jdk to be used.

Edit: Also, the tomcat configuration will need quotes in the portion of it's configuration pointing to the "library" directories. It is the "Program Files\Apache Software Foundation" portion of the path that is causing the problem. I haven't run Tomcat on Windows (or anywhere else) in a while, though, so I can't tell you, reliably, how to modify it's configuration.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then what you have is JavaScript not Java, if looking at the page source you see "java code".

Next time post in a JavaScript forum, I have already asked the moderators to move this one.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

google >> java+sftp+tutorial

Do it this way java+sftp+tutorial ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It might help to know exactly what "doesn't work" entails.

"Doesn't work" doesn't help.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What do you mean "a java interface on a website"?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then the query is either returning only one item, or you have done something wrong with "c1". But this code won't show us that. In any case, you shouldn't be mixing your GUI code and your DB code in this way. Simply read the resultset adding the values to a Vector then, preferably in another method and another class, set all options in the combobox at once by simply replacing it's list with the Vector by doing

c1.setModel(new DefaultComboBoxModel(vector));
masijade 1,351 Industrious Poster Team Colleague Featured Poster

It probably has to do with the fact that you're not starting any threads, or at least not properly, but I have no desire to have yet another long "discussion" about threads and the Swing Event Thread only to have it go nowhere, which is what always seems to happen as soon as someone asks this type of question.

So, one last hint, it probably has to do with performing actions on the Swing Event Thread rather than in their own thread.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Seeing your code would help.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then I would build a single method that takes a StringBuilder (for storing the value), and an SQL statement and set those off.

public void executeStatement(StringBuilder sb, String query) {
    try {
        Statement stmt = conn.createStatement();  // or however you wish to get/create a statement
        try {
            ResultSet rs = stmt.executeQuery(query);
            try {
                int fields = rs.getMetaData().getColumnCount();
                while(rs.next()) {
                    for (int i = 1; i <= fields; i++) {
                        sb.append(rs.getString(i)).append(",");
                    }
                    sb.replace(sb.length() - 1, sb.length(), "\n");  // replace trailing comma with newline
                }
            } finally {
                try { rs.close(); } catch (Exception e) {}
            }
        } finally {
            try { stmt.close(); } catch (Exception e) {}
        }
    } catch (SQLException sqle) {
        sqle.printStackTrace();
    }
}

...
    StringBuilder sb = new StringBuilder();
    executeStatement(sb, "SELECT * FROM tblMaze1");
    String rsMaze1 = sb.toString();
    sb.setLength(0);
    executeStatement(sb, "SELECT * FROM tblMaze2");
    String rsMaze2 = sb.toString();
    sb.setLength(0);
...