staneja 0 Junior Poster in Training
staneja 0 Junior Poster in Training
staneja 0 Junior Poster in Training
staneja 0 Junior Poster in Training
You are getting sarcastic !!!!
System.out.println("yes");
will work
Seems like you are following C & C++ approach to write Java program
for (i = 0;i< l;i++ )
{
int temp=num[i];
for (j = i;j<l;j++ )
{
if(num[i]>num[j])
{
num[i]=num[j];
num[j]=temp;
}
}
}
Try this code
I just figured out that your program is reading only word instead of whole line. Can you please try to print content of 'WORD' after
String Word = scan.next();
line.
Thanks
The three different integers are
the 3 different integers are : 13, 27, 14
System.out.println("the 3 different integers are : "+num1+","+num2+","+num3);
In case you are looking for just formatting your output.
Please see the following Code :
HTML FILE
<form action="calculate.jsp">
<input type="Submit" name="Enter" value="see"></input>
<input type="Submit" name="Enter" value="saw"></input>
<input type="Submit" name="Enter" value="seen"></input>
In calculate.jsp
request.getParameter("Enter")
Here it will return the value of Button "Enter" as per the button clicked and you can apply different If ELse loops upon the value of the Enter button
I am creating a simple application using Swings . I am executing search on the database and result i have shown in table.
My first query resulted in 8 rows which was shown clearly.
Now on same frame i changed the search criteria and clicked search button. Now its resulting 3 rows but on Panel still previous result is show.
Can anyone help me on how to update the table. contents.
I have created a new table under the action event of button and added it there.....
Can you please tell me how you solved this issue. Its occurring for me also.
I am running a query , sometime it results in 8 rows and sometime it gives 3 rows.
My first quesry resulted in 8 rows and i am getting 8 rows now but my 2nd query resultd 3 nows , Still i ma able to see 8 rows..
Help me out
Hi , I added the follwing code in my applet and it solved my problem
try{
// Step 1: get a Runtime object
Runtime r = Runtime.getRuntime();
r.gc();
Thread.sleep(1);
}catch(InterruptedException xx){ xx.getMessage(); };
}
I am trying to display an Image using applet. Image is updated after every 4 seconds so i want my applet to show updated image.I am not sure where
i should load the image i have tried to load it in the init() method as well as in "start" method but it didnt workd out for me.Can anybody please help me with this
i am woring on a project that finds the CPU temprature and shows in the graph. I am using applet to disply this.The CPU temp program is running and fter every minute the Image is modifed but when i m displaying the updated image in the applet it fails to load the updated image and shows the previous image to me
I want to execute through appletviewer as i dont want to show putut in web browser
This is the java code i am using for applet
import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
/*
<applet code="applet_image" width=1500 height=550>
</applet>
*/
public class applet_image extends Applet implements Runnable {
boolean base=true;
int i=1;
Image img;
Thread t = null;
public void init(){
setBackground(Color.black);
setForeground(Color.red );
System.out.println("Paint Method called "+i);
}
public void loadImage(){
img=getImage(getDocumentBase(),"null.jpg");
img=getImage(getDocumentBase(),"load-daily.jpg");
}
public void start() {
t = new Thread(this);
t.start();
}
public void run() {
for( ; ; ) {
repaint(150000000l);
}
}
public void paint(Graphics g){
loadImage();
g.drawImage(img,0,0,this);
try{
Thread.sleep(1000L);
}catch(Exception e){}
}
}
I am executing a project that have 100 jar file attached to it
I am able to execute it in Eclipse but i want to run it from batch file but the problem is that i am not able to set class path , whereas in eclipse we can direclty build classpath
so can anybody help m,e how i can include so many files together in classpath
I gave the path of folder as classpath but it didnt work for me
Hi TransKim
Write some code ...get an error and ask us ...we are here for you in that case
But if your teacher ask you to do something and you are simple coming to us to do that.....then we are not here to help you
so come up with some code
You do one thing before craeting a war file you remove Source folder from src directory and let it have only complied classes
In this way when you will paste it in the webapps folder it wont be having SRC folder only classes will be there
Well about the desktop application you need to create GUI from swings or AWT then define events on buttons and you can just called functions used in your webapplicaton
I have one doubt about WAR file........
Like i am creating a project with mysql databse and deploying it through WAR file
My question is if i want to deploy it on some other machine then i am copying war file there in webapps folder.........but do you think it war file will hold tables and DB used for application or i need to make DB there also
Please let me know this
I have one doubt about WAR file........
Like i am creating a project with mysql databse and deploying it through WAR file
My question is if i want to deploy it on some other machine then i am copying war file there in webapps folder.........but do you think it war file will hold tables and DB used for application or i need to make DB there also
Please let me know this
Hi i am making a new user page where user will fill username and password and i want to put some client side validation on it
Suppose user has given wrong values in password and Confirm password column so before a request is send to secnd servlet i want to restrict user with a validation message
I dont want to use Java script i wan to write some code in my Servlet1 only
Can you please tell me if it is possible
Thanks a lot buddy,....it worked for me
Hi All
I am trying to create 2 tables
Table 1 with cust_id , username and password (Cust_id is primary key here)
Table 2 wth cust_info that will store info for that cust........now i want to use this Cust_id as foreign key here in table2 but i am not able to do this
create table tbcustinfo (fname varchar(20),lname varchar(20),mobnum int,address varchar(40),city varchar(10),cust_id INT Not null,FOREIGN KEY(cust_id) RE
FRENCE tblogin(cust_id));
Can you please help me to create this
Thanks
Sumeeet Taneja
I am passing an object of class "String" to hello function and i want to pribt all the chars so i am using foreach loop
My main motive is to use foreach so please help me to type cast it
follwoing is the code i have
int i=0 ;
public void hello( String st)
{
for(int i:collection((String) st))
{
System.out.println(st.charAt(i));
i++;
}
I enjoyed it
Tomcat 5.5.4
Hi Jwenting
Your answer was really not at all helpful to me , First of all i Know Java Language and that's why i am trying to implement this in Java
Secondly i didnt asked for any code i just asked that i am gonna work on it so befor actually starting working on it what shall i brush up in Java...........
Its ok you dont know the ans but i never mean to answer the way you have written
Ok in future if someone ask you abt FIX then just tell him to go throuh JMS
Thanks
Sumit Taneja
Hi All
I want to implement "FIX protocol" The Financial Information eXchange (FIX) protocol using java technology
can any of you please guide me what are the things i need to know in java to implement this. and any further help from where i can get to know more about it or any IDE that can be useful in this direction
Please please do reply if u know anything
thanks & Regards
'
Sumeet Taneja
hi.............I pasted War file in Web-apps and called it from browser
this is error stack
Yes i added web.Xml File with follwoing code
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" >
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>servlet1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>
and it is throwing
Aug 8, 2007 12:31:07 PM org.apache.catalina.startup.ContextConfig applicationConfig
SEVERE: Parse error in application web.xml
java.lang.IllegalArgumentException: Invalid <url-pattern> null in servlet mapping
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
at org.apache.commons.digester.Digester.endElement(Digester.java:1061)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:302)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:644)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:254)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4212)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:850)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:316)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:859)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:653)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1067)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:371)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
at org.apache.catalina.core.StandardHost.backgroundProcess(StandardHost.java:827)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1659)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1668)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1648)
at java.lang.Thread.run(Unknown Source)
Aug 8, 2007 12:31:07 PM org.apache.catalina.startup.ContextConfig applicationConfig
SEVERE: Occurred at line 10 column 19
Aug 8, 2007 12:31:07 PM org.apache.catalina.startup.ContextConfig start
Hi Jweting
Thanks for your wonderful reply , i do agree that ppl may spread virus like this.
The code i have written is absolutely correct , i think web.xml you have already seen.
I have got some clue why this problem is occurring , let me narrow down that .If what i am thinking comes true then i will report a bug in Apache itself.
Thanks
And plpease please dont be so rude
I am attaching a war file that prints hello using servlet
This is code for web.xm
<?xml version="1.0" ?>
- <web-app>
- <servlet>
<servlet-name>hello</servlet-name>
<servlet-class>servlet1</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>
but its throiwng some exception
Hi , i am trying to run Servlet since last 3 days , i have executed servlet so many times with same method but this time its troubling me . This is code of web.,xml
<?xml version="1.0"?>
<web-app>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>servlet1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>
Aug 8, 2007 12:31:07 PM org.apache.catalina.startup.ContextConfig applicationConfig
SEVERE: Parse error in application web.xml
java.lang.IllegalArgumentException: Invalid <url-pattern> null in servlet mapping
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
at org.apache.commons.digester.Digester.endElement(Digester.java:1061)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:302)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:644)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:254)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4212)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:850)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:316)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:859)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:653)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1067)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:371)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
at org.apache.catalina.core.StandardHost.backgroundProcess(StandardHost.java:827)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1659)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1668)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1648)
at java.lang.Thread.run(Unknown Source)
Aug 8, 2007 12:31:07 PM org.apache.catalina.startup.ContextConfig applicationConfig
SEVERE: Occurred at line 10 column 19
Aug 8, 2007 12:31:07 PM org.apache.catalina.startup.ContextConfig start
Yes i added web.Xml File with follwoing code
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" >
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>servlet1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>
and it is throwing
Aug 8, 2007 12:31:07 PM org.apache.catalina.startup.ContextConfig applicationConfig
SEVERE: Parse error in application web.xml
java.lang.IllegalArgumentException: Invalid <url-pattern> null in servlet mapping
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
at org.apache.commons.digester.Digester.endElement(Digester.java:1061)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:302)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:644)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:254)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4212)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:850)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:316)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:859)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:653)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1067)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:371)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
at org.apache.catalina.core.StandardHost.backgroundProcess(StandardHost.java:827)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1659)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1668)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1648)
at java.lang.Thread.run(Unknown Source)
Aug 8, 2007 12:31:07 PM org.apache.catalina.startup.ContextConfig applicationConfig
SEVERE: Occurred at line 10 column 19
Aug 8, 2007 12:31:07 PM org.apache.catalina.startup.ContextConfig start
What should be the encoding format of Web.xml file while saving it form notepad
I ahve created a directory Structure
Sumit -> WEB-INF -> src
-> classes
and i putted Servlet file in src , compiled class file in classes folder and created Web.xml file in WEB-INF folder
after that i craeted a war file ( I am not sure it should be inside WEB-INF or outside ) as see.war using
jar -cvf see.was *.*
then i copied it to Webapps folder of tomcat where it deployed it
Now the thing is something when i am running it using
then it thowing error message
HTTP Status 404 - /see/
message /see/
description The requested resource (/see/) is not available.
Hi..........in general what you can do is .....create one lib folder in your project and copy the driver file for connection in that and set calss path to your lib folder...........
set classpath ....u have to do this stem into system variables
My computer -: properties -: Advanced -:Environment variables
Hi
Yes it has nothing to do JSP but since its part of Core java and it is used for bussiness loin i put it here.
and i modified the code and it worked for me ,,this is modified code -:
public class conn {
Connection con=null;
ResultSet rs=null;
Statement st=null;
public conn()
{
try
{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql:///dbetech","root","");
}
catch (Exception e) {
System.out.println(e);
}
}
}
Hey......... it worked for me...thanks a lot
I am calling this constructor but it is not getting complied
public conn() {
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql:///dbetech", "root" , "");
}
throwing error message:
D:\etech\WEB-INF\src>javac *.java
conn.java:16: incompatible types
found : java.sql.Connection
required: com.mysql.jdbc.Connection
con=DriverManager.getConnection("jdbc:mysql:///dbetech", "root"
, "");
^
1 error
Sorry but i am suing follwoing line to craete connection-:
con=DriverManager.getConnection("jdbc:mysql:///dbetech","root","");
I am trying to create a calss with a constructior that creates connection with MYSql database , i am using database name as dbetch . I have set the path varable but still it id throwing error
package login;
import java.sql.*;
import java.sql.DriverManager;
import com.mysql.jdbc.Connection;
public class conn {
Connection con=null;
ResultSet rs=null;
Statement st=null;
public conn() {
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost/dbetech","root","");
}
}
Error thrown
D:\etech\WEB-INF\src>javac *.java
conn.java:18: incompatible types
found : java.sql.Connection
required: com.mysql.jdbc.Connection
con=DriverManager.getConnection("jdbc:mysql:///dbetech","root","");
1 error
EXE means executable file.
We can save any file as exe and it will be executed also but whatever we have written inside it will be executed
For example if you save a Blank notepad file as "abc.exe" , file will be created but it wont be performing any action because nothing is written in it
Oh........If you can find the frequencey of character than do one thing
Pick the words with even frequency and 1 word with odd frequency
Like i netered word barbara
Now whats frequent of
a=3
b=2
r=2
SO either you make
bab .....rar.....rababar....rbabr
did you getting me or not
hey i think what you can do is you find the frequency of characters in a word
Like ""madam" is having 2 m and 2 "a" and 1"d" so u can make pallindronme for it
Its just a logic that u can think abt...Hope it will help u in 1 way or another
Can you please tell me how to mark it solved.
I didnt find any option to do so
Well i am doing a very simple program that is to calculate the number of occurrance of a character in a string
Hello World
The character H appears 1 times
The character E appaers 2 times
The character L appears 3 times
The character L appears 3 times
The character o appears 2 times
The character W appears 1 times
The character O appears 2 times
The character R appears 1 times
The character L appears 3 times
Here the problem is that for same character L it is printing output line 3 times .......thats not what i want...........tell me a professional approach........I know i can store them in some different array but i want something else
The character L appears 3 times
The character L appears 3 times
The character L appears 3 times
So its your turn to Help me out...........I am doing this one in Java Script but i am looking for login to implemnet not code
Thanks
Sumit Taneja
Well I would like to say thanks
I was getting this error because i forgot to put array brackets after args
I mean instead of String args[] i had written String args
so the problem is solved now
hey it sounds a very interesting question if you are not allowed to use anything apart from two Stack
Tell me ARe we allowed to use temp varaibe here
Be honest Be truthful and be thankful when looking for any help from anyone.
Please do read the Infraction second last reply that gonna help you a lot and will surely teach you a lot .
Just give it a try madam
Hello zhapool
Buddy here people are keen to help you but they want a feel that you are right person to help.Me too have asked so many question and Jwenting happily replied them ,though some of questions seems stupid to me now but he never hesitate to reply me.
So all you need is show some effort............
I was executing a simple core java application using JDK1.5
I wrote code and complied using javac it gave some errors that i fixed and at last it got complied successfully But when i tried to exeute it using java it gave me an error message
Error in thread main.NoSuchMethodFound error:main
Ok now i wanna know why i got this error message , i tried to place the java file in Bin folder and eecute it from there but it didnt worked out.
Can anybody explain me waht to do in such case and how to egt rid of this problem
I need to get information about the time taken by tomcat server to get restarted
and also when i paste some war file inside Webapps folder i dont observe anything on the startup.bbat file............I mean it should register with that file
I think there must be some property file with variable INFO that i need to make True so to get information about starting tomcat server
Can anyone tell me where i am missing
I am trying to acess Bean thorugh JSP using useBean tag ,but its giving me ClassNotfoundExcetption i think i am missing somewhere in structure of JSP program
Can anyone tell me where shall i place this Bean class so it can be read
Currently i have putted it inside WEB-INF ->Classes folder