No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
11 Posted Topics
I'm trying to run a simple servlet that counts the number of times a user visits the page using cookies but I'm getting the following error. I thought that NullPointerException was because there were no cookies at all in the browser. But after checking I found a couple of cookies …
Even after setting all the paths correctly, I get an error saying the "setclasspath.sh" cannot be found. I checked the directory and it was there. I then changed the permissions using chmod +x setclasspath.sh but to no avail. I've changed the permissions of all the files inside the "bin" directory …
System Information: OS: Ubuntu 11.10 Server: Tomcat 7.0 JVM: openjdk 1.6 I have checked if the server is running by going to [url]http://localhost:8080[/url]. It's working fine. I just need to know the directory in which I should save my servlet in order to run it. I think I am supposed …
So, I wrote the following program to connect to my local mysql server and create a table in the existing "test" database. The program compiled without any errors, but I got the following run-time error: java.sql.SQLException: Cannot connect to MySQL server on localhost:3306. Is there a MySQL server running on …
I have created a window containing only one button(park1). All I need is a new dialog(with "OK" and "Cancel" buttons to open when I click on park1. Thanks in advance. [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; class MyWin extends JFrame implements ActionListener { JButton park1; MyWin() { setSize(450, 500); …
So I know of two methods of reading or writing files in java. The first is the read(byte[]) method provided by InputStream class. The second is the readLine or write() method provide by the Buffered prototype. Which is the more efficient one out of these? Which one would you recommend?
OpenDNS tracert results: C:\>tracert -d 208.67.222.222 Tracing route to 208.67.222.222 over a maximum of 30 hops 1 <1 ms <1 ms <1 ms 192.168.1.1 2 36 ms 40 ms 39 ms 117.195.32.1 3 35 ms 35 ms 38 ms 218.248.164.38 4 41 ms 39 ms 41 ms 218.248.255.86 5 41 …
[CODE]class MyThread1 implements Runnable { Thread t; MyThread1() { t = new Thread(this);//create a Thread t.start();//activate the thread } public void run() //override run() of Runnable { int i; for(i =0; i< 1000; i++) System.out.print("*"); } public static void main(String args[]) { MyThread1 m1 = new MyThread1(); int i; for(i …
In addition to BufferedReader, you also have the option of using read(byte[]) function. It is relatively faster than BufferedReader.
Instead of double amounts[] = {0,100,200,300,400,500,600,700,800,900,1000,25000}; Try this, double amounts[] = new double[30]; amounts[] = {0,100,200,300,400,500,600,700,800,900,1000,25000}; Good Luck.
Isn't it better to use the BufferedReader function readLine() instead of read() or read(byte[])? The reason I ask is because of potential memory wastage by the read() function. If I specify a byte array of size 10, then it will become capable of accepting ten bytes from the transmitter. However, …
The End.