 |
 |
Index ‹ java-programmer
|
- Previous
- 3
- Action selected state in JDK 1.5Hello all!
Does anyone know of or have a solution of how to have automatic
updates for buttons and menu items created from Action's FOR JDK 1.5?
I know that automatic support for it was added in JDK (1.)6.0, however
the requirements for the software I'm developing is Java 5...
When calling new JMenuItem(Action) or JButton(Action), basically any
radio button or checkbox AbstractButton component, calling setEnabled
an the action turns the button AND menu items to gray. I would simply
like to achieve that for the selected state as well: Whenever the user
clicks on a toolbar button OR menu item, the selected state shall be
reflected in the other GUI component, too. As stated above, a solution
is inside the "too new" JDK6.
So, has anybody implemented a solution for this? Maybe some
AbstractAction subclass?
Any help on this appreciated! (directions etc.)
TIA
Karsten
- 3
- Simple java question...Hi guys,
please help me with this simple java question.
I'm developing a jsf application but i have a java question.
Suppose i have an authentication bean with 3 attributes,login,password
and team that load the values inserted in a login page.
In another bean i have a method that performs inserting an experiment
into a db.
My prepared statement is like...
pst2.setString(1, name);
pst2.setString(2, team);
pst2.setString(3, platform);
etc...
but i want name is the login attribute and team the team attribute of
authenticationBean.
How can i pass these values to my pst.2setString?
Please help me
- 4
- What is a "dirty read" ?Hi group,
I am new to JDBC but have idea about Oracle transaction management. I
am confused about JDBC documentation saying "dirty read"s allow
changes made by a trasaction visible to another before it is
committed. What does this mean ? Does it mean that the concurrent
transaction can be from different connections ? If so how is it
possible ? I believe read dirty reads are reads from dirty blocks
which is accessible only by this session.
TIA
Pramod R
- 4
- Sun buys out MySQLSun bought out opensource MySQL on 2008-02-28.
http://mysql.com/news-and-events/sun/marten_mickos.html
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
- 5
- Database and java.sql.SQLException QuestionsHello everyone!! I am back for some more much need advice and assistance! I
am creating a database for the first time. I am changing some programs I
recently wrote to work with this database that have to do with Salesmen. I
am getting the below error when I compile CreateDatabase.java. In that I am
creating the database SalesDatabase and then creating 5 tables (Users, SType,
Salesman, Sales, Product). The first thing I do is create those tables and
then insert informtion into the SType table and Product table. SType is the
SalesType of a salesman, meaning Entry, Junior or Senior that also has the
bonus in there as another field (.05, .10, .15) and then product has product
1, 2, 3, 4, and 5 with the corresponding price of each. After I do this I
need to read in a text file (SalesInformation.txt) and calculate the sales
based on the information in the database. So here are my questions:
(1) What is the below error telling me, have I not set the database up
correctly?
(2) Am I on the right track with what I have below, should I be reading the
text file as I am or should I change it to be its own method (anything you
tell me would be apprecaited!!)?
(3) Also, other than it not compiling...lol...I am unsure of the salestype
part with element 6 on line 124. I read in ENTRY, JUNIOR or SENIOR from the
salesinformation.txt file so how do I relate that with retrieving the bonus
number from the database?
Ok, I think that is enough questions for now. If anyone needs any additional
information as to what I am trying to do, just let me know and I would be
happy to fill you in!! I appreciate any hints or tips you may be able to
give and I look forward to getting this thing working :)!! Thanks everyone!
Error:
[code]
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not
fou
nd and no default driver specified
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3074)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.
java:3
23)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:193)
at CreateDatabase.main(CreateDatabase.java:31)
[/code]
SalesInformation.txt
[code]
Jones&2&5&3&0&8&SENIOR
Smith&6&0&2&0&5&JUNIOR
Douglas&1&0&7&5&3&ENTRY
Hollins&9&6&3&7&15&ENTRY
Smythe&0&0&0&0&0&SENIOR
Billings&0&7&12&15&2&JUNIOR
Kozak&3&5&8&22&0&ENTRY
[/code]
CreateDatabase:
[code]
import java.io.*;
import java.math.BigDecimal;
import java.sql.*;
import java.util.ArrayList;
import javax.swing.*;
import sun.jdbc.odbc.*;
public class CreateDatabase
{
static String salesmanname;
int salesmanID;
static double saleslevel;
double salesbonus;
static double sales = 0.0;
double productprice;
static String prod1price;
static String prod2price;
static String prod3price;
static String prod4price;
static String prod5price;
public static void main(String args[])
{
String line;
try
{
new JdbcOdbcDriver();
String url = "jdbc:odbc:SalesDatabase";
Connection con = DriverManager.getConnection(url);
Statement stmt = con.createStatement();
stmt.executeUpdate("CREATE TABLE Users (UserName VARCHAR(25)," +
"UserPassword VARCHAR(25))");
stmt.executeUpdate("CREATE TABLE Stype (SalesType VARCHAR(25)," +
"SalesBonus CURRENCY)");
stmt.executeUpdate("CREATE TABLE Salesman (SalesmanName VARCHAR(25)," +
"SalesmanID INTEGER(10), SalesType VARCHAR(25))");
stmt.executeUpdate("CREATE TABLE Sales (SalesmanID INTEGER(10)," +
"TotalSales CURRENCY)");
stmt.executeUpdate("CREATE TABLE Product (ProductNumber INTEGER(1)," +
"ProductPrice VARCHAR(5))");
String insert1 = "INSERT INTO Stype VALUES('Entry', .05)";
String insert2 = "INSERT INTO Stype VALUES('Junior', .10)";
String insert3 = "INSERT INTO Stype VALUES('Senior', .15)";
stmt.executeUpdate(insert1);
stmt.executeUpdate(insert2);
stmt.executeUpdate(insert3);
String insert4 = "INSERT INTO Product VALUES(1, 2.98)";
String insert5 = "INSERT INTO Product VALUES(2, 4.50)";
String insert6 = "INSERT INTO Product VALUES(3, 9.98)";
String insert7 = "INSERT INTO Product VALUES(4, 4.49)";
String insert8 = "INSERT INTO Product VALUES(5, 6.87)";
stmt.executeUpdate(insert4);
stmt.executeUpdate(insert5);
stmt.executeUpdate(insert6);
stmt.executeUpdate(insert7);
stmt.executeUpdate(insert8);
String insert9 = "INSERT INTO Salesman VALUES(" +
salesmanname + "," + "''" + saleslevel +")";
stmt.executeUpdate(insert9);
String insert10 = "INSERT INTO Sales VALUES(" +
sales +")";
stmt.executeUpdate(insert10);
String query1 = "SELECT ProductPrice FROM Product WHERE ProductNumber =
1";
ResultSet rs1 = stmt.executeQuery(query1);
while(rs1.next())
prod1price = rs1.getString("ProductPrice");
String query2 = "SELECT ProductPrice FROM Product WHERE ProductNumber =
2";
ResultSet rs2 = stmt.executeQuery(query2);
while(rs2.next())
prod2price = rs2.getString("ProductPrice");
String query3 = "SELECT ProductPrice FROM Product WHERE ProductNumber =
3";
ResultSet rs3 = stmt.executeQuery(query3);
while(rs3.next())
prod3price = rs3.getString("ProductPrice");
String query4 = "SELECT ProductPrice FROM Product WHERE ProductNumber =
4";
ResultSet rs4 = stmt.executeQuery(query4);
while(rs4.next())
prod4price = rs4.getString("ProductPrice");
String query5 = "SELECT ProductPrice FROM Product WHERE ProductNumber =
5";
ResultSet rs5 = stmt.executeQuery(query5);
while(rs5.next())
prod5price = rs5.getString("ProductPrice");
FileReader file = new FileReader("SalesInformation.txt");
BufferedReader buff = new BufferedReader(file);
while ((line = buff.readLine())!= null)
{
String[] elements = line.split("&");
salesmanname = elements [0];
double sales1 = 0.0;
double sales2 = 0.0;
double sales3 = 0.0;
double sales4 = 0.0;
double sales5 = 0.0;
sales1 = Double.parseDouble(elements[1]) * Double.parseDouble(prod1price)
;
sales2 = Double.parseDouble(elements[2]) * Double.parseDouble(prod2price)
;
sales3 = Double.parseDouble(elements[3]) * Double.parseDouble(prod3price)
;
sales4 = Double.parseDouble(elements[4]) * Double.parseDouble(prod4price)
;
sales5 = Double.parseDouble(elements[5]) * Double.parseDouble(prod5price)
;
saleslevel = (elements[6]); // I am a little unsure of how to use what
is in the database
// and apply it here to calculate the saleslevel for a salesman..?
?
try
{
sales = (sales1 + sales2 + sales3 + sales4 + sales5);
if( sales == 0.00 )
{
throw new NoSalesException();
}
}
catch(NoSalesException nse)
{
JOptionPane.showMessageDialog(null, salesmanname + " has no Sales!!",
"Sales Equals Zero",
JOptionPane.WARNING_MESSAGE);
}
sales = sales + (sales * saleslevel);
}
buff.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
[/code]
--
Message posted via http://www.javakb.com
- 7
- Policy ideas (Was: Re: java2-runtime)Charles Fry <debian <at> frogcircus.org> writes:
>
> Does this mean that bugs should be filed with packages which provide or
> depend on java-runtime (I noticed a few)?
>
> Should bugs be filed with kaffe, which as Peter pointed out does not
> provide any java runtime?
>
> Is there any reason why java1-runtime and java2-runtime are the official
> runtimes, whereas java-compiler and java2-compiler are the official
> compilers? This inconsistency does not seem helpful in establishing
> consistency within the runtimes.
Yeah, I think the policy should be consolidated, since java 1.1 is (for all I
know) not packaged or availiable in Debian. Java-package supports nonfree
runtimes starting from 1.3 and above. I assume that most of the software
packaged in Debian these days will require a pretty modern runtime anyway.
So, I'd suggest that the java(X)-runtime virtuals are removed in favour of a
general "j-word-runtime" virtual to be provided by all runtimes capable of
running programms written in the Java programming language.
I propose using "j-word" instead of "java", because that is a time-honoured way
of abbreviating four letter words that can not be said freely in English.[1]
cheers,
dalibor topic
[1] As Sun Microsystems holds and and actively defends their Java(TM) trade
mark, I would not recommend calling Kaffe a Java(TM) runtime, because, frankly,
according to Sun Microsystem's rules for the usage of the trade mark, it is not
a Java(TM) runtime.
And that's fine by me, I don't feel that trying to rub off Sun's trade mark
investment is a fair thing to do.[2] You can see on the kaffe.org web site how
the Kaffe project tries to draw a clear line between Kaffe and Sun Microsystem's
implementation. In order to avoid confusing people who dearly want the "Java(TM)
Desktop System" GNU/Linux distribution, for example, rather than a free software
runtime environment for programms written in the Java programming language (that
is a safe use of the term "Java", btw. ;).
[2] Just like I don't feel that Sun Microsystems attempts to market some of
their clearly proprietary software as Open Source are a fine thing to do, like
they tried to do with Java3D or JAI. See my comment at
http://weblogs.java.net/blog/editors/archives/2005/02/working_with_th.html for a
reference.
--
To UNSUBSCRIBE, email to email***@***.com
with a subject of "unsubscribe". Trouble? Contact email***@***.com
- 7
- An intranet questionAnybody know how to obtain the information of all the hosts that are in
the same local network as mine? For example, on Windows, how can I get
a list of computers' information in the same workgroup?
Computers in the same intranet has the same IP address prefix (such as
192.168.0.1 through 192.168.0.255). Especially I want to get the list
of those hosts' IP addresses.
Is any class in package java.net able to do this job? Hope I clearly
express my problem. Thanks!
- 10
- HotSpot Virtual Machine unexpected errorOn Fri, Aug 25, 2006 at 12:39:19PM -0600, Blake Bishop wrote:
> When running a particular Java application, I periodically receive this
> error along with a Java core dump:
>
> # Java VM: Java HotSpot(TM) Client VM (diablo-1.5.0_06-b00 mixed mode)
You might want to try updating to 1.5.0_07-b00. If the problem persists
then please post the trace from that. Thanks.
--
Greg Lewis Email : email***@***.com
Eyes Beyond Web : http://www.eyesbeyond.com
Information Technology FreeBSD : email***@***.com
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 10
- How to display a "double" in all its precision???Hello,
Here is a code fragment that is very simple... but I can't get it to
work!
public static void main(String[] args)
{
for (int i = 1; i <= 30 ; i++)
{
double x = Math.pow(2, i);
x = 1 + 1 / x;
System.out.printf("For i = %d: %.40f%n", i, x);
System.out.println(
Long.toBinaryString(Double.doubleToLongBits(x)) );
System.out.println();
}
}
All this code is supposed to do is print out the fractions 1+1/2,
1+1/4, 1+1/8, etc. When one prints out the raw bits (see
doubleToLongBits), the code is clearly working.
But on the regular printf("For i...etc"), at i=17 and above, the
numbers get frozen at 16 digits displayed after the decimal point (the
precision). But it's not really the precision, because the bits ARE
changing correctly. What gives???
Help!
- not a stunningly gorgeous woman who would marry you if you solve this
problem
- 12
- poblem with Java ( XP SP2)Hello!
The one java network application work fine under Windows 2000 and XP
SP1, but don't work under XP SP2.
In the Java Web Start Console i have a follow dump:
=====
Java Web Start Console, started ***
Java 2 Runtime Environment: Version 1.4.2_03 by Sun Microsystems Inc.
AxisFault
faultCode: {http://xml.apache.org/axis/}HTTP
faultSubcode:
faultString: (405)Method not allowed
faultActor:
faultNode:
faultDetail:
{}string: return code: 405
[...]
(405)Method not allowed
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:630)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:128)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
[...]
=====
Does anybody solve such problem ?
ruv
- 12
- Can't avoid "References to generic type List<E> should be parameterized" warning here can I ?Hi,
I'm writing some kind of gateway between 2 packages, whose a
few classes have the same name (I need to bind these classes).
So I'm retrieving the attributes of my source class1 and set my
equivalent class2 in the other pkg with these attributes when
methods names -and attributes- match.
Excerpt from my method:
1 public my.persistent.Pst mapFromProtocol(my.protocol.Pst src)
2 {
3 my.persistent.Pst target = new my.persistent.Pst();
4 for (Iterator<my.protocol.Remark> it =
src.getRemark().iterator(); it.hasNext(); )
5 target.getRemark().add(it.next());
6
7 ... //many other attributes/objects to set too
8
9 return target;
10 }
In RAD the line 5 is underlined in yellow and it says "Type safety:
The method add(Object) belongs to the raw type List. References
to generic type List<E> should be parameterized".
Is there a way to avoid this warning in my case, as I can't
instantiate
a List<Remark> lr = new ArrayList() of course... (because I have no
method setRemark() in target)
Thanks.
Regards,
Seb
- 13
- event in Butoon cancelhi
i want ask about event in actionPerformed method when click button
cancel
how make close frame??
- 14
- Java 1.4.x Applet search directory for JPG filesI am having a hard time finding information about reading a directory and
grabbing the file names that are in it. specifically jpg files. Im not
sure how i want to store the info but first i need to figure out how to
grab the names out of a directory.
thanks for the help
Johnny Bliss
http://www.homemadeturbo.com/
- 15
- mySQLNo you do not have to have access to a UNIX shell to use MySQL. Go to
www.mysql.com, and you can download Windows binaries, and the classes
you need to connect to a MySQL database with Java.
- 15
- setting keys in xmlspyI would like to assign custom key combinations for xml functions. Some
of the combinations are handled by the menu key, such as alt-w will
open the windows menu. I would like to set that to file/save. I would
also like to set alt-x to quit but it opens the XML menu.
so is there any way to change this behaviour? Other development
environments automatically handle these customizations.
thanks for the help
john
|
| Author |
Message |
Bjorn Abelli

|
Posted: 2007-7-17 2:47:00 |
Top |
java-programmer, file-include question..
"maya" <email***@***.com> wrote...
> if I'm in a webapp called "photoblog", for example, if I do
>
> <%@ page errorPage="/errHandler.jsp"%>
>
> it works fine; if I do
>
> <%@ page errorPage="/photoblog/errHandler.jsp"%>
>
> I get an error..
> (this happens both on my personal stuff in Tomcat and my stuff @ work
> on weblogic..)
This is handled by the JSP container, i.e. on the server side.
The path is hence relative to the JSP application.
> within same webapp I have:
>
> <link rel="stylesheet" type="text/css"
> href="/photoblog/css_default.css">
>
> for this one I do need webapp-name in path, otherwise it does not read css
> stylesheet..
css is not JSP includes, but is part of the plain webbrowsing, i.e. handled
from the *client* side.
css is "requested for" by the the browser, i.e. the path is relative to the
visible url.
> can someone enlighten me here?
I hope I have.
/// Bjorn A
|
| |
|
| |
 |
maya

|
Posted: 2007-7-17 3:04:00 |
Top |
java-programmer >> file-include question..
Bjorn Abelli wrote:
> "maya" <email***@***.com> wrote...
>
>> if I'm in a webapp called "photoblog", for example, if I do
>>
>> <%@ page errorPage="/errHandler.jsp"%>
>>
>> it works fine; if I do
>>
>> <%@ page errorPage="/photoblog/errHandler.jsp"%>
>>
>> I get an error..
>> (this happens both on my personal stuff in Tomcat and my stuff @ work
>> on weblogic..)
>
>
> This is handled by the JSP container, i.e. on the server side.
>
> The path is hence relative to the JSP application.
ok, I see.. "relative" meaning it can't be an abs. path starting @ root
of app? I mean a path like /inc/style.css is relative, whereas this
<webapp>/inc/style.css is absolute???
reason all this arose 4 me is that I have a var declared in one include
and it's used in another include used by same pg (but that is called
AFTER the include that contains var-declaration..) and get "can't find
symbol".. and I don't get this....
what I mean:
<%@ include file="/training/top125/past-winners/inc_top.jsp"%> --
var-declaration. var here..
<%@ include file="/training/top125/past-winners/inc_paragr.jsp"%>
<%@ include file="/training/top125/past-winners/inc_pg_nav.jsp"%> use
var here.. (get error on var: can't find symbol)
<%@ include file="/training/top125/past-winners/inc_table_top.jsp"%>
??? :( this is very weird....
thank you very much for your help..
|
| |
|
| |
 |
Bjorn Abelli

|
Posted: 2007-7-17 14:45:00 |
Top |
java-programmer >> file-include question..
"maya" <email***@***.com> wrote...
> Bjorn Abelli wrote:
>> "maya" <email***@***.com> wrote...
>>
>>> if I'm in a webapp called "photoblog", for example, if I do
>>>
>>> <%@ page errorPage="/errHandler.jsp"%>
>>>
>>> it works fine; if I do
>>>
>>> <%@ page errorPage="/photoblog/errHandler.jsp"%>
>>>
>>> I get an error..
>>> (this happens both on my personal stuff in Tomcat and my stuff @ work
>>> on weblogic..)
>>
>>
>> This is handled by the JSP container, i.e. on the server side.
>>
>> The path is hence relative to the JSP application.
>
> ok, I see.. "relative" meaning it can't be an abs. path starting @ root
> of app? I mean a path like /inc/style.css is relative, whereas this
> <webapp>/inc/style.css is absolute???
Both your examples were "relative", but from different contexts.
JSP directives (those starting with "<%@") are dealt with and resolved by
the JSP container, on the server, where the path always is relative to the
JSP-application.
HTML directives (e.g. "<link" when "including" a style sheet) are dealt with
on the client side, which can use both relative and absolute paths. Relative
paths are in this case resolved by the webbrowser at the client side, with a
leading "/" the path starts at the "web root". Absolute paths in this case
starts with "http://"...
> reason all this arose 4 me is that I have a var declared in one include
> and it's used in another include used by same pg (but that is called AFTER
> the include that contains var-declaration..) and get "can't find symbol"..
> and I don't get this....
>
> what I mean:
>
> <%@ include file="/training/top125/past-winners/inc_top.jsp"%> --
> var-declaration. var here..
> <%@ include file="/training/top125/past-winners/inc_paragr.jsp"%>
> <%@ include file="/training/top125/past-winners/inc_pg_nav.jsp"%> use var
> here.. (get error on var: can't find symbol)
> <%@ include file="/training/top125/past-winners/inc_table_top.jsp"%>
This rather sounds like something else, not related to the issue of "file
paths", as it seems that the "includes" themselves worked. The message hence
refer to another error, e.g. that the variable is defined in a way that it
later isn't recognized, like different spellings, scope constraints, etc.
/// Bjorn A
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Skyway Builder Rocks! I'm building J2EE apps without writing code....I've been using this development platform for the past month and I
can't believe how easy it is to build JAVA applications and web
services. This thing is powerful and a huge time saver. I havn't had
to write a single line of code yet. If you havn't tried it, do
yourself a favor and download it..it's FREE.
- 2
- AGLOCO- this worries GoogleHi,
AGLOCO- this worries Google
Bill Gates thinks Google should be worried!
-------------------------------------------
You must have heard by now about Agloco and how many people think it
is going to be bigger than Google... Now Bill Gates is on record
saying they have a great business model and that Google should be
worried.
Google search result produce - 1,400,000 web pages for Agloco.
Google makes billions of $$$ and keeps it all for itself... Agloco
one
day is going to also make billions of $$$ except it will be completely
shared out to its members!
You make money with Agloco by using your computer as you would
normally!
Plus Agloco has a great referral pakage!
So start building your network!
Join AGLOCO - Own the Internet! click on this...
www.agloco.com/r/BBCD7223
It's all over the blogosphere and Bill Gates has been quoted as
saying he believes it "will be the next big thing to hit the
internet", so
what is Agloco and will they really pay you for surfing the net?
I too was sceptical when I heard about it but after spending a few
hours googling and reading about it, I have not only come round to the
idea but am now thinking it could really work and could really make
us (that's me and all of you who are reading this) some money.
regards,
Ketan Arora
www.agloco.com/r/BBCD7223
- 3
- my JEditorPane.read() method is never referenced, why?[code]
public class SimpleHTMLRenderableEditorPane extends JEditorPane {
// borrowed from http://www.java2s.com/Code/Java/Swing-JFC/JEditorPaneandtheSwingHTMLPackage9.htm
protected String getNewCharSet(ChangedCharSetException e) {
String spec = e.getCharSetSpec();
if (e.keyEqualsCharSet()) {
// The event contains the new CharSet
return spec;
}
// The event contains the content type
// plus ";" plus qualifiers which may
// contain a "charset" directive. First
// remove the content type.
int index = spec.indexOf(";");
if (index != -1) {
spec = spec.substring(index + 1);
}
// Force the string to lower case
spec = spec.toLowerCase();
StringTokenizer st = new StringTokenizer(spec, " \t=", true);
boolean foundCharSet = false;
boolean foundEquals = false;
while (st.hasMoreTokens()) {
String token = st.nextToken();
if (token.equals(" ") || token.equals("\t")) {
continue;
}
if (foundCharSet == false && foundEquals == false
&& token.equals("charset")) {
foundCharSet = true;
continue;
} else if (foundEquals == false && token.equals("=")) {
foundEquals = true;
continue;
} else if (foundEquals == true && foundCharSet == true) {
return token;
}
// Not recognized
foundCharSet = false;
foundEquals = false;
}
// No charset found - return a guess
return "8859_1";
}
public void read(InputStream in, Object desc) {
System.out.println("do you see this?");
try {
super.read(in, desc);
} catch (ChangedCharSetException e) {
String charSet = getNewCharSet(e);
System.out.println("charSet = " + charSet);
try {
in.reset();
InputStreamReader reader = new InputStreamReader(in,
charSet);
super.read(reader, desc);
} catch (ChangedCharSetException ee) {
System.out.println("huh?");
} catch (IOException ee) {}
} catch (IOException e2) {}
}
}
[/code]
Per reference in http://kickjava.com/348.htm I am having to overwrite
JEditorPane.read() with my own method, I still get
ChangedCharSetException thrown when it should have been captured and
you should have at least seen something in output, yet you see noting
whatsoever except the ChangedCharSetException when you do this line:
[code]
// browser IS OF TYPE
SimpleHTMLRenderableEditorPane
browser.read(
new BufferedReader(new
StringReader(browser.cleanHTML(getURL()))),
browser.getDocument()
); // SimpleHTMLRenderableEditorPane HAS
METHOD cleanHTML(URL url) WHICH NEVER THROWS ChangedCharSetException
[/code]
Why is it that my method appears to never be referenced and the
default read() method in JEditorPane is referenced instead? Ideas?
Thanks
Phil
- 4
- .Net: 3 Years of the 'Vision' Thingasj wrote:
> Ben wrote:
>>
>> Here here!
>
>
> i believe that's "hear! hear!"
>
> and i ask again:
>
> "really? so where are most of the c#/.net people coming from? what
> with all the questions from vb and other microsoft developers around
> here, sure sounds like a mass migration of the herd from vb and other
> older microsoft tech to c# and other .net.....and that sounds like
> pure cannibalism of old by the new to me."
I think you're clutching at straws here, so what if people using dotnet were
using VB6 or C++ in the past to do development?
- 5
- Why do JARs made with JBuilder 2006 Enterprise not work outside IDE???Hi all,
I have written a program in JBuilder 2006 Enterprise (Win NT, JRE 1.5)
which works perfectly within the IDE.
However, when I use JBuilder to create a JAR of my project and then try
to run in from the command line it throws the run-time exception
below...
Exception in thread "main" java.lang.SecurityException: class
"Com.package.MyPackage.MyExcpetion"'s signer information does not match
signer information of other classes in the same package
I have used JARs before but never come across this sort of error, maybe
worth adding that the program uses JavaMail to send emails.
More confusing, why does it work in JBuilder, but not outside?!?
Any help would be greatly appreciated, i am stumped!
A
- 6
- Tool to draw class relatinoship diagrams from a package ?> Do you know a free package that I could use to draw the
> inheritance/implementation relationships from a package ? Something
> like this: I give it the top dir for a package and it produces a
> diagram.
there is one plugin for Intellij IDEA that do such things.
____________
http://reader.imagero.com the best java image reader.
- 7
- Preventing URLConnection from buffering entire output streamIn my client application, I upload huge files via HTTP.
The URLConnection class seems to automatically buffer
the entire contents, then when the OutputStream associated with
the URLConnection is closed, it computes the length
and prepends a Content-Length header before actually sending
any bytes to the web server.
This results in an OutOfMemoryException when the file is huge.
My application uses Transfer-Encoding: chunked, but
that doesn't help when the entire stream gets buffered anyway.
Is there a way around this without writing my own URLConnection
clone based on Sockets? Calling flush() on the OutputStream
seems to have no effect.
I understand that a workaround would be to use the new features
of Java 1.5, but that's too new to expect end users to have.
Any help would be appreciated.
Thanks!
Mark Riordan
Note: email address in header, email***@***.com, must have
"NoSpam" removed.
- 8
- 9
- rs-232Anyone know how to echo characters over an rs-232 serial interface? Thanks.
-Sean M. Tucker
- 10
- j2ee request resource is not available hello1Hi all,
I have found a solution to a problem that I would like to share.
I am running WindowsXP and J2EE sdk 1.3.1.
I was trying to run the Hello1 servlet example from the J2EE examples
from sun. I found this error message: j2ee request resource is not
available
Then I solved this problem by opening the application in deploytool:
Filling in the following fields:
Hello1App: WebContext-> WAR File = Hello1WAR; ContextRoot = hello1
GreetingServlet -> aliases = /greeting
ResponseServlet -> aliases = /response
This solved the problem and it was running fine.
Hope it helps,
Satyajit
- 11
- hasNext?What is hasNext? I know you use it when you are reading from a file
and it will stop when it has nothing more to read, but how would you
use it? I have seen a couple of different examples of it, but all
they do is make me more confused. I just can't seem to understand
it...can anyone help?
- 12
- Can't locate JavaxHi,
I am using DrJava, and I am writing a program that has the following
statement:
import javax.swing;
It gives me this error when compiled:
File: C:\Program Files\DrJava\CustomJFrame.java [line: 1]
Error: package javax does not exist
I did set my classpath variable to:
c:\j2sdk1.4.2\lib\tools.jar;C:\j2sdk1.4.2_01\src\javax
where C:\j2sdk1.4.2_01\src\javax is where javax is located.
What am I doing wrong?
- 13
- "no cmp field defined in cmp ejb"I'm so boring I know... this is my problem...
I wrote the following entity bean, it rappresents something like this:
primary key id (managed by the container)
foreign key formulation_product (cmp relationship field)
foreign key ingredient (cmp relationship field)
public abstract class FormulationComponentBean implements EntityBean {
/* Relationship field getters */
public abstract FormulationProduct getFormulationProduct();
public abstract Ingredient getIngredient();
/* Relationship field setters */
public abstract void setFormulationProduct(FormulationProduct product);
public abstract void setIngredient(Ingredient ingredient);
[...create methods and others ejb* methods...]
}
When I try to autogenerate database table with Sun Deploytool I get this
error message: "no cmp field defined in cmp ejb".
I really do not need any persistent field, but only relationship field...
should I insert a fake persisten field just to satisfy that silly utility?
Or I am wrong on something?
Thanks a lot for any help...
- 14
- Websphere session persistence gets "protocol violation" using oracle jdbc driverHi,
We use oracle (8.1.7) as the session persistence database for our
websphere 3.5.4 application server. After 15 min of running a stress
test, we get the foll. exception. Any idea whats going wrong?
thanks,
Chinmay
java.sql.SQLException: Protocol
violation
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.<init>(Throwable.java:94)
at java.lang.Exception.<init>(Exception.java:42)
at java.sql.SQLException.<init>(SQLException.java:43)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:803)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:549)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1311)
at oracle.jdbc.ttc7.TTC7Protocol.executeFetch(TTC7Protocol.java:661)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1320)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1232)
at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch(OracleStatement.java:1353)
at oracle.jdbc.driver.OracleStatement.doExecute(OracleStatement.java:1760)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1805)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:320)
at com.ibm.ejs.cm.cache.CachedStatement.executeUpdate(CachedStatement.java:314)
at com.ibm.ejs.cm.proxy.PreparedStatementProxy.executeUpdate(PreparedStatementProxy.java:235)
at com.ibm.servlet.personalization.sessiontracking.BackedHashtable.ejbStore(BackedHashtable.java:2564)
at com.ibm.servlet.personalization.sessiontracking.BackedHashtable.storeSession(BackedHashtable.java:2272)
at com.ibm.servlet.personalization.sessiontracking.BackedHashtable.put(BackedHashtable.java:2958)
at com.ibm.servlet.personalization.sessiontracking.DatabaseSessionContext.sync(DatabaseSessionContext.java:112)
at com.ibm.servlet.personalization.sessiontracking.SessionData.releaseSession(SessionData.java:260)
at com.ibm.servlet.engine.srt.SRTSessionAPISupport.finish(SRTSessionAPISupport.java:190)
at com.ibm.servlet.engine.srt.SRTConnectionContext.finishConnection(SRTConnectionContext.java:103)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:102)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:106)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:160)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:300)
We also get another exception below the above one in the trace log:
StatementProx E Exception closing statement
com.ibm.ejs.cm.exception.IllegalConnectionUseException: Error:
Connection is being used in a way that violates the architecture
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.<init>(Throwable.java:94)
at java.lang.Exception.<init>(Exception.java:42)
at java.sql.SQLException.<init>(SQLException.java:82)
at com.ibm.ejs.cm.portability.PortableSQLException.<init>(PortableSQLException.java:35)
at com.ibm.ejs.cm.exception.IllegalConnectionUseException.<init>(IllegalConnectionUseException.java:26)
at com.ibm.ejs.cm.proxy.Proxy.close(Proxy.java:154)
at com.ibm.ejs.cm.proxy.StatementProxy.__close(StatementProxy.java:61)
at com.ibm.ejs.cm.proxy.StatementProxy.close(StatementProxy.java:216)
at com.ibm.ejs.cm.proxy.Proxy.close(Proxy.java:76)
at com.ibm.ejs.cm.proxy.ConnectionProxy.close(ConnectionProxy.java:645)
at com.ibm.ejs.cm.proxy.ConnectionProxy.connectionDestroyed(ConnectionProxy.java:97)
at com.ibm.ejs.cm.pool.ConnectO.fireConnectionDestroyed(ConnectO.java:1500)
at com.ibm.ejs.cm.pool.ConnectO.destroy(ConnectO.java:741)
at com.ibm.ejs.cm.pool.ConnectO.translateException(ConnectO.java:1134)
at com.ibm.ejs.cm.proxy.ConnectionProxy.translateException(ConnectionProxy.java:177)
at com.ibm.ejs.cm.proxy.PreparedStatementProxy.translateException(PreparedStatementProxy.java:484)
at com.ibm.ejs.cm.proxy.PreparedStatementProxy.executeUpdate(PreparedStatementProxy.java:238)
at com.ibm.servlet.personalization.sessiontracking.BackedHashtable.ejbStore(BackedHashtable.java:2564)
at com.ibm.servlet.personalization.sessiontracking.BackedHashtable.storeSession(BackedHashtable.java:2272)
at com.ibm.servlet.personalization.sessiontracking.BackedHashtable.put(BackedHashtable.java:2958)
at com.ibm.servlet.personalization.sessiontracking.DatabaseSessionContext.sync(DatabaseSessionContext.java:112)
at com.ibm.servlet.personalization.sessiontracking.SessionData.releaseSession(SessionData.java:260)
at com.ibm.servlet.engine.srt.SRTSessionAPISupport.finish(SRTSessionAPISupport.java:190)
at com.ibm.servlet.engine.srt.SRTConnectionContext.finishConnection(SRTConnectionContext.java:103)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:102)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:106)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:160)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:300)
- 15
- Equivalent items in JavaI know a bit in Windows (.net) development. I would like to find out
the equivalent component of the below components. Anyone has
suggestions?
ASP -->
VB.NET, C# -->
MS SQL -->
IIS -->
NT server -->
THX a lot!
|
|
|