javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You didn't read carefully! If you had, you would have seen that that method, is declared to be void. Meaning that it doesn't return anything.
So when you do this: Rectangle box3 = box.translate(40,30); You get an error because translate has return type "void". It doesn't return anything. It translates the instance that you call it: "box". Just call it. It is is void. Like you call any other void method. And then print the box

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Can anyone send me a finished project (tictactoe). I would be very grateful :)

Do your own homework cheater. We don't give away homework. We help others do it and learn by doing it themselves.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

hi..

i want to develop a GUI for the Grid in my company..
so pls someone provide me with a code for job submission in grid..
job submission module includes submission of a job, status of job, cancelling and retrieving output of a job..

if not a complete code, atleas some part for reference..

thanks in advance..

If we provide with all that, are you going to tell your boss that we did it and not you and are you going to give us your salary?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Check the API of the java.awt.Rectangle. More specifically check what the translate method does and what it returns. Don't expect that methods will do what you want. Always check the API.

http://download.oracle.com/javase/6/docs/api/java/awt/Rectangle.html

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

but i didnt understood how we can write it in Java

Then learn, but don't expect us to do it for you. The code is there

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Calculate Love Percentege . Between two names

The algorithm is in the c++ program that you copied and posted here. You can read it from there.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Do you have the jar that contains that package? Did you put it to the classpath when you try to compile it?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

start quote:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %> 
<%@page import ="javax.servlet.*" %>
<%@page import= "javax.servlet.jsp.*" %>
<%@ page language="java" %>

<%
JspWriter wr = pageContext.getOut();
Connection con=null;
PreparedStatement pst=null;
try
{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection("jdbc:odbc:ruhi","system","system");
     pst=con.prepareStatement("insert into repository values(?,?,?,?,?)");
    File file=new File("C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Water lilies.jpg");
    FileInputStream fis=new FileInputStream(file);
    pst.setString(1,"Ship");
    pst.setString(2,"Detroit");
    pst.setString(3,"yes");
    pst.setString(4,"CompleteProduct");
    pst.setBinaryStream(5 ,fis, (int)fis.available());
     int i = pst.executeUpdate();
    if(i!=0){
      wr.write("image inserted successfully");
    }
    else{
      wr.write("problem in image insertion");
    }  
  }
  catch (Exception e){
    System.out.println(e);
  }

%> 

end quote.

That is not what GuruMS has asked. Don't post random code that doesn't solve the problem of the one that made the question.
Especially code with no code tags. And especially code that is wrong!

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Churva, check the API of the JOptionPane. I repeatedly tell you to check the API but you don't. From all of your posts you give the impression that you want others to give you the solution.
If you have read the JOptionPane API you would have found the solution. Don't just use random commands.

If you want a "Yes and Cancel", why did you create the JOptionPane like that?
>>>
JOptionPane.showConfirmDialog(new JFrame(),
"Are you sure you want to Exit?", "Exit",
JOptionPane.YES_NO_OPTION)
<<<
Did you read the API in order to see what that argument means and what you should use? Or did you copy it from somewhere, or you just use your IDE's auto complete system and just chose a random argument?

And in my previous post I told you how to call the EmployeeEntry frame when the "Employee Entry" item is clicked. I gave you an example on how to call frames. Don't use a main method. That is only when you run the program in order to open the MainMenu frame. That you call from a main method, but for the others you just instantiate them like any other class. Like in my example, which you didn't follow

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

The code seems correct. But you need to declare when the "exit" is clicked what listener it will use. You have the method actionPerformed, so when it is called you will get result that you want. But you need to declare when that method will be called. Meaning that you need to add the listener that you created to the elements you want to respond to it:

...
menu1.add(exit);
menu2.add(pw);
menu2.add(hw);
menu3.add(pcw);
menu3.add(hrly);
menu4.add(author);
...

// check the API for the correct spelling of the method
exit.addActionListener(this);
author.addActionListener(this);
...


public void actionPerformed(ActionEvent e){
   Object source = e.getSource();
   
   // exit is the MenuItem declared globaly
   if(source==exit){ 

     int choice = JOptionPane.showConfirmDialog(null,"Are you sure you want to exit");
     if (choice == JOptionPane.) { // check the API of JOptionPane in order to determine what to use here
         System.exit(0);
    }

   } else if (source==author) { // author MenuItem clicked

     // do some stuff
     // you can declare a different frame here and open it
     AuthorFrame fr = new AuthorFrame();
     
      fr.setSize(500, 500);
      fr.setVisible(true);
      fr.setResizable(false);
      fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

   }
					  				   
}
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

This my Question :

1. Draw the UML class diagram
2. implement the class with proper visibility modifier, accessor and mutator
3. write the test program.


(The Fan class) Design a class named Fan to represent a fan. The class contains:

- Three constants named SLOW, MEDIUM, and FAST with values 1, 2, and 3 to denote the fan speed.

- An int data field named speed that specifies the speed of the fan (default SLOW).

- A boolean data field named on that specifies whether the fan is on (default false).

- A double data field named radius that specifies the radius of the fan (default 5).

- A string data field named color that specifies the color of the fan (default blue).

- A no-arg constructor that creates a default fan.

- The accessor and mutator methods for all four data fields.

- A method named toString() that returns a string description for the fan. If the fan is on, the method returns the fan speed, color, and radius in one combined string. If the fan is not on, the method returns fan color and radius along with the string "fan is off" in one combined string.

Draw the UML diagram for the class. Implement the class. Write a test program that creates two Fan objects. Assign maximum speed, radius 10, color yellow, and turn it on to the first object. Assign medium speed, radius 5, color blue, and turn it off to the …

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

What error do you get? You should also write like this:
<img src="SOCIALWEBSITE/Image/login.jpg" width="250" height="250" alt="This is an image" />

Don't forget the /> at the end.

The above will not solve your problem, though. You need to post what error do you get. Is the image file at the correct location?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Better. Now take that code and put it in a separate class. That class will have a method that returns a List of those countries:

public ArrayList getCountries() {
  // your code here
}

Then call that method from the jsp. Don't put connection code in the jsp:

<%
ArrayList countries = yourClass.getCountries();
%>

<select name="countries">

<%
for (....) {
%>
   <option value="<%=countries.get(i)%>" ><%=countries.get(i)%>
   </option>
<%
}
%>


</select>

Also the </select> needs to be outside of the loop

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

i have same this question ....how to draw design java on this question.... can you give me answer the this question ....how the coding and the output attached with the cover.

Start a new thread, and post your question there. What you say doesn't make sense. Explain your problem better. And also post some code if you have any

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

If you are new to java and don't know how to read from database then why do go and do jsp pages.

First learn java and then do jsp
First learn how to read from database and then do jsp.

And even if you knew all these you still need to lean first html and submitting form and getting the request before doing what you want.

The point is that you need to do some studying and if you don't understand the advices of the previous posts (Eric Cute's for example) then giving you the code will not solve anything.

Better start by searching examples on how to read data from the DB and then try to display them.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I have a similar problem.. HELP PLEASE... heres my code

//By coolman5659
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.KeyEvent;

import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.methods.Skills;
import org.rsbot.script.wrappers.RSGroundItem;
import org.rsbot.script.wrappers.RSNPC;

@ScriptManifest(authors = {"coolman5659"}, name = "CowMurderer", version = 1.0, description = "A script that kills Cows in Lumbridge.")
public class CowMurderer extends Script implements PaintListener{

    private static RSNPC Cow = null;

    //Paint
    public long startTime = System.currentTimeMillis();
    public int startexp;

    //Cow/IDs
    public int[]; cowIDs = {12362, 12363, 12364, 12365};

    //Cow/Drop IDs
    public int cowDrops = 1739;

    //AntiBan
    public void cameraAntiBan() {
        int randomTurn = random(1,2);
        final int GambleInt4 = random(1,1000);
        if (GambleInt4 >= 930) {
                switch(randomTurn) {
                    case 1:
                        new CameraRotateThread().start();
                        break;
                    case 2:
                        int randomFormation = random(0,2);
                        if(randomFormation == 0) {
                            new CameraRotateThread().start();
                        } else {
                            new CameraRotateThread().start();
                            new CameraRotateThread().start();
                        }
                }
        }
    }

    public class CameraRotateThread extends Thread {
        @Override
        public void run() {
            char LR = KeyEvent.VK_RIGHT;
            if (random(0, 2) == 0) {
                LR = KeyEvent.VK_LEFT;
            }
            keyboard.pressKey(LR);
            try {
                Thread.sleep(random(450, 2600));
            } catch (final Exception ignored) {
            }
            keyboard.releaseKey(LR);
        }
    }

    public boolean onStart() {  
     startTime = System.currentTimeMillis();
           log("Thanks for choosing CowMurderer!");
           return true;
    }

    public int loop() {
        cameraAntiBan();
        cowkiller();

        RSGroundItem cowDrops = groundItems.getNearest(cowIDs);
        if(cowDrops != null && !inventory.isFull() && getMyPlayer().getInteracting() == null) {
            if(cowDrops.isOnScreen()) {
                cowDrops.doAction("Take");
                sleep(1000,2000);
                while(getMyPlayer().isMoving()){
                    sleep(300,500);
                }
            }
            cameraAntiBan();

            return random(300,400); 
        }   
        return random(300,400); 
    }

    public void cowkiller() {
        Cow = npcs.getNearestFreeToAttack(cowIDs);
        if(Cow != null){
            if(Cow.isOnScreen() && getMyPlayer().getInteracting() == null){
                Cow.doAction("Attack Cow"); …
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You need to add an ActionListener to each of your items. Look at the JMenuItem API. When the menu is clicked the ActionListener's method will be called.
If you want to open another frame, just do what you did in the main.
Create a new frame and then make it visible. You can run that code from anywhere for as many frames that you created.

You can easily find tutorials on the net. Just search!

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Read the methods used in the code downloaded and try to create your own for reading and writing to a file as well as creating a class to hold your data. Check the API for methods that you don't understand.

Then read some tutorials on how to create a GUI. When was this assignment given to you?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Inside the constructor, create the JLabel with the image and add it to the component. You might want to look at the API of JLabel.

For adding elements to a frame check some tutorials. I usually do this in the constructor:

private JPanel panel = new JPanel();

public MainFrame() {
setTitle("Employee Entry");
....


// create the label as explained
// added to the panel:
panel.add(label);

// add the panel to the frame
add(panel);
}
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I cannot use a variable private lets say and authenticate the administrator.

After that I cannot use arralists to store inside the customers and their transactions?

Did you understood my question? Are you sure you mean, "I cannot" ?

Anyway, you start by creating classes to represent your objects and then other classes with methods that handle the functionality.
Then you can create a GUI that call those methods.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Have you imported Counter class at the jsp ?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

If you must authenticate the user, will there be a database ?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Then take the length of the String and use if-else statements as when to call the substring method. The variable length, how do you give it value? Shouldn't be using the String API in order to get the length of the String ?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

This is a small summary of your code:

Term term = new Term();
while () {
    if (str exists) {
      // don't add
    } else {
      // add term
    }
}

The problem is that term is declared outside of the while. So you do new Term() once. You created only ONE instance. So when you put into the Map bagOfWords the 'term' you put the same term with each iteration.
Example:
The first time you add for example the 'i'. That is the value of the instance term.
At the second time, you put the 'car' like this:

term.term=str;
bagOfWords.put(str,term);

BUT that 'term' is the same instance that had the first 'i'. So since it is the same instance in the memory, you changed its value. The MAP had this inside:

'i', term='i'

When you did this at the second time: term.term='car', you change the value that the term has. But that term is the same as the one already in the map. So every time you do this term.term=str, you change the value of the term instance which is the same term set for all the keys in the MAP.

'i', term='car'
'car', term='car'

Then:

'i', term='collision'
'car', term='collision'
'collision', term='collision'


So every time you want to add a new term, then create a new instance:

public void makeDictinary(String str,int i){

// REMOVE THIS		
//Term term=new Term();

str=str.toLowerCase();

....

else
		        { …
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

What do you mean fetch the String. Since you already have the String, why do you need to fetch it?

Also look at the String API: http://download.oracle.com/javase/1.4.2/docs/api/java/lang/String.html
for methods that you might want to use.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Pls help urgently, i want to read text files from directory but keeps giving me 3 errors

C:\Users\teejay\Documents\OneFile.java:52: reached end of file while parsing
}

C:\Users\teejay\Documents\OneFile.java:18: 'try' without 'catch' or 'finally'
try{ //read one text file

C:\Users\teejay\Documents\OneFile.java:18: 'try' without 'catch' or 'finally'
try{ //reached end of file whele parsing.

This is the code below

import java.io.*;
public class OneFile
{
    public static void main( String args[] )
    {

FileReader fr; BufferedReader br;

String result="";

String word= new String();

String target = "friend";



try{ //read one text file


fr = new FileReader ("C:/Users/teejay/Documents/Java/Tunji.txt");

br = new BufferedReader(fr);

Scanner scan = new Scanner(br);






while(scan.hasNext()){

result = scan.findWithinHorizon(target,0);



if(result!=null) {

word = (scan.next() + scan.findWithinHorizon("", 0));



ArrayList<String> names = new ArrayList<String>();

names.add(word);

for (int i=0; i< names.size() ; i++) {

System.out.println(names.get(i));}
}
}

end quote.

Start a new thread and use code tags. Press the (code) button and put code inside

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Your Rational class seems ok. But you need to add private attributes to the class. When you call the constructor you need to assign the arguments.

class Rational{

private int numerator = 0;
private int denominator = 1; // it cannot be zero!

Rational(){
   numerator = 0;
}

Rational(int a){
   numerator = a;
}

Rational (int a,int b){
   numerator = a;
   denominator = b;
}

}

You need to add checks. If for example someone enters zero for denominator you need to display a message:

Rational (int a,int b){
   numerator = a;

   if (b==0) {
     System.out.println("Your message");
   } else {
      denominator = b;
   }

}

You also need a method that makes changes to the numerator, denominator so when the user enters: 4/8, you need to convert that to 1/2. So you can do this:

class Rational{

private int numerator = 0;
private int denominator = 1; // it cannot be zero!

Rational(){
   numerator = 0;
}

Rational(int a){
   numerator = a;
}

Rational (int a,int b){
   numerator = a;

   if (b==0) {
     System.out.println("Your message");
   } else {
      denominator = b;
   }

   simplify();
}

private void simplify() {
   // your code
   // numerator 
   // denominator 
}

}

You need to call that method whenever you make changes to the numerator, denominator. It is better to call that method from inside the class. That is why it is private as well as the numerator, denominator. If you add public set methods you can call that method inside them. …

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

What output does it give? Did you enter anything?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

What you ask can be found in any book about jsp. Do some reading. You have a form with the inputs, then submit the form. You can use javascript to change the contents of the inputs, but in the end just submit the form. That is very basic and can be found in any book about jsp

<form name="form1" id="form1" action="whereToSubmit.jsp">
   <input type="text" name="field" id="field" value="This is a text field" />
   <input type="submit" name="submit" id="submit" value="Submit Form" />
</form>

You can use javascript to set the values of the input tags, (maybe you can use hidden as well, I don't know your code or page)
And then when you click submit, whatever is inside the form will be submitted.

You can save what the user has selected in the session and when the user goes to the confirmation page, display everything inside input tags. Clear the session and then submit

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

the p1.class was created in test1...yes i did set the cpath

Then post some more information. What error do you get, where are the .java files are and where are the .class files where created as well as how did you set the classpath.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Use javascript for doing whatever validations or client side displaying.
When the user submits, whatever is inside the form that you have, will be sent at the action of the form where you can get it with java

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Where did the p1.class file as created? Did you set the classpath for that package?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Use the String class. Check its API. Try to recognize if it is am or pm. If it is am then the result is the input, if you remove the last 2 characters:
2:00am - input
2:00 - output

If it is pm, then just add 12 at the hour and then you are ok.

1:00pm - input
Find out if it is pm, then take the 1, then add 12 = 13 then print the 13 and the rest:
13:00

You can use the toChar method to convert the String to an array of characters. Then you can determine what is each character with if statements and calculate the result.

And then you can post some code with what you have so far

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Under which directory did you put the .java files as well as the .class files. I mean that for example you should do something like this:

Folder : src/test1
File: p1.java

Folder : src/test2
File: p2.java

-----------
Folder : folder path/comp/test1
File: p1.class

Folder : folder path/comp/test2
File: p2.class

CLASSPATH = folder path/comp

It doesn't have to be exactly like what I mentioned above. But the folders in which the java files are inside must have the name of their package. p1 class that has package test1 must be under a test1 folder.

If you already do that, then you need to provide more information about what you are doing and what error do you get

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

What code do you use to insert other types in the DB? Post the code that you have so far. Do you use Statements, or PreparedStatements?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Buy a book, read a tutorial. How can anyone explain what you ask in a single post. What you ask is for someone to quote pages of books in a single post.

Buy a book, read a tutorial. Write some code, compile it, deploy it. Use an IDE that does that for you. Perhaps NetBeans.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

ajst - sometimes taking more time is useful. All I know is that banging at the keys until a method pops up doesn't seem to produce very good coders, and that's how most beginners seem to approach the IDE.
If I had to guess, I'd suggest that looking up the method, figuring out which one you need, and then typing it into the source file manually forces you to handle it as a mental object, which means it sticks in your head. When I studied cognitive psych years ago, the model presented for memory claimed that an item in short-term memory is discarded unless it is attended to. If attended to, it becomes a candidate for long-term memory - think of a phone number: if you just dial it from a piece of paper, you'll never remember it, but if you recite it to yourself a few times, you're likely to keep it.
If you use auto-fill, you never actually have to pay attention to the methods you use, so you never actually learn them. Take away the auto-fill and you suddenly find you're stuck.

I agree with jon.kiparsky and I will like to add that auto complete only shows you the method. You can never be sure what it does unless you read the documentation. Many times I use auto complete and then I have to go and read the java docs and see the fine details of that method I plan to use.

Many times …

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

whats the diffrence between having auto complete avaible to you and going to sun website and looking at all the avaible methods in that class?

They both achieve the same thing but going to the website will just take a bit longer.

You need to know where to look. Or better yet you need to think where to look.

Not to mention that sometimes IDEs just create whole files with ready templates without any effort from you. If you are a developer that is good. If you are a student it is not, since you need to learn.

An example is when you go and create a GUI swing with NetBeans. It generates tones of confusing code and the "student" doesn't have a clue how the graphics were created. And when they try to customize it, they look at the source code clueless.
When in fact whenever I write my own gui, the code is much more simple and easy to understand

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

First of all NobodySpecial doesn't need to have the unplugDrain, changeBulb methods because it doesn't implement the interfaces. It is not wrong, but the methods are not mandatory.

As far as your question. You can put the main method in whatever class you want.
You can put it in the Human, NobodySpecial, wherever. It will not affect the compilation, nor what your classes do.
The main is used only for you to "tell" java what commands to run. If you put it in the Human, it will not go and run the Human class code.

You create a main method, put code inside it, and when you run that class, ONLY what is inside the main will execute.

public class Human {
	private String name;
	
	public Human(String name){
		this.name = name;
	}
	
	public String getName(){
		return name;
	}
	public String toString(){ 
		return "Human " + getName(); 
		}

	public static void main(String [] args) {
             System.out.println("This is a program");
        }
	
}
class IndustrialPlumber extends Human implements Plumber{
	public IndustrialPlumber(String name){
		super(name);
	}
	
	public String unplugDrain(){
		return "IP: We'll add in to out list";
		
	}

         public static void main(String [] args) {
             System.out.println("This is another program");
        }
}

You can run both classes because they have a main method. When each of them runs, it will execute only the code you put inside the main.

For better design and maintenance we put the main method in a separate class. We don't have to, but it …

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

The format doesn't matter. It is used only for the presentation. As long as you have the date as a Date object there shouldn't be a problem. But if you have the date as a String, then you cannot insert it in the database if the column has Date type.

So what type is the column at the database declared?
What code do you use to insert the date.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

What do you want to build? Where do you want to work?

kvprajapati commented: Thanks Mate! Unique way to report :) +11
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

What exactly are you trying to accomplish? What do you want to build? Because from what I understand you want a software that will create your project for you.
If you want to "develop application software and doing research regularly" then you should be learning the programming language on your own. Having a software that creates your software isn't learning.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Can we see the code of that link?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

hi all,
I'm new to jsp.can any one help me to set URL authentication ?i.e., the user should use the link only by login not by typing in the URL. can anyone plz???

When the user logs in, put the username in the session. Example:

String username = request.getParameter("username");

// do some validations with the username
// if the log in was successful:

session.setAttribute("USERNAME", username);

When the user logs out, remove the username from the session:

session.setAttribute("USERNAME", null);

In every page (jsp file) that you have you can do this:

<%
String username = (String)session.getAttribute("USERNAME");
if (username==null) {
%>
  <script>
      alert("You must login first");
  </script>
  <jsp:forward page="login.jsp" />
<%
}
%>

Be careful. You must put the username in the session only when the log in was successful. If the user has entered correct username and password

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Where this "change" will take place? Where will you be inserting the string? At a console or at a text field at a GUI ?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

anyone please tell me how to find Krishnamurti number in java??

Start a new thread and what is a Krishnamurti number? Do you know and you just want the java code? If not try searching the net for the definition of Krishnamurti number

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

The method should work. I know it may sound stupid, but how did you test it? Did you placed the mouse on the button and let it still for some seconds?

Any way. Here is a link if you are interested and let us know how did you test it.

http://download.oracle.com/javase/tutorial/uiswing/components/tooltip.html

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Dear all,

I have removed mysql-connector-java-5.0.8-bin.jar from the lib directory.
And placed the mysql connector jar in some other directory.

javac -classpath /home/prem/javaprograms/mysql-connector-java-5.0.8-bin.jar testsql.java

When i compile it .There is no errors.

When i run the program by using the below command

java testsql

I get the above errors .Still not getting the result.

Thank you for your reply.

As ~S.O.S~ said, you need to set the classpath when you execute the class file

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

What errors do you get? What is wrong? You give no information as what is not working

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

That is an interesting question. Have tried this:

class R2<E>
{
	E a;
	E get()
	{
		return a;
	}
	void set(E a)
	{
		this.a=a;
	}

        void print() {
            System.out.println(a.getClass());
        }

	public static void main(String aa[])
	{
		R2 nn1=new R2<Integer>();

                nn1.print();
	}
}

Can you tell us if it works and what it prints?