java

jdbc connectivity error

while establishing database connectivity with java application,i tried to run .jar file it showing an error msg "Failed to load main class manifest attribute from c:\program files\sqljdbc_2.0.1803.100_enu\sqljdbc_2.0\enu\sqljdbc4.jar " how i can proceed further? ...

SAXParseException

I have an XML and a dtd as well.Now as such my xml is loaded perfectly and when I add an element test inside the dtd and xml I am getting the following exception. org.xml.sax.SAXParseException: Element type "test" must be declared. at weblogic.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1189) at weblogic...

single quotes and double quotes in mysql insert and update query (java)

The ComName is 'a'b'c'"def"j Limited. i try to add \ before every ' and " but the resultant query that is executed is "UPDATE empTable SET empId= '25', ComName = 'a'b'c'"def"j Limited where ID=1" i don't see my Comname within '' and \ is not present before every ' and " Here is the code to construct the column value columnValue....

JMX confuse(remote server control)

Hi. I have a couple of Tomcat and Glassfish servers. And i want to manage them over JMX. "Use JConsole" - you could say, but this is wrong way because i'm writing Hudson plugin. I need starting point. I need something like JConsole to integrate in my app and then invoke it when needed or... i just want to manage my app remotely via JMX...

Using a boolean variable in while statement

A newbie question. I have the following piece of Java code: import acm.program.*; import java.awt.Color; import acm.graphics.*; public class ufo extends GraphicsProgram{ private GRect ufo_ship; boolean hasNotLost; public void run (){ setup(); //places ufo_ship to initial position hasNotLost = ufo_ship.getY() ...

Change the color of jfreechart piechart.

I want to change the color of the "pieces" of pie in my jfreechart PieChart3D, this is the code that renders the piechart: <% response.setContentType("image/png"); %><%@page import="org.jfree.data.general.*"%><%@page import="org.jfree.chart.*"%><%@page import="org.jfree.chart.plot.*"%><%@page import="java.awt.Color" %><% Defaul...

servlets checking params

So I have a big long query string that can either be ... //url=z&surl=y&time=z&codec=a264&acodec=mp3&width=400x100 or //url=z&surl=y&time=z&optlevel=w Im using request.getQueryString("url") to check if a) the qs is there and b) make sure its not null. This is all leading to a big messy set of if statements. I was just wondering if ther...

Why is exception.getCause() == exception?

I made a mistake when asking this question by thinking that the value of the member variable cause would be returned as the result of a call to getCause() in org.apache.catalina.connector.ClientAbortException. That obviously isn't the case. The real cause is returned. Looking at the source of Throwable I can see that it sets cause = thi...

Hibernate cirteria, integer and like

Hi there, I'm migrating some of my hql-statements to Criterias now I'm figuring one problem: The entity property is type Integer but I need a like with wildcards search, so in hql I do session.createQuery("from P1 where id like :id").setString("id", "%"+s+"%") No problem at all, Hibernate casts String to Integer. If I try this in Cr...

Java: Abstract class constructors and this()

I feel like I'm missing something here; can someone point out what I'm misunderstanding?! I've got two classes, an Abstract and a Concrete, as follows: public abstract class Abstract { protected static int ORDER = 1; public static void main (String[] args) { Concrete c = new Concrete("Hello"); } public Abs...

Concat over '+' operator for string concatenation

String today = someSimpleDateFormat.format(new Date()); Calendar rightNow = Calendar.getInstance(); int hour = rightNow.get(Calendar.HOUR_OF_DAY); int minute = rightNow.get(Calendar.MINUTE); String hourString = String.valueOf(hour); String minuteString = String.valueOf(minute); if(hourString.length() == 1){ hourString = '0'.concat(h...

Getting raw text from JTextPane

In my application, I use a JTextPane to display some log information. As I want to hightlight some specific lines in this text (for example the error messages), I set the contentType as "text/html". This way, I can format my text. Now, I create a JButton that copies the content of this JTextPane into the clipboard. That part is easy, bu...

BigDecimal assign operator

iam having problem with assigning one big decimal value to another so i am trying such as creating one temp big decimal and add 0 to another big decimal BigDecimal temp = new BigDecimal(0); dropStartValue = temp.add(newCounterValue); i only want simply do the operation below on big decimals dropStartValue = newCounterValue ...

JConsole alternative

Hi. Does there exists any JConsole alternative which i could bundle with my app ? ...

how many versions of java are there?

I am little confused about Java frameworks (I am coming from .NET). Do you need different server setups to run Java, J2EE and JSP? Does Java make a distinction in frameworks for enterprise and non-enterprise deployments? Beans? Struts? Can someone make sense of this for me? .NET has: Windows development (Winforms, WPF) web: i) webfo...

Property Editor not registered with the PropertyEditorManager error on Custom Validation Tag (java)

Hello, I am using TomCat 5.5 with MyFaces 1.1 and am trying to implement a custom regex validation tag. My RegExValidator class looks like this: public class RegExValidator implements Validator, StateHolder { private String regex; private boolean transientValue = false; public RegExValidator() { super(); } public RegE...

JTextPane keypress emulation

Hi, I have a JTextPane integration that should perform predefined steps on keypress events. If I type manually it seems to work fine. But I have to emulate keypress events on this integration for test purposes. The test enviroment is such that the given JTextPane is not added to any other controls. I tried to use Robot class, after set ...

What is Jython and is it useful at all?

I know Python. When will I need Jython? What are the drawbacks. I assume it is slow? Please detail it out! thanks. ...

Uploading single files to the Appengine installation

Is it possible to upload single files to the Appengine installation instead of the full project every time. This question is related to the Java version of Appengine. ...

Who here is working with java/jsp as web development can you recommend it ?

Hello all I am now in the process of choosing framework for our web application. I am coming from java/c++ background and built web front ends based on java, but for inner network applications ( not public internet ). I would like to hear what do you think about using java as framework for building web application for the public web...