 |
 |
Index ‹ java-programmer
|
- Previous
- 2
- JTable cell editor update several columnsI have a JTable with multiple columns line
let's say : name, cat, subcat, lang
I would like a cell editor on name ;cat , subcat and lang read only
when I edit name whenever I choose a mame that belongs to
cat,subcat,lang the cat,subcat,lang cells are updated .....
tanks a lot
patrick
jdk1.6.0_02/linux
- 4
- Also, about JColorChooserIs it possible to edit which colors are available in a JColorChooser or
is it simpler to build my own popup window with color selections?
- 8
- newbie Threads and JDialog Hello all
I've been working with Java for one year and I'm a newbie with
threads, I have the following problem which I suppose you experts can
help:
I have a JDialog extension which I create some JTabbedPane with
some tables. This JDialog and these tables, send data to other class
which performs some calculation. Now I have a problem and I suspect
that its related with threads.
The button actionPerformed listener call a JDialog method that send
data and also "tells" the table to send its data to the calculation
class. After the table send the data, the constructor of the external
calculation programm fails. I'm listing in a reduced way my code:
In the Main (just the part related with the JDialog)
// in the declaratins:
public InputsIntegrationDialog inputIntDiag;
.
.
.
if (operationIndex == INTEGRATION){
if(inputIntDiag == null){
inputIntDiag = new InputsIntegrationDialog(this, getGraph());
}
else
inputIntDiag.setVisible(true);
The InputsIntegrationDialog class resumed:
public class InputsIntegrationDialog extends JDialog implements
ActionListener{
public InputsIntegrationDialog(Window owner, VRGraph grap1) {
super();
this.tabbedPane = new JTabbedPane();
fixedCostsTable = new IntegrationTable();
variableCostsTable = new IntegrationTable();
variableCosts = makeTextPanel(res.getString("variableCosts"));
tabbedPane.addTab("variableCosts",variableCostsTable );
Box okCancel = Box.createHorizontalBox();
ok = new JButton(res.getString("Ok"));
ok.addActionListener(this);
runBut = new JButton(res.getString("Run"));
runBut.addActionListener(this);
. ..// box layouts etc...
Container contentPane = getContentPane();
contentPane.add(tabbedPane, BorderLayout.CENTER);
contentPane.add(vertBox, BorderLayout.PAGE_END);
this.pack();
this.setVisible(true);
}
public void runOPT(){
// initialize the calculation class (hiden)
//send the data from the tables to the calculation
variableCostsTable.sendDataToOpt(data 1, data 2);
// in the line bellow the problem happens!!!!!!!!!!
solver1.setNLP(nlp1.getNLP());
}
public void actionPerformed(ActionEvent e){
System.out.println("Action: " + e.getActionCommand().toString() );
if(e.getActionCommand().toString() == "Ok"){
this.setVisible(false);
}
else if(e.getActionCommand().toString() == "Run"){
// This Line calls runOpt() and inside runOPt the crashes happen
int res = this.runOpt();
if( res1 >= 0){
JOptionPane.showMessageDialog(this,
"Optimization sucessful","Message");
}
else
JOptionPane.showMessageDialog(this,
"Optimization NOT sucessful","Error");
this.setVisible(false);
}
}
}
- 8
- Jmatlink help pleasei can use jmatlink to open matlab but I can't
get it to open an m files and therefore run a functions using thev
arrays. How do I get
it to open a certain m file, I have tried to set the path in matlab
but that doesn't work.
Please help.
--
Message posted via http://www.javakb.com
- 9
- have troulbe when learn java tutorial's network socket partHi everyone:
Try fewest word: from Java Turotial->Custom Networking->All About
Sockets->Reading from and Writing to a socket, the following program:
import java.io.*;
import java.net.*;
public class EchoClient {
public static void main(String[] args) throws IOException {
Socket echoSocket = null;
PrintWriter out = null;
BufferedReader in = null;
try {
echoSocket = new Socket("taranis", 7);
out = new PrintWriter(echoSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(
echoSocket.getInputStream()));
} catch (UnknownHostException e) {
System.err.println("Don't know about host: taranis.");
System.exit(1);
} catch (IOException e) {
System.err.println("Couldn't get I/O for "
+ "the connection to: taranis.");
System.exit(1);
}
BufferedReader stdIn = new BufferedReader(
new InputStreamReader(System.in));
String userInput;
while ((userInput = stdIn.readLine()) != null) {
out.println(userInput);
System.out.println("echo: " + in.readLine());
}
out.close();
in.close();
stdIn.close();
echoSocket.close();
}
}
But it says "Don't know about host: taranis". If I change it to my
computer's name, it says "Couldn't get I/O for the connection to:
taranis.";
So how can I open echo service on a computer? Thanks.
- 9
- Get IP tomcat serverHi !
I am using Tomcat and i would like to get the host IP from the
servletContext object. Does anybody know how to get it ?
Thank you for your help
Best regards
Sylvain Caillet
- 10
- Freelance programmer / developerHello,
I am software developer looking for freelance or Full Time work, do you
have any work that need to done.. buzz me at johnleox @ gmail.com
my skill sets:
VB,
ASP (VBScript & Javascript),
SQL Server,
Access (VBA),
Excel (VBA),
.NET(ASP.NET / C#)
Oracle &
Crystal Reports
I can work on migration projects, supporting exsisting project and
looking out for new project.
If location or place of work is not important for you then buzz..
waiting for your work.
johnleox @ gmail.com
- 11
- 14
- JMS memory footprint sizeAnyone know what the memory footprint of JMS is?. I am trying to work
out if it is too "heavyweight" for use in a thin client.
tkx
- 14
- Running a bat file from a Tomcat servlet using the exec commandI cannot get a Tomcat servlet to execute a Windows Bat file.
Is there a particular setting in the catalina.policy file that I need
to change?
Here is a code snippet of the call:
Runtime load = Runtime.getRuntime();
Process process = load.exec("cmd.exe /c start copyFiles.bat", null,
new File("C:\\Tomcat 5.0\\webapps\\myApp\\files"));
Thanks for any help.
-Chris
- 14
- JTextArea size limitiing question ...I'm using a JTextArea within a JScrollPane within a JViewPort. I am
using the JTextArea to mimic a HyperTerminal like terminal emulation
interface. When I set up the JTextArea I specify the viewable rows and
columns, but since it is inside the JScrollPane it obviously can grow
"infinitely" large (and eventually throw a heap memory exception). My
desire is to not allow this, but was hoping that there was something
within Java itself to passively limit the size of the JTextArea.
Currently I use it to receive diagnostics (through a serial
communications port) from an embedded device, so during testing I could
conceivably let this run for several days (which will most certainly
induce a heap memory exception). I am also logging all of the
diagnostics to a file so I have no need for the JTextArea to grow
"infinitely" large.
So is there a way to passively limit the ultimate size of a JTextArea
that I am missing or do I have to actively determine its size and trim
it down some how (and if so, any suggestion on how to delete "old" data
in a JTextArea)?
Thanks, in advance, for any help.
- 15
- Efficient polling of a flatfileJust looking for feedback on what you might consider the most efficient
means to poll a flat file.
I need to have my app look at a flat file, say, every second or so, and read
any data that may have been appended to it.
Wondering what others might consider an efficient means of doing this in
Java. Would it be wise to merely look at the file size everysecond or so,
and, if that has changed, to then read it, starting from that byte which was
the previous size of the file on the previous polling a second ago?
Is there a more efficent way to do this? Thanks, Ike
- 16
- A grammar lesson for EdEd wrote:
> Yes, I do! The fact that I got the 5-start ratings on my postings
> explaining how you was rude to me, makes me to kind of trust the
> google ratings!
(To readers of m.e.l.e: this is a perfect example of how NOT to write
English.)
(P.S. I know I shouldn't do this, but it is just too fun to pass up ;-))
Several comments to explain about why this is not proper grammar:
In English, the word `was' indicates the past participle of `to be' in
the third person singular form /only/. The relevant past participle
(here, we need to be in second person, which corresponds as well to all
plural forms) that you are looking for is `were'.
The construction `to make one' is not followed by the word `to'; what
you need to do is drop that word from the following infinitive.
There is no word called `google' (there is a `googol', as in 10^100). If
you are referring to the company with that name, then your
capitalization should reflect that, as a proper noun [*]: `Google'.
Semantically, that classifies all of your sins; however, your choice of
words is not the most appealing in the world.
`To get' is very slangy, and, seeing as Usenet expects a certain level,
of professionalism, the better verb is `to receive'.
I know of no rating that uses `starts'; are you looking for `star'?
`5' should not be written as a digit (as well as other numbers less than
ten), it is better to use `five' in this case.
On forums, the term `posting' should be eschewed in favor of the word
`post' (shorter noun, and I dislike gerunds as well).
Finally, usage of exclamation points is highly disregarded in Usenet
posts, as it places others' impressions of you as roughly equivalent to
a loud-mouthed twelve-year old kid. Your continual usage of vulgar
language and poor grasps on the basic points of politeness also add to
the impression of a brat.
[*] Well, in recent times, companies have fallen in love with the
non-traditional forms of capitalization, preferring such proper nouns as
`iPod'. The best rule of thumb to follow is to use the official
capitalization rules of the company owning the trademark.
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
- 16
- Weird Static IssuePlease take a look at the following code section. In this module the
static "qt" becomes null when the constuctor is fired, very similar
code works find in other places in my program. I don't think the
QueryTools class is a problem because I can use the code elsewhere.
public class Authorization
{
static public String TABLE ="authorization";
static private String POOL_NAME = "mysql-invoice-system";
static private QueryTools qt;
static
{
System.out.println("Static Section " + POOL_NAME);
QueryTools qt = new QueryTools(POOL_NAME);
System.out.println(qt);
System.out.println("Static Section End " + POOL_NAME);
}
public Authorization()
{
System.out.println("Authorization Constructor");
System.out.println("QT=" + qt);
}
Here is the output from Netbeans:
run:
Static Section mysql-invoice-system
com.ciorent.HFCConnectionPool.QueryTools@18e2b22
Static Section End mysql-invoice-system
Authorization Constructor
QT=null
Here is the calling code:
Authorization a = new Authorization();
try
{
a.createAccount("email***@***.com", "test4200", 10000);
}
catch (Exception e)
{
System.out.println(e);
}
System.exit(1);
I am going to bet this is something simple that I am missing, hopefully
someone will be able to point out my error.
Thanks
HFC
- 16
- prohibited methodwhat does it mean when we say ,
in EJB session bean
"The bean instance calls a prohibited method of its session context."
what does it mean by prohibited method ? who prohibits ? how can we
set this prohibition ?
thanks
|
| Author |
Message |
emailismylife

|
Posted: 2004-4-3 6:15:00 |
Top |
java-programmer, setFont() on solaris
Hi,
In one of my methods, I have a call like:
label.setFont(new Font("Arial", Font.PLAIN, 9));
This call works fine on windows but not on solaris. Moreover, the
label's text gets truncated when it shows up ("Applications" shows as
"Applicati") I iterated through the fonts via
GraphicsEnvironment.getAllFonts() and Arial seems to be available to
the java graphics environment on solaris.
How do I get arial font on solaris and not cause the truncation? Any
suggestions?
Thanks.
|
| |
|
| |
 |
Andrew Thompson

|
Posted: 2004-4-4 15:41:00 |
Top |
java-programmer >> setFont() on solaris
On Sat, 03 Apr 2004 05:22:56 GMT, Roedy Green wrote:
> On 2 Apr 2004 14:15:12 -0800, email***@***.com (sn) wrote or
> quoted :
>
>>In one of my methods, I have a call like:
>>label.setFont(new Font("Arial", Font.PLAIN, 9));
>>
...
> ...much simpler approach would be to use a font called
> "SansSerif" guaranteed to exist on all platforms.
Not just simpler, better. It would get the
user's _chosen_ sans-serif font, rather than
the one the software developer likes.
>> Moreover, the label's text gets truncated
>> when it shows up ("Applications" shows as
>>"Applicati")
Tha seems more like a problem with the layout
(using absolute positioning, no layout manager, etc..).
I would have to see an example to be sure.
<http://www.physci.org/codes/sscce.jsp>
--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
|
| |
|
| |
 |
emailismylife

|
Posted: 2004-4-16 9:41:00 |
Top |
java-programmer >> setFont() on solaris
setFont(Font) does not seem to work at all for labels (I havet tried
for other components) on solaris.
I tried various ways of creating fonts before applying it to the
label:
- new Font("<logical-name>", <style>, <size>); // logical name is
"sansserif", "serif" etc.
- new Font("<physical-name>", <style>, <size>); // physical name is
"arial", etc.
- Font.createFont(<Type>, <InputStream to ttf file>) followed by
font.deriveFont()
Whenever I change a parameter (size, name, or style) while creating a
font, I can see that change when I access the applet (yes, all this
is in an applet!) while running in IE. But with Netscape on Solaris,
it always shows the default font and size.
Could be some JRE settings problem on Solaris. Any ideas? (I havent
modified the default font.properties in either case)
Thanks for your help.
Andrew Thompson <email***@***.com> wrote in message news:<18jrfp75fqool$email***@***.com>...
> On Sat, 03 Apr 2004 05:22:56 GMT, Roedy Green wrote:
>
> > On 2 Apr 2004 14:15:12 -0800, email***@***.com (sn) wrote or
> > quoted :
> >
> >>In one of my methods, I have a call like:
> >>label.setFont(new Font("Arial", Font.PLAIN, 9));
> >>
> ...
> > ...much simpler approach would be to use a font called
> > "SansSerif" guaranteed to exist on all platforms.
>
> Not just simpler, better. It would get the
> user's _chosen_ sans-serif font, rather than
> the one the software developer likes.
>
> >> Moreover, the label's text gets truncated
> >> when it shows up ("Applications" shows as
> >>"Applicati")
>
> Tha seems more like a problem with the layout
> (using absolute positioning, no layout manager, etc..).
>
> I would have to see an example to be sure.
> <http://www.physci.org/codes/sscce.jsp>
|
| |
|
| |
 |
emailismylife

|
Posted: 2004-4-17 5:51:00 |
Top |
java-programmer >> setFont() on solaris
Well, this turned out to be a stupid problem. I am connecting to a
solaris box using an X server on windows (Xmanager) and my
installation of X server does not seem to have TrueType fonts in its
fontpath by default. When I run my java programs/applet on a Solaris
box all the fonts etc. work just fine.
Isnt it suprising how small things seem so perplexing when you are new
to things :) ????
email***@***.com (sn) wrote in message news:<email***@***.com>...
> setFont(Font) does not seem to work at all for labels (I havet tried
> for other components) on solaris.
>
> I tried various ways of creating fonts before applying it to the
> label:
> - new Font("<logical-name>", <style>, <size>); // logical name is
> "sansserif", "serif" etc.
> - new Font("<physical-name>", <style>, <size>); // physical name is
> "arial", etc.
> - Font.createFont(<Type>, <InputStream to ttf file>) followed by
> font.deriveFont()
>
> Whenever I change a parameter (size, name, or style) while creating a
> font, I can see that change when I access the applet (yes, all this
> is in an applet!) while running in IE. But with Netscape on Solaris,
> it always shows the default font and size.
>
> Could be some JRE settings problem on Solaris. Any ideas? (I havent
> modified the default font.properties in either case)
>
> Thanks for your help.
>
>
>
> Andrew Thompson <email***@***.com> wrote in message news:<18jrfp75fqool$email***@***.com>...
> > On Sat, 03 Apr 2004 05:22:56 GMT, Roedy Green wrote:
> >
> > > On 2 Apr 2004 14:15:12 -0800, email***@***.com (sn) wrote or
> > > quoted :
> > >
> > >>In one of my methods, I have a call like:
> > >>label.setFont(new Font("Arial", Font.PLAIN, 9));
> > >>
> ...
> > > ...much simpler approach would be to use a font called
> > > "SansSerif" guaranteed to exist on all platforms.
> >
> > Not just simpler, better. It would get the
> > user's _chosen_ sans-serif font, rather than
> > the one the software developer likes.
> >
> > >> Moreover, the label's text gets truncated
> > >> when it shows up ("Applications" shows as
> > >>"Applicati")
> >
> > Tha seems more like a problem with the layout
> > (using absolute positioning, no layout manager, etc..).
> >
> > I would have to see an example to be sure.
> > <http://www.physci.org/codes/sscce.jsp>
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Designation standard output as File type I have a method (fragment below) that takes a File type "outFile"
as the output file. However, if the user of this method specifies
"null" for that parameter, I want to make the output go to standard
output instead of a file.
My question: To what do I set outFile (File type) to make the
output go to standard output (display)? System.out is of a type
PrintStream.
Thanks, Alan
public static void printData(File dir, File outFile)
{
try
{
if (outFile == null)
{
outFile = ?????; // Default is standard output (System.out)
}
. . .
- 2
- DND using XML Hi,
I want to transfer a block of XML between 2 DND objects in java
What's the best way to do this?
steve
- 3
- 4
- 5
- Panel text not showing in JFrameI have a JFrame to display after a button is clicked. The following
JFrame appears, but the label text does not appear until the thread is
completed. Any advise:
public void run(){
JPanel panel = new JPanel(); // create pane content object
JLabel prompt = new JLabel("Processing log files");
panel.add(prompt);
Container contentPane = myFrame.getContentPane();
contentPane.add(panel);
myFrame.setTitle("Processing logs...Please Wait");
myFrame.setBounds(100,100,350,75); // position frame
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.toFront();
panel.add(prompt);
myFrame.setVisible(true);
myFrame.pack();
System.out.println ("pack1 done");
myFrame.repaint();
myFrame.pack();
}
- 6
- sending a message from jboss to all java-clientsHi
I'm building a j2ee Application on top of j2ee and JBoss 4.0.
The Clients connected to JBoss are non-web Swing Clients.
If One Clients changes the data on a bean/in the db, all the other clients
connected to the jboss have to be informed about the change, so they can
update der UI.
On a standalone Java-App i would use listeners to solve this, but as im new
to j2ee i have no idea how to realize this with j2ee and jboss.
It would be great to get some ideas on how to solve this problem.
greets from Germany
Johannes Hermen
- 7
- java graph theoryi am a student tryingto write a progamme that will use graphs as their
starting point but dont know where to start. i have a small amount of
code to get me started but not much help.
If anyone can help me in anyway woulf be helpful.( places to look/
tips/ people to speak to/ books to look @ etc..)
- 8
- Can't read JAAS config from JARWe have an application that uses JAAS for security.
Until now the JAAS config file was in a folder (conf/) and the
application just ran fine.
To prepare for the deployment of the application with Webstart I packed
the folder with the config file in the application's JAR. Now JAAS
can't seem to find the file anymore.
Working:
|--application.jar
|--conf/
|--auth.conf
Failing:
|--application.jar
|--conf/
|--auth.conf
Both have the same manifest:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0_04-b05 (Sun Microsystems Inc.)
Main-Class: com.fpc.nokeos.core.client.launch.Launcher
Class-Path: . conf
I also tried expliciitely adding "conf/auth.conf" to manifest but it
didn't work either.
The stacktrace I get is
08:57:42,250 - ERROR: [NokeosClientSecurity] Could not connect to the
server.
Please check your network connection.
java.lang.SecurityException: conf/auth.conf (No such file or directory)
at
com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:97)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at
java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at
javax.security.auth.login.Configuration$3.run(Configuration.java:216)
at java.security.AccessController.doPrivileged(Native Method)
at
javax.security.auth.login.Configuration.getConfiguration(Configuration.java:210)
at
javax.security.auth.login.LoginContext$1.run(LoginContext.java:237)
at java.security.AccessController.doPrivileged(Native Method)
at
javax.security.auth.login.LoginContext.init(LoginContext.java:234)
at
javax.security.auth.login.LoginContext.<init>(LoginContext.java:403)
at
com.fpc.nokeos.core.client.security.NokeosClientSecurity.login(NokeosClientSecurity.java:46)
at
com.fpc.nokeos.core.client.launch.Launcher.checkLogin(Launcher.java:89)
at
com.fpc.nokeos.core.client.launch.Launcher.main(Launcher.java:66)
Caused by: java.io.IOException: conf/auth.conf (No such file or
directory)
at
com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:157)
at
com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:95)
... 16 more
How can I make it work?
- 9
- Xdoclet JBossHi all,
I am new to xdoclet and would like to convert my existing EJB source
files to xdoclet embedded tags and ultimately generating deploy
descriptors for JBoss.(4.0)
My current application server is Pramati and i am migrating to
JBoss(4.04GA) using xdoclet(1.2.3) as the EJB (Spec 2.0) deployment
automation tool. I have the ejb.jar and other descriptors which are
specific to Pramati Application server. I would like to generate the
appropriate interfaces (Remote, Home etc) and JBoss specific
descriptors for each EJB. I goggled but didnt find a complete example
using xdoclet. The information seems to be scattered.
I would like to know the steps for the following ( For eg I have a
MyXYZBean.java )
1) Adding appropriate xdoclet tags(Jboss specific) to this source file
(MyXYZBean.java)
2) Steps to generate the Remote, home etc interface source files ( Eg
MyXYZRemote.java, MyXYZHome.java etc)
3) Steps to generate JBoss specific descriptors (jboss.xml, ejb.jar
etc)
4) A task to be included in my build.xml which takes care of steps 1) ,
2) and 3) appropriately.
Many thanks,
Santosh
- 10
- JDBC Thin driver for Oracle doesnt loadI'm using Oracle's JDeveloper 10g so the driver should exist. however this
code raises the ClassNotFoundException. so my questions
1. Whats the simplest way to tell if the thin driver for oracle ( or any
other JDBC driver ) exists?
2. If it does not exist where can I download it and where should I put it?
3. If it exists then why doesn't this code run? I've even tried to register
with the DriverManager but the same error.
thx.
import java.sql.*;
public class JDBCThin
{
public static void main(String[] args)
{
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch ( ClassNotFoundException e )
{
System.out.println(e.getMessage()) ;
}
}
}
- 11
- EJB: removing local TOsHi!
This applies to WebLogic 7 but probably is generally the case.
I have a Collection of Local objects which I want to remove(). So I thought
collection.clear() would be sufficient and the container would do the job.
But it doesn't.
So, I iterate thru the Collection and call remove() on each Local object.
This throws a ConcurrentModificationException because the container does
remove the element from the Collection when calling remove() on the Local
object.
The only solution seems to iterate over the collection, put the objects to
be deleted in another collection, iterating over that collection and
calling remove() there on any Local object.
Well, there must be something I misunderstood about EJB, right?
- 12
- Important and UrgentHi all,
Please read on:
We are doing a survey to collect information on middleware usage
and some features of the middleware. Through the survey data as one
source of information, we can do research on middleware, and software
engineering trend analysis and prediction.
Please take out some minutes to fill in this survey. Please this is
really important survey.
Suvey link:
http://swtech.njit.edu/middlewaresurvey/
As this group includes Students/Faculties as well as Professionals,
please fill up the Individual survey and other corresponding surveys.
I am sure you guys will take part and will help this research.
Give little time to make this survey successful.
Your efforts are appreciated.
Thank you all
Purvi
- 13
- JLint port
--=-hJb57ejBSXdHWUZd6IhV
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hi there,
I've been looking at the JLint port (java/jlint). This port is flagged
as BROKEN in FreeBSD 5.x. Looking at the JLint homepage I see that
version 3.0 is current (the port is 2.3). I have easily managed to
compile and install JLint 3.0, only a minimal patch is required (to
disable the bool->int mapping in types.hh). Would someone mind upgrading
this port? I send an upgraded port with this email. Please have a look
at it, comment it and check it in if you like.
Best regards, Roman
--=-hJb57ejBSXdHWUZd6IhV
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
--=-hJb57ejBSXdHWUZd6IhV--
- 14
- TCP client application does detect network failureHi,
This is a behavior of the TCP socket in Java I dont' understand:.
Let say we have a simple client/server application running on TWO different
machines.
The client send bytes to the server.
The server recieved the bytes and wait for about X sec.
During this waiting time, we disconnect the server from the network (just by
unplugging the server network cable).
After the waiting time the server is aware of the network failure (a
SocketException is thrown : connection reset, because it is trying to send
the response)
But on the client side it is still stuck on a "rcv =
commandInput.readLine();" statement (see after for the complete code), it
will never be aware of the network failure !!! Even after one hour the
client is still waiting to read something on closed socket. Is this the
normal behavior ?
In reality we are dealing with an application that use the FTP server to
server mode (we are controlling only the command socket, the data transfer
is made by the servers). We have to transfer huge file, thus we can not set
up a time out. If the last scenario occurs, some of our transfers are stuck
and it is not possible for us to detect the failure. The client will wait
for ever the response.
Does anybody have already deal with that ?
Below is the simple client and server I made in order to make my experiment.
The client just read the keyboard input and send it to the server; the
server just echo the request except if the request
is 'wait X', in this case it will wait for X sec before responding.
Thanks by advance,
Olivier MERIGON
CLIENT:
----------------------------------------------------------------------------
-------
package com.iratensolutions.test.ftp;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;
/**
* A Client/Server application to test the network failure behavior with TCP.
* This the client part. It just sends the keyboard input to the server.
* @author Olivier MERIGON
*/
public class TestNetworkFailureClient {
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("usage: java
com.iratensolutions.test.ftp.TestNetworkFailureClient serverAdress");
}
Socket commandSocket = null;
BufferedReader commandInput;
BufferedReader keyboardInput;
PrintWriter commandOutput;
try {
commandSocket = new Socket(args[0], 666);
commandInput = new BufferedReader(new
InputStreamReader(commandSocket.getInputStream()));
keyboardInput = new BufferedReader(new InputStreamReader(System.in));
commandOutput = new PrintWriter(new
OutputStreamWriter(commandSocket.getOutputStream()));
} catch (Exception e) {
e.printStackTrace();
return;
}
System.out.println("CLIENT STARTED");
String snd;
String rcv = null;
try {
do {
System.out.print("KEYBOARD: ");
snd = keyboardInput.readLine();
if (snd != null) {
commandOutput.println(snd);
commandOutput.flush();
System.out.println("SND: " + snd);
rcv = commandInput.readLine();
System.out.println("RCV: " + rcv);
}
} while (rcv != null);
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
--------------------------------------------------------------------------
SERVER
----------------------------------------------------------------------
package com.iratensolutions.test.ftp;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
/**
* A Client/Server application to test the network failure behavior with TCP.
* This the server part. The server can wait X second after responding to a
request.
* If a wait request is received, the server just answer the time waited
after
* the requested wait time, otherwise it respond immediatly the request
number.
* usage: wait intNbSec | any text
* @author Olivier MERIGON
*/
public class TestNetworkFailureServer {
public static void main(String args[]) {
ServerSocket echoServer = null;
String line;
DataInputStream is;
PrintStream os;
Socket clientSocket = null;
try {
echoServer = new ServerSocket(666);
System.out.println("SERVER STARTED");
} catch (IOException e) {
System.out.println(e);
}
while (true) {
try {
clientSocket = echoServer.accept();
System.out.println("Handling new client...");
is = new DataInputStream(clientSocket.getInputStream());
os = new PrintStream(clientSocket.getOutputStream());
int loopId = 0;
do {
line = is.readLine();
System.out.println("RCV: " + line);
//Handle "Wait" command
if (line.trim().startsWith("wait")) {
String[] tab = line.split("\\s");
boolean ok = false;
try {
int nbSec = Integer.parseInt(tab[1]);
System.out.println("...waiting for " + nbSec + " sec.");
try {
Thread.sleep(nbSec * 1000);
} catch (InterruptedException e1) {
}
String resp = "...end of wainting periode of " + nbSec + " sec.";
os.println(resp);
System.out.println("SND: " + resp);
ok = true;
} catch (Exception e) {
ok = false;
}
if (!ok) {
String resp = "usage: wait intNbSec | any text";
os.println(resp);
System.out.println("SND: " + resp);
}
//Handle "normal" action
} else {
os.println("# " + loopId);
System.out.println("SND: # " + loopId);
}
loopId++;
} while (line != null);
} catch (IOException e) {
System.out.println(e);
}
}
}
}
- 15
- .ear files in Sun Java StudioHi all,
I am not sure if this is the right newsgroup for this question. But I just
thought that some of you may be able to help me out; that's why I am asking
you all this question.
I have a .ear file and I just downloaded Sun Java Studio Enterprise 8. May
I ask how can I import this .ear file in Sun Java Studio Enterprise 8? Can
someone point me to the right direction?
Thanks in advance,
Monte
--
---------------------------------------------
"Whatever my lot, thou has taught me to say, 'it is well; it is well with my
soul.'" -- Lyrics of It is well, it is well with my soul.
|
|
|