| The simplest way to show a large output string? |
|
 |
Index ‹ java-programmer
|
- Previous
- 2
- Download file problem in netscapeConsider this example..
I have a pdf file which is embedded in the browser and I have a
download link which is used to download that pdf file. When I click on
the download link, it is not functioning since it is the same url as
the embedded pdf and because the adobe reader is already there in the
browser it will automatically opens or the embedded pdf will goes off.
To prevent this scenario, we can use a mechanism. First create a
hidded iFrame in the same window using the following code..
<iframe style="DISPLAY: none" name="iframe1" src="">
Now make a small change to your download link so that the url target
is pointing to the hidden frame as shown below..
<a href="..." target="iframe1">Download</a>
This will solve the problem. However this method will not work with
Internet Explorer. For IE we can use another method and that method
can be choosen automatically by the browser.
More java tips @ http://sourcecentral.blogspot.com
- 2
- help with multidimensional arraysHi
I am a newbie in the world of Java programming. I have recently started
learning the language. Apart from other hickups one which has been on
my nerves is the concept of multidimensional arrays. As far as my
understanding goes these are array of arrays.
1. WHAT DOES THIS MEAN?
2. ARE ARRAYS RESTRICTED TO THREE DIMENSIONS ONLY OR THERE IS ANY OTHER
LIMIT AND HOW DOES THREE DIMENSIONAL OR HIGHER DIM ARRAYS WORK?
Does two dim arrays represent a pigeon hole type thing in which you
find a particular hole by giving row and column address e,g. box
located at row 5 and column 2.
3. IF THIS CONCEPT OF TWO DIMENSIONAL ARRAYS IS CORRECT THEN HOW DOES
THREE DIMENSIONAL OR HIGHER DIM ARRAYS WORK.
Presently I am going through a book written by Herber Schildt known as
Java 2 complete reference, Following is a program which demonstrates
the two dim arrays. I am unable to understand the make of the program
may be so many loops are troubling me. I am especially confused about
the functioning of the question mark steps please help me out there.
// Demonstration of concept of two dimensional arrays
class twoD {
public static void main (String args [ ]) {
int [ ][ ] twoD = new int [4][5];
int i,j,k = 0;
for (i=0; i<4; i++)
for (j=0; j<5; j++) {
twoD [i][j] = k; ?
k++; ?
}
for (i=0; i<4; i++) {
for (j=0; j<5; j++)
System.out.println (twoD[i][j] + " ");
System.out.println();
}
}
}
4. HOW AND WHY SO MANY LOOPS ARE FUNCTIONING TOGETHER?
(While replying please be patient and keep in mind that u r talking to
an absolute beginner in the world of Java programming)
- 2
- Java license explanationCan someone explain to me if Java can be used freely like other
softwares like C++.Perl, PHP or I have to pay for its license once I
used it in programming in a company or in a website or e-commerce.
Is Java really opensource or not?
And so when will be the time you have to pay for its license?
Thanks!!!
- 2
- How Can I put XSL tag inside HTML form tag?Hello Dudes,
Sorry I couldn't find a XML/XSL group
I can only post these groups close to my subject.
In JSP (Java Server Page) you can do something
like this
<%
String v = myBean.getValue();
%>
<form .... >
<input name="myTag" value="<%= v %>">
</form>
You can do the similar thing in PHP.
But when I try in XSL I got error.
I have an XML file
<myTag attribute1="value1" />
Now I want to transform it into HTML form tag used XSL template
But XSL doesn't like this
<input name="myTag" value='
<xsl:value-of select="@attribute1" />
'></input>
How can I solve this problem?
Thank Q very much in advance!
- 3
- Running a servlet with TomcatHi,
When I use the following URL in Internet Explorer:
http://localhost/servlet/HelloWorldExample
I get an error message:
-----8<------------
HTTP Status 404 - /servlet/HelloWorldExample
--------------------------------------------------------------------------------
type Status report
message /servlet/HelloWorldExample
description The requested resource (/servlet/HelloWorldExample) is not
available.
--------------------------------------------------------------------------------
Apache Tomcat/5.5.17
-----8<------------
I have the HelloWorldExample.class file in
C:\Tomcat5.5\webapps\ROOT\WEB-INF\classes.
Can anyone help me please?
Best regards,
Matheas Manssen
- 6
- In Swing, using the RTFEditorKit, how to copy/cut Formatting *and* text to the Clipboard?Hi Folks:
Any idea on the best approach to support copy/cut of all style/formatting as
well as plain text for a JTextPane? I googled quite a bit and located a
word processing program that supports JTextPane but they specifically
mention it only places "plain text" to the Clipboard and ignores the
formatting information when transfering.
I was thinking about implementing the Transferable interface and using the
Clipboard.setContents(..) method but I'm not sure yet by which procedure I
implement the getTransferData() as it wants to return an Object. I could
use a byte[] stream and return a ByteArrayOutputStream who's contents would
be filled with the Document's data (ie, plain text *and* the control/style
information). I just don't know if that would work yet but I plan to try
that.
Seems like there's very little (if anything) mentioned in the sun
developer's forum on how to do this as well as in google...
First of all, is Java's support for RTF still somewhat "primative"??? I
have a full blown word processor going which looks like Word and supports
font changes, size changes, find/replace operations, etc... It's just that
the cut/copy only transfers the plain text (despite my attempts to call
setContentType("text/rtf")) to the clipboard and not the style information.
thanks for any insight, Theron
- 6
- AspectJ: solution to Java's repetitiveness?thufir wrote:
> On Sat, 26 Apr 2008 06:51:43 -0400, Lew wrote:
>
>>> attrib_writer :foo, :bar #getter and setter for foo and bar attributes,
>>> #getter setter methods aren't actually written
>> Well, Java cannot do that because it's not in the language definition
>> and because the colon character already serves three other purposes in
>> Java.
>
> That Ruby syntax doesn't work in Java isn't the point at all.
>
>> I would just go with getters/setters. What's the big deal? My IDEs
>> generate them for me, so there's no typing, and it sure helps
>> maintainers to see them.
>>
>> It would be a huge waste of energy to retrofit Java with such a feature.
>
> The point is that getter/setter methods are boilerplate. Adding such a
> feature to Java would be worth it, and Java is constantly in flux.
>
>
> -Thufir
Can't you just add a (custom) annotation, e.g. "@JavaBean", and use
apt to generate the getters/setters? (Or possibly the newer
javax.annotation* stuff?) You could add options to such an
annotation e.g., read-only.
Then add the one extra line in your ant script to build code.
Note JavaEE defines many such annotations, including for an
MX Bean. Adding a standard annotation "@JavaBean" doesn't seem
like it would be that much effort, for a large convenience payoff.
<waffle>
Like Lew I use an IDE that does that for me. Still, I don't like
dependencies on particular tools that provide special features, if
the language could easily support them with little effort.
OTOH as others have pointed out in previous threads, the JavaBean
spec is rarely used, so maybe adding more standard annotations
isn't worth it.
If the OP thinks it should be used, create or modify a JSR for this
feature; if enough others agree it will be added.
</waffle>
-Wayne
- 7
- garbled JFrame
Ive got a a JFrame class displaying many JLabels with images inside.
It displays fine and I can drag it around the desktop ok.
But when I drag another window over the JFrame my JFrame gets garbled.(get
multiple images of the labels)
Even when i minimize it and maximize it is still garbled.
why would that be?
TIA
patrick
- 7
- JSplitPane/JScrollPane Problem?Hey,
I'm writing an interface that has a verticle split pane, the top
and bottom of which both contain JScrollPanes with JEditor panes inside
each scrollpane. It sits within a JTabbedPane which is in a
JInternalFrame on a JDesktopPane.
JDesktopPane --> JTabbedPane --> Tab --> JSplitPane --> 2 ScrollPanes
--> 2 JEditorPanes.
The first EditorPane is a source area and the second is an error
output area. It's been working fine for me, which makes my current
dilema even worse.
I need to do the same format of error for an output tab so that
the output area is on top and the error output is on bottom. I took
the code from the previous working implementation and ported it and for
some reason it didn't work. The top component JScrollPane-->
JEditorPane does not show, but the bottom one does. Also, if I just
add the JScrollPane instead of the JSplitPane to the tab, it still
doesn't show, leading me to believe that it is a problem with the
implementation of the JScrollPane. Here are the code snippets of the
working and non-working portions of my code.
-----Working-----
source = new JEditorPane();
sourceError = new JEditorPane();
sourceError.setEditable(false);
JScrollPane scrollPane = new JScrollPane(source,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
JScrollPane errorScrollPane = new
JScrollPane(sourceError);
errorScrollPane.setBorder(BorderFactory.createEmptyBorder());
sourceSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
scrollPane,
errorScrollPane);
sourceSplit.setBorder(BorderFactory.createEmptyBorder());
-----Not Working-----
expressionOut = new JEditorPane();
outputError = new JEditorPane();
expressionOut.setEditable(false);
outputError.setEditable(false);
JScrollPane outputScroller = new
JScrollPane(expressionOut,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
outputScroller.setBorder(BorderFactory.createEmptyBorder());
JScrollPane outErrorScroller = new
JScrollPane(outputError);
outErrorScroller.setBorder(BorderFactory.createEmptyBorder());
sourceSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
outputScroller, outErrorScroller);
outputSplit.setBorder(BorderFactory.createEmptyBorder());
-----How They Are Added-----
tabFrame.addTab("Source", sourceSplit);
tabFrame.addTab("Output", outputSplit);
---------------
Any Ideas on why it isn't showing expressionOut?
- 9
- how do I encode image as stringI am trying to pass an image that I am manipulating in a java applet to
a javascript fuction, to be used there as either the source for an img
tag, or to save and/or print. Another possibility is to pass the image
up to a php script for further processing on the server. I know that
you can use ImageIO to save the image to a ByteArrayOutputStream, and
then use the stream's toString to get a string, but passing that string
to javascript truncates the image after the first 4 characters, due to a
null character (hex 0). I have been able to encode the string to
base64, but I do not know if anything more is needed to be done for the
javascript function to use it as an image.
I know that you can embed images in HTML by storing a special string
representation of the image in a javascript variable, but I do not know
what this format is. If I knew this format, I could encode the image in
Java, and then pass this string on. Any one know anything that could
help me?
Darcy Kahle
- 12
- importing classs without package in JSP ?Hi,
i am working on apache server web based project and i want to import a
class without package in my JSP file.
All my classes are in "WEB-INF/classes"
if i use a package (such as "project") in a class (such as "match" )
then i can import class "match" in jsp using
<%@ page import="
java.util.*,
project.*
"%>
But if i dont have package then i dont know how to import my class in
JSP. Thats what i want to know .
PLease help me. i am really thankful to you guys.
Sincerely,
Jeff
- 16
- java.sql.SQLException: ORA-00020: maximum number of processes (100) exceededHello Friends,
I am getting the following error.
java.sql.SQLException: ORA-00020: maximum number of processes (100)
exceeded
I am closing all my resultsets and all my connections in the try
block.
should i close ResultSets and Connections in the catch block aswell?.
or the problem is due to the connection pool settings in weblogic or
on the oracle side instead of in my application.
Thanks in Advance
s
- 16
- Critical Problem with Tomcat 3.3.1 and SSLHello,
I am having a serious problem trying to set up SSL on Tomcat 3.3.1 on
Windows 2000. I am following the jakarta guidelines exactly as they
propose, but I am having absolutely no luck. What am I doing wrong?
Here is the procedure I follow:
First, I run the following command -
keytool -genkey -keyalg rsa -alias name -keystore name
- I then answer the questions. I tried setting the common name as
my name, and a second time as the the URL used to access the site in
question, ie: sitename.com
Then, I issue the following command -
keytool -certreq -keystore name -alias name -file name.csr
Next, I send the name.csr file to the CA, and recieve 3 certificates.
The 3 certificates I receive are RootCert.cer, IntCert.cer and
NewCert.cer. So, I then issue the following commands in this order:
keytool -import -trustcacerts -file RootCert.cer -alias rootcert
-keystore name
keytool -import -trustcacerts -file IntCert.cer -alias intcert
-keystore name
keytool -import -trustcacerts -file NewCert.cer -alias newcert
-keystore name
After each command I receive confirmation that the certification was
properly inserted. I then copy the 'name' file to TOMCAT_HOME/conf
and edit the server.xml file. I add the following lines to the
server.xml file:
<Http10Connector
port="8443"
secure="true"
keystore="c:\tomcat\conf\name"
keypass="password"
clientauth="false"/>
Now, I restart tomcat and assume that everything should be in order.
When starting tomcat via the batch file, I see that an Http10Connector
is correctly sitting on port 8443. So, I try accessing the site
normally, and everything works fine. However, if I attempt an HTTPS
request to the site, I receive a page cannot be displayed error. This
is strange, because I figured that at this point it should work.
Well, I then attempted to access it manually by addressing
localhost:8443 .... this is where I noticed a problem. Once the
request is sent to Tomcat, Tomcat throws the following exception:
PoolTcpEndpoint: Handshake failed
javax.net.ssl.SSLException: Unrecognized SSL handshake.
at com.sun.net.ssl.internal.ssl.InputRecord.read(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275)
at java.io.OutputStream.write(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA6275)
at org.apache.tomcat.util.net.JSSESocketFactory.handshake(JSSESocketFactory.java:270)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:479)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
at java.lang.Thread.run(Unknown Source)
ThreadPool: Caught exception executing
org.apache.tomcat.util.net.TcpWorkerThread@3a8602, terminating thread
java.lang.NullPointerException
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:498)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
at java.lang.Thread.run(Unknown Source)
What is going on? Luckily, I have access to a CA, so this process
isn't costing me anything, however I have attempted this multiple
times with various certificates and various settings on the
certificate and I always get this same exception. What's more, I
tried creating a self signed certificate and I still get this
exception. Am I doing something wrong? I have scoured the net
countless times and it seems like all the instructions say the same
thing. When I search for this error, none of the recomendations fit
my situation. If no one knows how to fix this, could someone please
recomend where I can go so that I can find the answer to this problem?
Please help me out, this is driving me nuts. Thanks in advance,
Dan
- 16
- CVS checkout doesn't work in Eclipse v3.0.1Hi,
Since the CVS functionality of NetBeans doesn't appear to work for
me, I'm trying Eclipse. However, the CVS functionality of Eclipse
doesn't appear to work either. When I try to do a CVS checkout in
Eclipse, a "project" does get created in my workspace, but the
contents of the CVS modules aren't actually in the project. Now, the
contents of the module are only directories to this point, because I
was looking to work on the module with Eclipse. Should this be a
problem? Should I add a least one file to the project before Eclipse
will properly checkout the module with all its subdirectories?
Thanks,
Jason
- 16
- Download the JAVA , .NET and SQL Server interview question with answersDownload the JAVA , .NET and SQL Server interview sheet and rate
yourself. This will help you judge yourself are you really worth of
attending interviews. If you own a company best way to judge if the
candidate is worth of it.
http://www.questpond.com/InterviewRatingSheet.zip
2000 Interview questions of .NET , JAVA and SQL Server Interview
questions (worth downloading it)
http://www.questpond.com/InterviewQuestions.zip
Core Java and OOP's Interview questions
http://www.questpond.com/OOPsAndCoreJava.zip
Servlets / JSP Interview questions
http://www.questpond.com/ServletsJSP.zip
Architecture Interview Question
http://www.questpond.com/ArchitectureInterviewQuestions.zip
Project Management Interview questions must to read for all aspiring
project managers
http://www.questpond.com/ProjectManagementInterviewQuestions.zip
Full Address book application in C# with technical specification ,
estimation and test cases
http://www.questpond.com/AddressbookProject.zip
Web services Interview questions
http://www.questpond.com/WebServicesAndRemoting.zip
SQL Server 2005 Database optimization Interview questions
http://www.questpond.com/DatabaseOptimization.zip
SQL Server 2005 DTS Interview questions
http://www.questpond.com/DTSInterviewQuestions.zip
SQL Server datawarehoue and Data mining Interview questions
http://www.questpond.com/DatawareHousingandDataMining.zip
SQLCLR Interview questions
http://www.questpond.com/SQLCLRInterviewquestion.zip
SQL Server XML Interview questions
http://www.questpond.com/SQLServerXML.zip
Basic .NET Framework interview questions
http://www.questpond.com/FrameWorkSampleInterviewQuestions.zip
.NET Interop and COM Interview questions
http://www.questpond.com/InteropdotnetInterviewQuestions.zip
ASP.NET Caching Interview questions
http://www.questpond.com/CachingInterviewQestions.zip
Do not know how estimations are done here's a complete book on it
http://www.questpond.com/HowtoPrepareSoftwareQuotations.zip
|
| Author |
Message |
gabriele

|
Posted: 2006-6-12 0:09:00 |
Top |
java-programmer, The simplest way to show a large output string?
Hi,
What I want to do is quite simple: I want to show a large output String.
The user then will press "OK"; then the output window disappears, and
the program continues.
The following code would be ok for me, but the real String I want to
show is very long (let's say 1000 characters and 100 lines), so I need
scrollbars...
Could you please tell me the simplest way to achieve this? Thanks in
advance for your help.
==========================
package gui;
import javax.swing.*;
public class Prova {
public static void main(String[] args) {
String s = "hello";
JOptionPane.showMessageDialog(null, s);
System.exit(0);
}
}
=====================
|
| |
|
| |
 |
IchBin

|
Posted: 2006-6-12 1:21:00 |
Top |
java-programmer >> The simplest way to show a large output string?
gabriele wrote:
> Hi,
> What I want to do is quite simple: I want to show a large output String.
> The user then will press "OK"; then the output window disappears, and
> the program continues.
>
> The following code would be ok for me, but the real String I want to
> show is very long (let's say 1000 characters and 100 lines), so I need
> scrollbars...
>
> Could you please tell me the simplest way to achieve this? Thanks in
> advance for your help.
>
[snip code]
How about something like this?
import java.awt.Dimension;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
public class Prova
{
public static void main(String[] args)
{
String text = "Veryyyyyyyyyyyyyyyyyyyyyyy "
+ "Longgggggggggggggggggggggggggggggggggg"
+ "Messageeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeessssssss\n\n"
+ "Veryyyyyyyyyyyyyyyyyyyyyyy "
+ "Longgggggggggggggggggggggggggggggggggg"
+ "Messageeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeesssssss\n\n"
+ "Veryyyyyyyyyyyyyyyyyyyyyyy "
+ "Longgggggggggggggggggggggggggggggggggg"
+ "Messageeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeessssssss\n\n"
+ "Veryyyyyyyyyyyyyyyyyyyyyyy "
+ "Longgggggggggggggggggggggggggggggggggg"
+ "Messageeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeessssssss\n\n";
JPanel panel = new JPanel();
JTextPane textPane = new JTextPane();
JScrollPane jScrollPane = new JScrollPane(textPane);
jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
textPane.setPreferredSize(new Dimension(400, 200));
textPane.setText(text);
panel.add(new JScrollPane(jScrollPane));
JOptionPane.showMessageDialog(null, panel);
System.exit(0);
}
}
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
|
| |
|
| |
 |
IchBin

|
Posted: 2006-6-12 1:26:00 |
Top |
java-programmer >> The simplest way to show a large output string?
gabriele wrote:
> Hi,
> What I want to do is quite simple: I want to show a large output String.
> The user then will press "OK"; then the output window disappears, and
> the program continues.
>
> The following code would be ok for me, but the real String I want to
> show is very long (let's say 1000 characters and 100 lines), so I need
> scrollbars...
>
> Could you please tell me the simplest way to achieve this? Thanks in
> advance for your help.
[snip code]
How about something like this?
import java.awt.Dimension;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
public class Prova
{
public static void main(String[] args)
{
String text = "Veryyyyyyyyyyyyyyyyyyyyyyy "
+ "Longgggggggggggggggggggggggggggggggggg"
+ "Messageeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeessssssss\n\n"
+ "Veryyyyyyyyyyyyyyyyyyyyyyy "
+ "Longgggggggggggggggggggggggggggggggggg"
+ "Messageeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeesssssss\n\n"
+ "Veryyyyyyyyyyyyyyyyyyyyyyy "
+ "Longgggggggggggggggggggggggggggggggggg"
+ "Messageeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeessssssss\n\n"
+ "Veryyyyyyyyyyyyyyyyyyyyyyy "
+ "Longgggggggggggggggggggggggggggggggggg"
+ "Messageeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeessssssss\n\n";
JPanel panel = new JPanel();
JTextPane textPane = new JTextPane();
JScrollPane jScrollPane = new JScrollPane(textPane);
jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
textPane.setPreferredSize(new Dimension(400, 200));
textPane.setText(text);
panel.add(jScrollPane);
JOptionPane.showMessageDialog(null, panel);
System.exit(0);
}
}
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
|
| |
|
| |
 |
gabriele

|
Posted: 2006-6-12 2:10:00 |
Top |
java-programmer >> The simplest way to show a large output string?
On Sun, 11 Jun 2006 13:25:56 -0400, "IchBin" wrote:
>> Could you please tell me the simplest way to achieve this? Thanks in
>> advance for your help.
>
>[snip code]
>
>How about something like this?
[]
Thank you very much, that's exactly what i was looking for.
Bye,
Gabriele.
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- JAXB XML Max SizHello All:
I am using JAXB to reading (unmarshall) a XML feed which
is about 4GB of siz. The JAXB seems
can not doing its job. Any one knows how to solve this problem?
ps: does JAXB has a limitation over XML feed size?
Many Thanks!
- 2
- JTable and Custom Default Cell Editors
From: "Erica Wheatcroft" <email***@***.com>
Subject: JTable
Date: Thursday, January 20, 2005 4:17 PM
HI -
I have a jtable that uses two custom default cell editors to create combo
boxes for two of the the 4 columns. If the user selects another value from
either of the combo boxes i want to know that so i can indicate a save must
occur. I'm not sure what event i should listen to? Does any one have any
suggestions?
Thanks in advance.
Erica
- 3
- Please help..nu bee correct probable path.. (?)
ahmed khalak wrote:
> Hi
> Thank in advance.... I am getting error when I run from prompt (cmd)..
> I installed Jdk1.5.0_09 path is C:\Program files\Java\Jdk1.......
> I have oracle 9i and oracle 10g installed...
> Path and classpath I have put correctly in windowxp.. as follow
> path=C:\oracle..etc ;C:\Program File\java\Jdk1.5.0_09\bin
> classpath= .;C:\Program File\java\Jdk1.5.0_09\lib\root.jar
> Now when I check version for java and javac.. in other then Jdk1 directory
> I am getting version 1.3.1 where as jdk gives me it version I checked oracle
> directories
> In Oracle directory.. jre show 1.3.1 directory...
> how can I correct this problem.. my simple program compiles but running from
> promp gives error..
>
> would highly appreciate help
> :-) just starting learning Java..
>
> A Khalak
Change the path setting so it reads:
PATH=C:\Program File\java\Jdk1.5.0_09\bin;C:\oracle;...
The OS looks for commands on the PATH from left to right, so starting
with java, then oracle, and so on.
Besides this. The classpath setting isn't really needed. This is a
general note which might bring in problems later. If you don't have a
real need for it, simply remove the classpath setting. You can still
pass it to the java command using the "-classpath" switch.
Regards,
Bart
- 4
- empty interfaces via reflectionOn Oct 14, 12:17 pm, "Aryeh M. Friedman" <email***@***.com>
wrote:
> On Oct 14, 6:01 pm, Steven Simpson <email***@***.com> wrote:
>
>
>
> > Aryeh M. Friedman wrote:
> > > Then how do you handle the return type?!?!?!? Namely I can't do:
>
> > > Class<?> testClass = loadTestClass();
> > > Object testInstance = testClass.newInstance();
> > > Result res=new Result();
>
> > > for (Method method: testClass.getDeclaredMethods())
> > > res.merge((Result) method.invoke(testInstance, new
> > > Object[0])); // cast exception
>
> > > The reason why it is not possible is any Result object created by a
> > > test is <MyClassLoader>.Result and all the results here are
> > > <SystemClassLoader>.Result
>
> > Looking back at an earlier post, your custom MyClassLoader goes like this:
>
> > > public class MyClassLoader extends ClassLoader
> > > {
> > > public Class loadClass(String name)
> > > {
> > > try {
> > > if(name.startsWith("java."))
> > > return super.loadClass(name);
>
> > A custom ClassLoader is expected to override findClass(String) rather
> > than loadClass(String), as the latter (indirectly) accomplishes this
> > behaviour:
>
> > <http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html>
>
> > "When requested to find a class or resource, a ClassLoader instance will
> > delegate the search for the class or resource to its parent class loader
> > before attempting to find the class or resource itself."
>
> > MyClassLoader is loading Result instead of delegating to its parent
> > first, which should always find it first.
>
> I just tested:import java.io.*;
> import java.lang.reflect.*;
>
> public class MyClassLoader extends ClassLoader
> {
> public Class findClass(String name)
> {
> try {
> //if(name.startsWith("java."))
> // return super.loadClass(name);
>
> FileInputStream fis=new FileInputStream(name
> +".class");
> byte[] b=new byte[fis.available()];
>
> fis.read(b);
> fis.close();
>
> return defineClass(name,b,0,b.length);
> } catch(Throwable e) {
> e.printStackTrace();
> }
>
> return null;
>
> }
>
> and now the class loader no longer honors recompiled classes:
>
> Script started on Sun Oct 14 15:09:05 2007
> jtest@monster:/home/jtest% java Main
> 1
> ^Z
> Suspended
> jtest@monster:/home/jtest% cat foo
> import java.lang.reflect.*;
>
> public class MyClass
> {
> public MyClass()
> {
> ack=new Integer(2);
> }
>
> public Integer getAck()
> {
> return ack;
> }
>
> private int foo;
> private Integer ack;}
>
> jtest@monster:/home/jtest% cp foo MyClass.java
> jtest@monster:/home/jtest% javac MyClass.java
> jtest@monster:/home/jtest% fg
> java Main
>
> 1
> ^C
> jtest@monster:/home/jtest% exit
> Script ends on Sun Oct 14 15:09:45 2007
>
> Just for ref here is the new main():
>
> public class Main
> {
> public static void main(String[] args)
> throws Throwable
> {
> while(true) {
> ClassLoader loader=new MyClassLoader();
> Class klass=loader.loadClass("MyClass");
>
> MyClass m=(MyClass) klass.newInstance();
>
> System.out.println(m.getAck());
> System.in.read();
> }
> }
>
> }
You should simply use UrlClassLoader and have the system classpath not
include your code that needs to be reloaded, and the URLClassLoader
have the path that DOES need to be reloaded (creating a new instance
of that class loader every time you need to reload the class)
That way, Result will be properly loaded by the System class loader,
and your reloadable class wont.
Hoep this helps,
Daniel.
- 5
- Problem in configuring SSL in Tomcat5.5Hi,
I have Tomcat5.5 and J2sdk5 installed on my system. I wanted turn on
SSL services in tomcat. I went through the Tomcat Documentation and
did it exactly. I modified server.xml as below,
<!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
<Connector port="8443" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25"
maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
I also created certificate using keytool with default password as
"changeit" and alias as "tomcat".
I restarted the tomcat services too, and then tried to access the page
but i am not able to access it using https connection. Where as i am
able to access same page using Http connection.
Secondly, I am not able to access default tomcat Page too using Https
connection. Everything works fine in case of HTTP connection.
Following is the way iam trying to acces the page,
https://localhost:8443
Can any one help me out to find the problem.
I have IE 6 with SP2 installed on my system.
Thanks
Minesh
- 6
- Still looking for a Job?
http://www.xrecruiter.com is a SPAM free Recruiter Community. Post
your resume for free, get noticed directly by recruiters. Register for
free.
- 7
- passing RequestPath to error page from web.xmlHi,
I have pointed any errors to Error.jsp in my web.xml file (as shown).
<error-page>
<error-code>500</error-code>
<location>/Error.jsp?id=500</location>
</error-page>
As you can see I also pass the type of error, is there any way I can
pass the RequestPath that resulted in the error in the first place?
Cheers,
Paul
- 8
- UK Postcodes anyone know of a service ?Hi
My latest web application provides a search facility.
You sign up as a member and get a free entry in a searchable database.
I would like to offer a postcode search so that if someone is looking for a
particular service they can enter a postcode and return results within a number
of miles of the input postcode(s). I have seen this sort of search on a number
of sites to date and I was wondering if anyone knows of a web service or other
online service that will accept a post code (and some other params of course)
and return a list of postcodes within a parameters distance.
Once I have the list I can search my own database for results.
The service must be available over the network, I'm not intetested in static
databases that I have to install on the server (well I might be if they were
FREE :-).
Has anyone implemented such a thing ?
Does anyone know of such a service ?
Has this got anything to do with the group ? well I suppose not other than I
write in Java.
Cheers
anyway
Duncan
"Process- How will the work and the team be organized?
The team needs to fit the culture in which it will operate,
but you should write software well rather than preserve the
irrationality of an enclosing culture" - Kent Beck
- 9
- An efficient computation idea. Please commentHi,
In my program I evaluate long trigonometric polynomials a lot! For example,
final int N = 1000;
double[] c = new double[N];
// Populate c
double x = .5, sum = 0.0;
for (int i = 0; i < N; i++)
sum += c[i]*cos(i*x);
And this function is evaluated very many times (about 100,000). So why not
create a java snippet, compile it, load it as a class and use the compiled
version. So I would have something like;
String sum = "0"; // A String buffer, of course...
for (int i = 0; i < N; i++)
sum += "+" + c[i] + "*cos(" + i + "*x)";
sum += ";";
I think it's a pretty cool idea. But before I implement it, I would like to
know what you think about it!
Thank you in advance!
Aaron Fude
- 10
- Multiple installs of JDKWhen you do a silent install of the JRE you have the option to pass
PRIVATE=1, resulting in an install which doesn't check the registry
for a prior installation, and doesn't update the registry. You can
therefore have more than one install of the same JRE.
I need to find a similar capability for the JDK, but can't seem to. We
get rc=1603 on the second JDK install.
How can this be done...?
JDK >= 1.5.
{{{ Andy
- 11
- Tomcat on Windows: JAVA_HOME & -Dsun.io.useCanonCaches'Apologies for posting this here, but I couldn't find any Tomcat user
forum.
A colleague is currently trying to run Tomcat 4.1.30 on Windows 2000
Professional. She first installed JRE2 1.4.2_08, and set %JAVA_HOME%
to the directory C:\j2re1.4.2_08 - I've run "java -version" and it
works fine.
(%JAVA_HOME%/home is in the path correctly).
She then installed Tomcat to C:\jakarta-tomcat-4.1.30.
However, when she runs catalina.sh start, she gets the following
error:
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
Using CATALINA_BASE: C:\jakarta-tomcat-4.1.30
Using CATALINA_HOME: C:\jakarta-tomcat-4.1.30
Using CATALINA_TMPDIR: C:\jakarta-tomcat-4.1.30\temp
Using JAVA_HOME: C:\j2re1.4.2_08
'-Dsun.io.useCanonCaches' is not recognized as an internal or external
command,
operable program or batch file.
I've even tried adding the following to catalina.bat without success:
if not "%JAVA_HOME%" == "" goto gotJavaHome
set JAVA_HOME=C:\j2re1.4.2_08
:gotJavaHome
Can anyone see where we might be going wrong?
Cheers,
P.
- 12
- Running server-side Java on FreeBSD in production environments
So, I've seen a few mentions here of folks using Java server apps on
FreeBSD in production. I've been very happy to watch the progress by the
Java team on the native JDKs from the sidelines, as well as the
improvements to libc_r and such that have been MFC'd, but I'm curious as
to whether the consensus on this list is that it's ready to be used for
production. Anyone want to share good success or horror stories? We're
trying to determine whether the apache.org box can start to run our own
software. :) Speed is definitely less important than proper functioning.
Brian
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 13
- Initialize managed bean with header information?We use Netegrity's SiteMinder for SSO security on all web apps.
Although SiteMinder handles security for accessing the application
itself, restrictions to certain functions and data are handled within
the application based on user type.
The user information (such as name, type, etc.) are passed in from
SiteMinder via header variables. ie:
hddr_user = Joe Blo
hddr_group = Admin
hddr_phone = 555-555-5555
I'm looking at different designs to capture all of this user
information from the headers at one time and store as a bean in the
user's session (so as to not need to continually reference the header
information).
Does anyone know if you can create a managed bean (ie. User) that is
initialized with header information (by using the configuration file
w/ value-binding expressions)?
- 14
- Simple GUI Image ProblemComputing student here, haven't used java for a while. Anyways, could someone put some example code as to how to put an image from a file onto a JPanel or JFrame. I just can't remember.
- 15
- Getting JAVA_HOME at runtimeHello,
The Java ports infrastructure provides JAVA_HOME on build-time to
port's Makefile. But is it possible to get this variable from
/usr/local/bin/java at runtime?
How to change the Java version for a port at runtime in the rc
script? It is possible to set the preferred JDK in
/usr/local/etc/javavms but then JAVA_HOME still needs to be
set manually.
I would like to avoid hard-coding the JAVA_HOME at build time in
the rc scripts.
Any idea?
--
Jean-Baptiste Quenot
aka John Banana Qwerty
http://caraldi.com/jbq/
|
|
|