| java sockets passing objects |
|
 |
Index ‹ java-programmer
|
- Previous
- 3
- DDOS Attacks Coming From www.schestowitz.comEver since I visited www.schestowitz.com I have been getting nmaped,
probed, pinged and now DDOS's with floods of requests from an ip
address that resolves to a block assigned to www.schestowitz.com.
I have reported this to my ISP who is now blocking the range from my
trunk.
They in turn have filed a complaint with Catalyst (?) who hosts the
site.
Is anyone else experiencing this kind of a problem or am I the chosen
one?
- 3
- What are Good Java books?Hi there,
I'd like to buy one or two Java 2 SE books as
text and reference. I need books with good
examples, exercises, projects and solution.
Yes, I know that there are a lot of good
books in the market, but I don't have time to
compare them.
I already have experience in C and C++
programming and a little bit of Java.
Please reply to the group. Thanks a lot.
Jim
- 3
- Question about try, catchHow do I make the code go back so that once user type more than 20
characters in the string, it will print a message and then continue to
process more strings?
Here is the code:
//StringTooLongExceptionDriver
import java.util.Scanner;
import java.io.*;
public class StringTooLongExceptionDriver
{
//
// The main method prompts and reads strings. If the string has more
// than 20 characters, it throws a StringTooLongException exception.
//
public static void main(String[] args){
//System.out.println("Enter a string: ");
String strInput = "";
int newStringCounter;
int arrayCounter=0;
char[] myCharArray = new char[20];
InputStreamReader myRead = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(myRead);
try{
while (!(strInput.equals("DONE"))){
System.out.println("enter your string: ");
int x = 0;
strInput = in.readLine();
newStringCounter = strInput.length();
if (!(strInput.equals("DONE"))){
while (newStringCounter > 0){
myCharArray[arrayCounter] = strInput.charAt(x);
newStringCounter--;
System.out.print("the last char at array is " +
myCharArray[arrayCounter]);
System.out.println(" and array counter is " + arrayCounter);
x++;
arrayCounter++;
}
}
}
if (strInput.equals("DONE")){
System.out.print("you have enterd: ");
for (int i=0; i<=arrayCounter-1; i++){
System.out.print(myCharArray[i]);
}
System.out.println("");
System.out.println("End of the string you have enterd!");
}
}
catch(Exception e){
StringTooLongException error = new StringTooLongException("Total
string character now is larger than 20 characters");
error.EndHere();
}
}
}
class StringTooLongException
{
String statement = "";
public StringTooLongException(String myError){
statement = myError;
System.out.println(statement);
}
public void EndHere(){
System.out.println("please try again");
System.exit(0);
}
}
- 5
- Anyone want a copy of JBuilder X Enterprise ?Hi
I'm a programmer and have an extra copy of Borland Enterprise Studio
for Mobile v2.5 and am looking to sell it. I got it at a great price
and am selling it at a great price on eBay (starting today.)
http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&category=46325&item=3691142652
If you're not interested, please let your friends or coworkers know
about it -- the auction ends in 7 days. Only have this one.
If you have any questions please feel free to email me,
Jason
email***@***.com
Network Engineer and Programmer
- 7
- Square rootWhat is the method of finding the square root of a number?
- 7
- Remove "Padding" from GridLayout/ButtonsI have a 10x10 grid of buttons created using a GridLayout. Each button has a
30x30 pixel GIF icon on it.
Unfortunately, nomatter what I try, I can't seem to get each icon to sit
side by side (so that there's no gap between them). Currently there's an
approximately 5 pixel gap between each GIF image.
So far I've tried:
grid_button.setSize(new Dimension(30, 30)); // to set each button to 30x30
_board_panel.setSize(new Dimension(30*y_size, 300*x_size)); // sets grid
board to 30 times the number of grids in each dimension
... but neither seems to work.
How do I get it so that there's no gap between each GIF? I need the size of
each square in the grid to be fixed to exactly 30x30, not relative to the
size of it's holding panel.
TIA.
- 9
- Tomcat 5.5.7 and Axis 1.0 problemI'm using Tomcat 5.5.7 and deployed Axis 1.0 samples on it. (using JDK
1.5.0_01)
happyaxis.jsp is happy! and finds all required libraries (but not
optionals!)
the list of services is shown correctly (has 2 servies, AdminService
and getVersion)
but when I click on call a local end point the result is:
<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server.userException</faultcode>
<faultstring>java.lang.NullPointerException</faultstring>
<detail />
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
I'm not sure, but I think the problem may be because of the new Compile
mechanism Tomcat 5.5.x uses (depending on JRE not JDK).
How can I recover from this problem?
regards
Amir
- 9
- How can I know which button is clicked in JDialog ShowModalHi, all,
In a programme using swing (homework), I use a JDialog window. There are
two buttons on this dialog window. I want to write the program in this way:
// some thing
JDialog d = new ...
...
d.setModal(true);
d.show();
if (d.close = btnOk){
...
} else if (d.close == btnCancel){
...
}
In fact I want to use this way like in the windows programming:
int i = d.showModal();
if (i == ok){
...
} else if ( i == cancel){
...
}
Please help me. I am a newbie in swing programming.
Thanks a lot.
- 9
- Thread Contructor QuestionHi All,
I'm curious about something. In a Java certification study guide,
they have the following code and they ask what the result is:
class MyThread extends Thread
{
public static void main(String [] args)
{
MyThread t = new MyThread();
Thread x = new Thread(t);
x.start();
}
public void run()
{
for (int i = 0; i < 3; ++i)
{
System.out.print(i + "..");
}
}
}
It's simple enough. Except, earlier in the text (and in the Java API)
they mention that the only constructors for the Thread class are:
Thread()
Thread(Runnable target)
Thread(Runnable target, String name)
Thread(String name)
Thread(ThreadGroup group, Runnable target)
Thread(ThreadGroup group, Runnable target, String name)
Thread(ThreadGroup group, Runnable target, String name, long
stackSize)
Thread(ThreadGroup group, String name)
I don't see Thread(Thread). And I don't see how it can be a Runnable
except for that they share the same method: run().
- 9
- 9
- sun.security.acl questionWhen using the sun.security.adl implementations of acl, aclentry and
permission, is the permission name allowed to have spaces in it? The
examples all use one-word names like "read", "write", etc. I want to
use something like "realtime administrator". Will that work?
d
--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).
- 11
- OMLETv4: The Ultimate Oracle Monitoring Software"omlet" <email***@***.com> wrote in message news:<email***@***.com>...
> Dear DBA,
>
> You are cordially invited to test and review our windows native and
> 100% pure Java Oracle 9i/8i Monitoring Application (OMLET). OMLET is
> the Ultimate Visual Real Time Oracle Monitoring Tool. As the
> leading expert in your field, your objective opinion is highly valued
> and your feedback is very appreciated. We would like to encourage you
> to distribute free copies of OMLET to your associates and fellow DBAs.
>
> Omlet can be downloaded from:
>
> http://www.omlet.org/download.html
>
> or any of many mirrors worldwide:
>
> http://www.geocities.com/teraknowledgesystems/download.html
>
> http://www.iboogie.com/search.asp?name_search_type=1&name_lang=50&name_query=omlet+oracle
>
> Thank you for your time, positive feedback.
>
> Cheers,
>
> The OMLET Team
> Tera Knowledge Systems, Inc.
>
> PS. If you feel that this is spam and you read this by mistake, we
> apologize, ignore it and have a nice day.
>
- 13
- JDK1.3.1 AbstractMethodErrorHi Frederick,
> I am trying to use my FreeBSD file server as a build machine as well. So
> I loaded on the JDK1.3.1-p8, JBoss 3.0.2, AntHill-1.6.3.67, Ant 1.5.3-1,
> XDoclet 1.2b3, Hibernate 2.0, etc on my FreeBSD 4.8 stable box. It is a
You did not install these via ports, did you? I can't find a port for
AntHill, but it does look very interesting!
Ernst
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 16
- 16
- [UPD] SQLeonardo MMV.III released[http://querybuilder.sourceforge.net]
SQLeonardo is a database query tool written in Java, distributed under
the GNU GENERAL PUBLIC LICENSE.
Include FreeQueryBuilder to create SQL queries without directly writing
SQL. All queries can be saved in a workspace for later use. Works
with any JDBC compliant database(ORACLE,MySQL,HSQLDB,Firebird,DB2)
*** NEW ***
Edit tables directly via the data grid
Regards Nickyb
|
| Author |
Message |
crunchyfishstix

|
Posted: 2004-4-27 2:44:00 |
Top |
java-programmer, java sockets passing objects
I have a very simple java application in which I need to pass an
object via sockets. It is an object that I have defined, which has
implemented Serializable. The problem occurs when I send an instance
of the object, when I recieve it on the other end, it is null. The
reciever does in fact recieve an object of the correct type (my user
defined object) but it is empty although the one I sent was not. Is
there something I need to do in the readObject() or writeObject()
methods? Any help would be appreciated, thank you!
For reference, here is my user defined object:
class nodeMessage implements Serializable
{
String text;
int messageID;
int senderID;
int recieverID;
String[] stamp;
public nodeMessage(){}
public nodeMessage(String t, int mID, int sID, int rID,
String[] s)
{
text = t;
messageID = mID;
senderID = sID;
recieverID = rID;
stamp = s;
}
public String getText()
{
return text;
}
public int getMID()
{
return messageID;
}
public int getSID()
{
return senderID;
}
public int getRID()
{
return recieverID;
}
public String[] getStamp()
{
return stamp;
}
public void addStamp(String s)
{
stamp[stamp.length] = s;
}
private void writeObject(java.io.ObjectOutputStream out)
throws IOException{
}
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException{
}
}
|
| |
|
| |
 |
Christophe Vanfleteren

|
Posted: 2004-4-27 2:50:00 |
Top |
java-programmer >> java sockets passing objects
Patrick wrote:
> I have a very simple java application in which I need to pass an
> object via sockets. It is an object that I have defined, which has
> implemented Serializable. The problem occurs when I send an instance
> of the object, when I recieve it on the other end, it is null. The
> reciever does in fact recieve an object of the correct type (my user
> defined object) but it is empty although the one I sent was not. Is
> there something I need to do in the readObject() or writeObject()
> methods? Any help would be appreciated, thank you!
>
> For reference, here is my user defined object:
>
> class nodeMessage implements Serializable
> {
<snip code>
>
> private void writeObject(java.io.ObjectOutputStream out)
> throws IOException{
> }
> private void readObject(java.io.ObjectInputStream in)
> throws IOException, ClassNotFoundException{
> }
> }
Just don't put the writeObject/readObject methods in your class unless you
actually do something in them. The default of just implementing
Serializable should work just fine. As it stands now, you don't write your
object to the stream, and you don't read it back in.
--
Kind regards,
Christophe Vanfleteren
|
| |
|
| |
 |
crunchyfishstix

|
Posted: 2004-4-27 11:33:00 |
Top |
java-programmer >> java sockets passing objects
Roedy Green <email***@***.com> wrote in message news:<email***@***.com>...
> On Mon, 26 Apr 2004 18:49:54 GMT, Christophe Vanfleteren
> <email***@***.com> wrote or quoted :
>
> >Just don't put the writeObject/readObject methods in your class unless you
> >actually do something in them. The default of just implementing
> >Serializable should work just fine. As it stands now, you don't write your
> >object to the stream, and you don't read it back in.
>
> If you do have a read/writeObject they should call defaultReadObject
> and writeReadObject and do whatever touch up for the transient fields
> are necessary.
>
I tried using the defaultRead/WriteObject, when I used those I got a
NotSerializable Exception.
|
| |
|
| |
 |
crunchyfishstix

|
Posted: 2004-4-27 11:34:00 |
Top |
java-programmer >> java sockets passing objects
>
> >
> > private void writeObject(java.io.ObjectOutputStream out)
> > throws IOException{
> > }
> > private void readObject(java.io.ObjectInputStream in)
> > throws IOException, ClassNotFoundException{
> > }
> > }
>
> Just don't put the writeObject/readObject methods in your class unless you
> actually do something in them. The default of just implementing
> Serializable should work just fine. As it stands now, you don't write your
> object to the stream, and you don't read it back in.
I tried it without putting those functions in, and it gave me a
NotSerializable Exception.
~patrick
|
| |
|
| |
 |
crunchyfishstix

|
Posted: 2004-4-28 2:22:00 |
Top |
java-programmer >> java sockets passing objects
Roedy Green <email***@***.com> wrote in message news:<email***@***.com>...
> On 26 Apr 2004 20:33:01 -0700, email***@***.com (Patrick)
> wrote or quoted :
>
> >I tried using the defaultRead/WriteObject, when I used those I got a
> >NotSerializable Exception.
>
>
> Have you read http://mindprod.com/jgloss/serialization.html yet.
>
> I am not going to continue answering questions that are answered
> there.
Yes, I did read that, however I couldn't seem to find the answer to my
problem. It states on that site the you DO NOT need to write the
readObject and writeObject methods, however, if I do not include
those, for some reason I get the NotSerializableException when trying
to both write and read. Everywhere I've looked, it states that all I
need to do to make an object serializable is to implement the
interface, but I get that exception when I only do that. If I DO put
those methods in, leaving them empty I can send and recieve the
object, but everything is null or 0 when I recieve it. My only members
are Strings, ints, and a String array, unless these are inheritly
transient for some reason, they should be restored, but they aren't. I
thank you for your help, and the link you sent me was very
informative, however I couldn't find the reasoning for my problems
within it unless I'm missing something subtle.
|
| |
|
| |
 |
Chris Smith

|
Posted: 2004-4-28 5:45:00 |
Top |
java-programmer >> java sockets passing objects
Patrick wrote:
> It states on that site the you DO NOT need to write the
> readObject and writeObject methods, however, if I do not include
> those, for some reason I get the NotSerializableException when trying
> to both write and read.
There's no explanation for this. If I take your original code and
remove the writeObject and readObject methods, and then try to serialize
it, it works fine. So, we need to figure out what you're doing
differently. Please let us know:
1. The exact source code that you are running to produce this problem.
2. The compiler and version.
3. The virtual machine and version.
> If I DO put those methods in, leaving them empty I can send and recieve
> the object, but everything is null or 0 when I recieve it.
If you do put this methods in, then you're overriding the default
serialization. If you do that, then you need to write code in those
methods, or else you've overridden serialization to become non-
functional. There's not even a chance that'll work; so let's stay
focused on something that should be working, and solve that problem.
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
|
| |
|
| |
 |
Andrew Thompson

|
Posted: 2004-4-28 10:15:00 |
Top |
java-programmer >> java sockets passing objects
On Tue, 27 Apr 2004 15:45:16 -0600, Chris Smith wrote:
> 1. The exact source code that you are running to produce this problem.
<http://www.physci.org/codes/sscce.jsp>
> 2. The compiler and version.
(whispers) How do you get
the compiler version?
> 3. The virtual machine and version.
<http://www.physci.org/eg/dos.jsp?text=%0D%0AC%3A%5C%3Ejava+-version%0D%0A%0D%0A>
--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
|
| |
|
| |
 |
Sudsy

|
Posted: 2004-4-28 12:23:00 |
Top |
java-programmer >> java sockets passing objects
Chris Smith wrote:
> Patrick wrote:
>
>>It states on that site the you DO NOT need to write the
>>readObject and writeObject methods, however, if I do not include
>>those, for some reason I get the NotSerializableException when trying
>>to both write and read.
>
>
> There's no explanation for this. If I take your original code and
> remove the writeObject and readObject methods, and then try to serialize
> it, it works fine. So, we need to figure out what you're doing
> differently. Please let us know:
Like Chris, I also did a bit of cut-and-paste since the code is so
standard that I couldn't believe that it wasn't working. This code
works exactly as expected:
import java.io.*;
public class NodeTest {
private static final String FILENAME = "/tmp/junkfile";
public static void main( String args[] ) {
nodeMessage app = new nodeMessage();
ObjectOutputStream oos = null;
ObjectInputStream ois = null;
try {
app.setText( "testing" );
oos = new ObjectOutputStream(
new FileOutputStream( FILENAME ) );
oos.writeObject( app );
oos.close();
ois = new ObjectInputStream(
new FileInputStream( FILENAME ) );
app = (nodeMessage) ois.readObject();
ois.close();
System.out.println( app.getText() );
}
catch( Exception e ) {
e.printStackTrace();
System.exit( 12 );
}
}
}
class nodeMessage implements Serializable
{
String text;
int messageID;
int senderID;
int recieverID;
String[] stamp;
public nodeMessage(){}
public nodeMessage(String t, int mID, int sID, int rID,
String[] s)
{
text = t;
messageID = mID;
senderID = sID;
recieverID = rID;
stamp = s;
}
// I added this method for testing with the no-argument
// constructor (see main method)
public void setText( String s ) {
this.text = s;
}
public String getText()
{
return text;
}
public int getMID()
{
return messageID;
}
public int getSID()
{
return senderID;
}
public int getRID()
{
return recieverID;
}
public String[] getStamp()
{
return stamp;
}
public void addStamp(String s)
{
stamp[stamp.length] = s;
}
/*
private void writeObject(java.io.ObjectOutputStream out)
throws IOException{
}
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException{
}
*/
}
So what's the problem? Cut and paste this code, replace FILENAME with
something appropriate to your platform and post the results.
|
| |
|
| |
 |
crunchyfishstix

|
Posted: 2004-4-28 14:01:00 |
Top |
java-programmer >> java sockets passing objects
Chris Smith <email***@***.com> wrote in message news:<email***@***.com>...
> There's no explanation for this. If I take your original code and
> remove the writeObject and readObject methods, and then try to serialize
> it, it works fine. So, we need to figure out what you're doing
> differently. Please let us know:
>
> 1. The exact source code that you are running to produce this problem.
> 2. The compiler and version.
> 3. The virtual machine and version.
>
> > If I DO put those methods in, leaving them empty I can send and recieve
> > the object, but everything is null or 0 when I recieve it.
>
> If you do put this methods in, then you're overriding the default
> serialization. If you do that, then you need to write code in those
> methods, or else you've overridden serialization to become non-
> functional. There's not even a chance that'll work; so let's stay
> focused on something that should be working, and solve that problem.
Thank you all for your help, but I have found the problem. I had
written my message class as an interior class of the class that was
trying to use it since the message class itself wasn't very large.
This is what was causing the problem, since the class it was contained
in was itself not serializable. Once I created the message object in
its own file, it worked fine. Thinking about it now, it seems obvious,
however, at the time (and since this is my first time using/creating
serializable objects) it never occured to me. And to the gentleman who
was giving me links to his essays, that may be a small and subtle
caveat you may want to add, though I'm not sure if writing interior
classes is 'proper' or done by many, it may just be my coding style.
Thank you again for all of your time and help!
!patrick
|
| |
|
| |
 |
Christophe Vanfleteren

|
Posted: 2004-4-28 15:07:00 |
Top |
java-programmer >> java sockets passing objects
Andrew Thompson wrote:
> On Tue, 27 Apr 2004 15:45:16 -0600, Chris Smith wrote:
>
>> 1. The exact source code that you are running to produce this problem.
>
> <http://www.physci.org/codes/sscce.jsp>
>
>> 2. The compiler and version.
>
> (whispers) How do you get
> the compiler version?
javac -version
>
>> 3. The virtual machine and version.
>
>
<http://www.physci.org/eg/dos.jsp?text=%0D%0AC%3A%5C%3Ejava+-version%0D%0A%0D%0A>
>
--
Kind regards,
Christophe Vanfleteren
|
| |
|
| |
 |
Andrew Thompson

|
Posted: 2004-4-28 18:39:00 |
Top |
java-programmer >> java sockets passing objects
On Wed, 28 Apr 2004 07:07:10 GMT, Christophe Vanfleteren wrote:
(C.S.)
>>> 2. The compiler and version.
>>
>> (whispers) How do you get
>> the compiler version?
>
> javac -version
Under Java 1.4.2 on XP that reports..
<http://www.physci.org/eg/dos.jsp?text=C%3A%5C%3Ejavac+-version%0D%0Ajavac%3A+invalid+flag%3A+-version%0D%0A>
Are you sure that javac
reports a version at all?
--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
|
| |
|
| |
 |
Christophe Vanfleteren

|
Posted: 2004-4-28 18:44:00 |
Top |
java-programmer >> java sockets passing objects
Andrew Thompson wrote:
> On Wed, 28 Apr 2004 07:07:10 GMT, Christophe Vanfleteren wrote:
>
> (C.S.)
>>>> 2. The compiler and version.
>>>
>>> (whispers) How do you get
>>> the compiler version?
>>
>> javac -version
>
> Under Java 1.4.2 on XP that reports..
>
<http://www.physci.org/eg/dos.jsp?text=C%3A%5C%3Ejavac+-version%0D%0Ajavac%3A+invalid+flag%3A+-version%0D%0A>
>
> Are you sure that javac
> reports a version at all?
>
You are correct, I get the same result with 1.4.2 on Linux.
But the 1.5 beta javac does recognise the version flag:
cxvx@luke cxvx $ javac -version
javac 1.5.0-beta
...
--
Kind regards,
Christophe Vanfleteren
|
| |
|
| |
 |
Andrew Thompson

|
Posted: 2004-4-28 18:54:00 |
Top |
java-programmer >> java sockets passing objects
On Wed, 28 Apr 2004 10:43:56 GMT, Christophe Vanfleteren wrote:
> Andrew Thompson wrote:
>> On Wed, 28 Apr 2004 07:07:10 GMT, Christophe Vanfleteren wrote:
>> (C.S.)
>>>>> 2. The compiler and version.
...
>>> javac -version
...
>> Are you sure that javac
>> reports a version at all?
...
> You are correct, I get the same result with 1.4.2 on Linux.
> But the 1.5 beta javac does recognise the version flag:
Aah! I had installed the 1.5 JRE (just
to grab the rt.jar) but have not bothered
to download the SDK yet.
[ "The *marvels* of modern technology!
Getting the version straight from
javac, who would've figured..." ;-) ]
--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
|
| |
|
| |
 |
Chris Smith

|
Posted: 2004-4-28 21:16:00 |
Top |
java-programmer >> java sockets passing objects
Patrick wrote:
> Thank you all for your help, but I have found the problem. I had
> written my message class as an interior class of the class that was
> trying to use it since the message class itself wasn't very large.
Ah, okay. Yes, an inner class would do that. On the other hand, a
static nested class won't have the same problem. So if you still want
your message class declared inside a containing class, just add
'static' to its declaration.
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Dumb question: How do I get an object's parent?Hi,
I know it's a dumb question but then I'm newbie, so sorry about
that.
class MyObject {
anotherClass innerObject;
}
.
.
.
MyObject myObject = new MyObject();
.
.
.
What I want to do is how, knowing innerObject, do I get a reference
to the myObject instance that contains it? Is it possible?
Bye and thanks.
El Guerrero del Interfaz
- 2
- How to get the contextPath in a servlet's init-method?Hi,
is there a way to get the context path inside the servlet's init-method?
In an URL like http://localhost/myApp/... i want to get the Attribute
/myApp.
I know, I can get ist with HttpServletRequest#getContextPath(), but in the
init method I don't have a servletRequest.
Is there another way to get it that also works with different Java
Containers?
..
bye Stephan...
- 3
- Can't allocate large char array in JNIHi there!
I'm trying to allocate a char array using JNI, but when the length is
too big it doesn't work! My char array is a representation of an
image, and its size is the width * height * 3 characters, so it
usually goes beyond 1 MB. My code works with smaller images, but when
the array size is bigger than 718832 (don't know why this is the
maximum value), the JVM crashes and it returns 134 as the exit code.
My code is like this:
// the variables are JNIEnv *env, int length, jchar *value, jmethodID
char_array_fid
jcharArray jchar_array = (*env)->NewCharArray(env, length);
if (jchar_array == NULL) {
return;
}
(*env)->SetCharArrayRegion(env, jchar_array, 0, length, value); // !!!
(*env)->SetObjectField(env, obj, char_array_fid, jchar_array);
By using printfs, I've found out the JVM crashes when it calls the
function SetCharArrayRegion, but only if the length is greater than
718832. And if I modify the length value to something like 1000, this
exact code works fine.
Any help would be appreciated :)
See ya!
- 4
- How to layout OK and Cancel buttonsHello,
is there a satndard way to layout the buttons "OK" and "Cancel" for java programs? I'm asking because java already ask to use some defined icons if possible.
I generally put "OK" to the left and "Cancel" to the right. Is this "the" way?
TIA
- 5
- Web page to build a web pageDoes anyone have any suggestions or examples of creating a web page to
allow an end user to design a form. I need to design an application
where the end user (administrator) can design a form with standard
html components such as text boxes, drop down lists etc. Attach drop
down list to database tables, and enter expression for certain fields.
Then once the form is saved another user (business) can display the
form and fill it in, at which time the expressions would be evaluated
based on the data entered.
- 6
- Apache 2.0.52 + Tomcat 5.0.28 + mod_jkHi,
I'm trying to connect Apache 2.0.52 with Tomcat 5.0.28 using the mod_jk
connector, to no avail.
The documentation at
http://jakarta.apache.org/tomcat/connectors-doc/index.html only really
covers Tomcat 4.*.
Has anyone been able to do this on a Windows or Linux platform? Are
there any good resources out there that anyone knows of that I can look
to?
It seems like everything I find refers to mod_jk2, which I just found
out is being discontinued and everything is moving to mod_jk, so I'd
like to use something that will be around for a while.
All help/information is greatly appreciated.
Thanks,
Brent
- 7
- Help needed with simple Java scriptHello everyone, from Croatia !
I am designing a site for a Serbian client, and the english page is ok, but
the serbian page needs to be cyrillic. It was no problem for Photoshop
design, but I inserted a little greeting in java (found free online), good
morning, good afternoon... This is part of the code:
hours = today.getHours();
if (hours<12) greeting = 'Good morning!';
if (hours<18 && hours>11) greeting = 'Good afternoon!';
For example:
????? ?????
????? ?????
????? ???
I would like those greetings to show on the page in cyrillic writing, font
name is ArialCYR to be exact. How do I tell Java to display cyrillic ???
I don't have experience with classes etc, so not sure
Thanks ! (if you wish to see, the site is radgost-scl.com)
Nela.
- 8
- GUI Graphics: draw a line between two pre-specified pointsHi:
Any help to the following GUI-graphics problem is greatly appreciated!
I want to draw a line between a pair of points (the first point represents
an input to a math
function, and the 2nd point represents the output of the function). The pair
of points are already
pre-specified in a GUI. This could be looked at as multiple number of input
points, and similarly
a multiple number of output points. This means that I need to draw multiple
lines between the two
sets of (I/O) pairs that look like the mapping (behavior) of the function
that to be represented
graphycally.
i.e. the overall picture graphically should look like this [i.e. f(x) = x
+2]:
"1 ---------------->3"
" |------->4"
"3 -----| | "
"2 -----|---|------->5"
(a line from 1-->3, 3--->5, and 2-->4)
Any pointers?
Many thanks in advance.
-Yasir
- 9
- How to make choices visible in a JComboBox?Hi,
I'm writing a JComboBox with a custom Editor. The idea is that when
the user inputs a string, the choices are narrowed down to match the
input.
When the user starts typing, how does one reveal the available
choices? In other words, how does one make the choices open up as if
the little "arrow down" next to the combo box is pressed?
Many thanks in advance,
Aaron
- 10
- while(true) { try{ ... } catch(Exception e) { ... } }Hi,
Have a look at this code:
public class TryNumberParse {
public static void main( String[] args ) {
double num = 0.0;
while( true ) {
try {
System.out.print( "Enter a value: " );
System.out.println( "The value entered was: " + ( num =
getNum() ) );
} catch( Exception e ) {
System.out.println( "Invalid value, please re-enter...
" );
continue;
}
}
}
private static double getNum() {
Scanner inp = new Scanner( System.in );
return inp.nextDouble();
}
}
Hope it helps!
- 11
- Help with Spring MVC XSLT viewHello,
I work with a lot of XML, so I am trying to get Spring MVC to
transform it for me. I have followed the examples in the reference
manual, but I keep getting null pointer exceptions when the view is
resolved. Could someone be so nice as to cut and paste some code
they've written that is a subclass of the AbstractXsltView? Thanks.
Also, here is the stack trace I get when the view is resolved.
java.lang.IllegalArgumentException
at
oracle.xml.jaxp.JXTransformer.setOutputProperty(JXTransformer.java:619)
at
org.springframework.web.servlet.view.xslt.AbstractXsltView.doTransform(AbstractXsltView.java:394)
at
org.springframework.web.servlet.view.xslt.AbstractXsltView.doTransform(AbstractXsltView.java:351)
at
org.springframework.web.servlet.view.xslt.AbstractXsltView.renderMergedOutputModel(AbstractXsltView.java:304)
at
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
at
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1051)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:727)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
May 2, 2006 2:15:56 PM org.apache.catalina.core.StandardWrapperValve
invoke
SEVERE: Servlet.service() for servlet MedhomeSpringMVC threw exception
java.lang.IllegalArgumentException
at
oracle.xml.jaxp.JXTransformer.setOutputProperty(JXTransformer.java:619)
at
org.springframework.web.servlet.view.xslt.AbstractXsltView.doTransform(AbstractXsltView.java:394)
at
org.springframework.web.servlet.view.xslt.AbstractXsltView.doTransform(AbstractXsltView.java:351)
at
org.springframework.web.servlet.view.xslt.AbstractXsltView.renderMergedOutputModel(AbstractXsltView.java:304)
at
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
at
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1051)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:727)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
- 12
- 13
- File upload in Java, not JSPCan anyone help point out what I should be researching in order to
upload a file from a client's machine (using a Java application
resident on their machine), to my web server?
thanks in advance
- 14
- image from jar to web page?How can I get an image from a jar file into
a web page?
I am using JSP to haul the goodies out of my
PhySci software suite and onto the net as web
pages, thus far I have turned PToE (Periodic Table)
into a crude 113 page website at..
http://1point1c.physci.org/chemistry/
Next up is Pocket Planet, containing basic information
on the planets.
The problem is, I cannot figure how to grab images
out of a jar archive and put them into a web page.
[ Short of presenting them in an applet, which I want
to avoid (I want these sites to be usable by people
with 'no java') ]
Can somebody point me to a tutorial or give me
some good search terms that will put me on the
right path?
TIA
- 15
- launching a program from a Swing GUICan someone point me to a URL where I can look at sample code
for launching a program from a Swing GUI. In my case I'd like
to use a FileChooser and click on a Shell script to start a program
which displays info.
I have tried myself with no luck. Even a suggestion on a text with
sample code would be appreciated.
Thank you.
- Andrew M. Neiderer
US Army Research Lab
|
|
|