| Creating an object during runtime |
|
 |
Index ‹ java-programmer
|
- Previous
- 4
- You have received 5 notifications from your fans!Alyssa
<http://www.fanbox.com/socnet/EmailStat.aspx?cmp=&xyz=1&lit=5&me=xAr3pqu
jU0kBSGmCF6dKsg==&fan=F1Qw1zM6IEk=&opg=http://profile.fanbox.com/profile
/NewCustomProfile.aspx?u=alyssawilcox591> sent you a fan request.
Automatically sign in
<http://www.fanbox.com/socnet/EmailStat.aspx?cmp=&xyz=1&lit=5&me=xAr3pqu
jU0kBSGmCF6dKsg==&fan=F1Qw1zM6IEk=&opg=http://profile.fanbox.com/Inbox/M
ain.aspx?messages=3> to view Alyssa's profile and to accept or reject
her fan request.24 hours ago
Alyssa
<http://www.fanbox.com/socnet/EmailStat.aspx?cmp=&xyz=1&lit=5&me=xAr3pqu
jU0kBSGmCF6dKsg==&fan=F1Qw1zM6IEk=&opg=http://profile.fanbox.com/profile
/NewCustomProfile.aspx?u=alyssawilcox591> sent you a fan request.
Automatically sign in
<http://www.fanbox.com/socnet/EmailStat.aspx?cmp=&xyz=1&lit=5&me=xAr3pqu
jU0kBSGmCF6dKsg==&fan=F1Qw1zM6IEk=&opg=http://profile.fanbox.com/Inbox/M
ain.aspx?messages=3> to view Alyssa's profile and to accept or reject
her fan request. 24 hours ago
Alyssa
<http://www.fanbox.com/socnet/EmailStat.aspx?cmp=&xyz=1&lit=5&me=xAr3pqu
jU0kBSGmCF6dKsg==&fan=F1Qw1zM6IEk=&opg=http://profile.fanbox.com/profile
/NewCustomProfile.aspx?u=alyssawilcox591> sent you a fan request.
Automatically sign in
<http://www.fanbox.com/socnet/EmailStat.aspx?cmp=&xyz=1&lit=5&me=xAr3pqu
jU0kBSGmCF6dKsg==&fan=F1Qw1zM6IEk=&opg=http://profile.fanbox.com/Inbox/M
ain.aspx?messages=3> to view Alyssa's profile and to accept or reject
her fan request. 24 hours ago
There are 2 additional fan requests to review
<http://www.fanbox.com/socnet/EmailStat.aspx?cmp=&xyz=1&lit=5&me=xAr3pqu
jU0kBSGmCF6dKsg==&fan=F1Qw1zM6IEk=&opg=http://profile.fanbox.com/Inbox/M
ain.aspx?messages=3> .
Click here to view ALL notifications
<http://www.fanbox.com/socnet/EmailStat.aspx?cmp=&xyz=1&lit=5&me=xAr3pqu
jU0kBSGmCF6dKsg==&fan=F1Qw1zM6IEk=&opg=http://profile.fanbox.com/Inbox/M
ain.aspx?messages=> Change your Email Summary Settings
<http://www.fanbox.com/socnet/EmailStat.aspx?cmp=&xyz=4&lit=5&me=xAr3pqu
jU0kBSGmCF6dKsg==&fan=F1Qw1zM6IEk=&opg=http://profile.fanbox.com/Prefere
nces/Main.aspx?open=emailPref>
You can control
<http://www.fanbox.com/socnet/EmailStat.aspx?cmp=&xyz=4&lit=5&me=xAr3pqu
jU0kBSGmCF6dKsg==&fan=F1Qw1zM6IEk=&opg=http://profile.fanbox.com/Prefere
nces/Main.aspx?open=emailPref> the frequency of these summary emails.
FanBox - 255 G Street #723, San Diego, CA 92101, USA
- 6
- pass by referenceAndreas Leitgeb wrote:
> Patricia Shanahan <email***@***.com> wrote:
>> The issue is more critical for people for whom "pass by reference" is
>> familiar language. They will think they know what it means, and have to
>> find out somehow that it means something entirely different, when
>> talking about Java, that it does when talking about other languages.
>
> By the way, this is also true for "reference" itself. They also have
> to learn that what Java calls a reference wouldn't be called that way
> in other languages, for exactly the reasons you wrote (null allowed,
> assignment-semantics).
Indeed, I think the choice of "reference" to mean "pointer or null" was
a bad one. It would have been better to call a pointer a pointer, and
note that it can be null.
For the benefit of people transitioning from C or C++, it may be
necessary to note that it does not have pointer arithmetic or unsafe
conversions.
> Why is it ok, to talk of references in Java, but have an entirely
> different meaning of "reference" in mind in context of the phrase
> "pass by reference"?
"pass by reference" (or more usually "call by reference") is a long
standing term with a meaning independent of the use of "reference" as a
freestanding term. I learned it long before I knew any language in which
one could actually have a reference. I don't see any reason why having
to learn a Java-specific meaning of reference should require people to
learn special meanings of other terms, especially when with have a
perfectly good phrase, "pass reference by value", that is only one word
longer and says *exactly* how Java behaves.
Patricia
- 7
- 7
- Problem running the hello world servletI installed j2sdk1.4.2_12, and apache tomcat 4.1.34, on a windows XP
box. I set the following environment variables:
CATALINA_HOME C:\apache-tomcat-4.1.34
CLASSPATH C:/Program
Files/Java/jre1.5.0/lib/xt/QTJava.zip;C:/j2sdkee1.3.1/lib
J2EE_HOME C:/j2sdkee1.3.1
JAVA_HOME C:/j2sdk1.4.2_12
PATH C:\j2sdk1.4.2_12\bin\
I edited the web.xml in C:\apache-tomcat-4.1.34\conf and uncommented
the invoker servlet tag so that I can run servlets.
I can now access jsp and html pages with tomcat, but when I tried to
run HelloWorld Servlet, it gives the following error:
ava.util.MissingResourceException: Can't find bundle for base name
LocalStrings, locale en_US
at
java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:838)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:807)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:578)
at HelloWorldExample.doGet(HelloWorldExample.java:38)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:696)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:417)
at
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:131)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:696)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:198)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:595)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:432)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:954)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:138)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:595)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:432)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:954)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2459)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:132)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:595)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:593)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:593)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:432)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:954)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:126)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:595)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:432)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:954)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
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(Thread.java:534)
What could be the problem?
- 7
- Java Object Persistence (JSP & Java)Hi all.
I'm currently working on a simulation with a web frontend. The
simulation is based on 3 components:
- A Webfrontend
- A persister (which is the object of my quetsio :-)
- A WorkHorse
The Workhorse is doing the actual simulation while the web frontend is
used to interact with the Simulation (queueing and dequeueing new
events to the simulation stack).
Now my question is what the best choice for the persister would be.
I found http://www.prevayler.org/wiki.jsp which looks nice but I don't
know if it's the best choice. Is there a library that transparently
saves and loads whole Object dependencies from an SQL Database, or is
an Object Cloud better?
What is your experience with this/other libraries?
- 8
- Image from WebHi all, I need to read an image located in http://www.xxx.yyy/eee/test.jpg
...how can I do?
How can I display once readed in a swing interface?
thanks.
mario
- 12
- Inline bytecode?Is it possible to do iline bytecode in Java? Sort of like inline asm
in c++, but platform independent.
- 12
- "class not found".I'm getting the dreaded "class not found" error. I've Googled this
error and found that it's quite common, but not in exactly the way I
get it. My applets run fine on my machine, both when tested locally
via a local HTML file, and also when going to website, but gives the
"Class not found" error other machines. Anyone have any idea what
might be wrong?
I suspect it may be a codebase error, but I've tried the following in
my HTML file without success:
<APPLET CODE="moonCalendar.class"
name = "moonCalendar" WIDTH=1000 HEIGHT=350>
<APPLET CODE="moonCalendar.class" codebase="."
name = "moonCalendar" WIDTH=1000 HEIGHT=350>
<APPLET CODE="moonCalendar.class"
codebase="http://www.ckolchak.com"
name = "moonCalendar" WIDTH=1000 HEIGHT=350>
You can see if it works on your machine by going to:
http://www.ckolchak.com/astroCalendar.htm
- 12
- Intellij 5.1 compile time error..hi,
I am using Intellij 5.1 version. Each time I build the project I get
an error:
error: Compiling Web Module 'web':Invalid file
and the file is in the "deploy" folder
So each time I go into the folder and maually delete the .war file and
then when I build the project it works fine.
>From what I have seen one more person using the same version has this
problem. but the one's using the earlier versions don't have this
problem.
Is there any solution for this?
thanks,
- 12
- how to hide tabs in JTabbedTableHello all
I have a JTabbedTable with many tabs with JPanel in it. I want in a state,
only some tabs are shown and other states, other tabs are shown. I used
setVisible(boolean) but it does not work. could you please help
thank you
S.Hoa
- 14
- Java Timer, swingDear Java experts,
I'm struggling with timers. I've used javax.swing.Timer in my program. But
when one doesn't have the jre installed, my program doesn't work. It then
gives a class not found exception in the browser. It only works on the sun
virtual machines which you have to download from the website like some jre.
I quess the swing library isn't supported by a lot of virtual machines. But
I'm happy about how the timer works in my program because it makes use of
the actionListener.
Is there some easy solution? Using a simple Timer like the swing version and
let it work on any virtual machine/ jre?
best regards,
Piet den Dulk (Netherlands)
- 15
- JRE versionsWe have in our company several applications that require JRE to work.
They have been developed by different people and some require specific
versions of Java to work correctly.
Normally the applications work well individually but sometimes, when we
need to work with some of them that require different JRE versions, we
are in trouble.
How can we deal with this problem? Why last versions of JRE are not
full compatible with the previous ones?
Greetings,
Samu
- 15
- JNI CallStaticVoidMethod fails after N callsI have written an application in Java and C on the Solaris 10 (x86)
platform using the JDK 1.5.0_09. The Java code calls a native method
"startButtonWatcher," which then forks, the parent process returning,
and the child process initiating an event loop that calls a static
method, "sendButtonEvent," on a Java class "ButtonWatcher."
The problem is that on the 65 invocation, the CallStaticVoidMethod will
hang. There is no core file or pid log file produced. (it will also
hang for CallVoidMethod as well if I remove the static declaration in
ButtonWatcher.)
I have also added a main() function to the C code so that it can be
compiled and run as an executable rather than a library file loaded
from Java, and the the same loop will be fine, the Call*Method call
being exected forever (or over a million times at least). The only
difference in the code is the JVM--in the sharable library, it uses the
JVM of the class that calls the native method, and the standalone has
to create its own. What could be the problem? Thanks!
- 15
- ports/69675: Eclipse slow typingSynopsis: Eclipse slow typing
Responsible-Changed-From-To: freebsd-ports-bugs->java
Responsible-Changed-By: ijliao
Responsible-Changed-When: Wed Jul 28 02:09:00 GMT 2004
Responsible-Changed-Why:
over to maintainer
http://www.freebsd.org/cgi/query-pr.cgi?pr=69675
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 15
- Could you write this sound applet?As a start, consider this simple QBASIC program that generates random
frequencies:
10 frequency = 40 + 400 * RND
20 SOUND frequency, 7
30 GOTO 10
That's fine - except that it plays over the PC speaker - the one that's
just there for the happy beep - and not through the sound card and
proper speakers. You can't control volume, either.
I wonder if anyone would be kind enough to translate the above three
line program into a Java applet. I would like to see whether it looks
simple enough for me to cope with.
If it looks as if I could cope with Java, I would then learn it, and try
to program a way of generating sounds from a mathematical sequence or
formula.
--
Chris
|
| Author |
Message |
Peter Jones

|
Posted: 2005-11-30 5:50:00 |
Top |
java-programmer, Creating an object during runtime
I'm trying to generate an object name during run time, and then create an
object with the contents of that variable. You can see that I'm trying to
also make the object name self generating (almost, the 'y' variable isnt
being incremented yet), putting two values ('y' and 'C'). My apologies for
poor coding structure / lack of comments, but I'm am a bit lost on how to
work it out. MANY thanks in advance.Heres what I have so far:
public class testVariable
{
private String name = "";
private String New_name = "";
private int y = 2;
public testVariable()
{}
public void test(String x)
{
name = x;
New_name = name + y ;
System.out.println(New_name);
}
public String getNew_name()
{
return New_name;
}
public static void main(String[] args)
{
int z = 2;
testVariable Darren = new testVariable();
Darren.test("C");
testVariable "c"+ z = new testVariable();
String Old_name = New_name;
}
}
|
| |
|
| |
 |
Tjerk Wolterink

|
Posted: 2005-11-30 6:08:00 |
Top |
java-programmer >> Creating an object during runtime
Peter Jones wrote:
> I'm trying to generate an object name during run time, and then create an
> object with the contents of that variable. You can see that I'm trying to
> also make the object name self generating (almost, the 'y' variable isnt
> being incremented yet), putting two values ('y' and 'C'). My apologies for
> poor coding structure / lack of comments, but I'm am a bit lost on how to
> work it out.
I cannot help you if you don't document your code.
|
| |
|
| |
 |
zero

|
Posted: 2005-11-30 6:16:00 |
Top |
java-programmer >> Creating an object during runtime
Peter Jones <email***@***.com> wrote in
news:dmiier$1ql$email***@***.com:
> I'm trying to generate an object name during run time, and then create
> an object with the contents of that variable. You can see that I'm
> trying to also make the object name self generating (almost, the 'y'
> variable isnt being incremented yet), putting two values ('y' and
> 'C'). My apologies for poor coding structure / lack of comments, but
> I'm am a bit lost on how to work it out. MANY thanks in advance.Heres
> what I have so far:
>
> public class testVariable
Please start class names with a capital letter.
> {
> private String name = "";
> private String New_name = "";
Please don't start variable names with a capital letter.
> private int y = 2;
>
> public testVariable()
> {}
>
> public void test(String x)
> {
> name = x;
> New_name = name + y ;
> System.out.println(New_name);
> }
>
> public String getNew_name()
> {
> return New_name;
> }
>
>
>
> public static void main(String[] args)
> {
> int z = 2;
> testVariable Darren = new testVariable();
Please don't start variable names with a capital letter.
> Darren.test("C");
> testVariable "c"+ z = new testVariable();
This line can't possibly compile correctly. What are you trying to do
here?
> String Old_name = New_name;
> }
> }
>
If you want to create objects at runtime you need the reflection api.
For example, to create a new object of class C2:
Class classDefinition = Class.forName("C2");
Object object = classDefinition.newInstance();
Here object will be an instance of C2.
--
Beware the False Authority Syndrome
|
| |
|
| |
 |
Peter Jones

|
Posted: 2005-11-30 6:43:00 |
Top |
java-programmer >> Creating an object during runtime
Tjerk Wolterink wrote:
> Peter Jones wrote:
>> I'm trying to generate an object name during run time, and then create an
>> object with the contents of that variable. You can see that I'm trying to
>> also make the object name self generating (almost, the 'y' variable isnt
>> being incremented yet), putting two values ('y' and 'C'). My apologies
>> for poor coding structure / lack of comments, but I'm am a bit lost on
>> how to work it out.
>
> I cannot help you if you don't document your code.
I will re-edit my code and post back as soon as I can.
|
| |
|
| |
 |
Peter Jones

|
Posted: 2005-11-30 7:10:00 |
Top |
java-programmer >> Creating an object during runtime
zero wrote:
> If you want to create objects at runtime you need the reflection api.
> For example, to create a new object of class C2:
>
> Class classDefinition = Class.forName("C2");
> Object object = classDefinition.newInstance();
>
> Here object will be an instance of C2.
Allow me to attempt to clarify. I'm trying to make an object of type class,
during runtime. The problem is, that I need to make the objectname
automatically increment as the objects are created.
e.g.
C1 C2 C3 C4 etc.
(list of created objects..)
However, I cant use a variable as a parameter in the constructor, as it uses
the variable name as the object name, not the contents of the variable.
e.g.
car = C1;
vehicle car = new vehicle();
In the above line, the new object I have created is "car" and not C1. I need
it to be C1. Your reference to the reflection API has been helpful, but I
dont see where I can use a variable of somekind, or other similar
mechanism, to let me create objects with a new object name, incremented
automatically.
again, Many Thanks in advance
|
| |
|
| |
 |
Stefan Schulz

|
Posted: 2005-11-30 7:36:00 |
Top |
java-programmer >> Creating an object during runtime
On Tue, 29 Nov 2005 22:15:36 +0000, zero wrote:
>
> If you want to create objects at runtime you need the reflection api.
> For example, to create a new object of class C2:
>
> Class classDefinition = Class.forName("C2");
> Object object = classDefinition.newInstance();
>
> Here object will be an instance of C2.
Just to nitpick: You create all your objects at runtime, no matter if you
use reflection, or not.
Back on topic:
As far as i can see, the original author wants to create _classes_ at
runtime, for which there are some libraries available, but nothing in the
standard API... though i doubt that this is the solution to the OPs
question. Some more details about what he is trying to do (as opposed on
how he tries to do it) might help.
--
You can't run away forever,
But there's nothing wrong with getting a good head start.
--- Jim Steinman, "Rock and Roll Dreams Come Through"
|
| |
|
| |
 |
Roedy Green

|
Posted: 2005-11-30 8:55:00 |
Top |
java-programmer >> Creating an object during runtime
On Wed, 30 Nov 2005 00:19:09 GMT, zero <email***@***.com> wrote, quoted or
indirectly quoted someone who said :
>where the names c1, c2, ... are computed at runtime, correct?
to get that literally you have to generate class files or *.java
files on the fly and compile them.
See http://mindprod.com/jgloss/jasm.html
http://mindprod.com/jgloss/javacexe.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
|
| |
|
| |
 |
Chris Smith

|
Posted: 2005-12-1 7:18:00 |
Top |
java-programmer >> Creating an object during runtime
Peter Jones <email***@***.com> wrote:
> Allow me to attempt to clarify. I'm trying to make an object of type class,
> during runtime. The problem is, that I need to make the objectname
> automatically increment as the objects are created.
> e.g.
> C1 C2 C3 C4 etc.
> (list of created objects..)
It will eventually be important for you to realize that objects simply
don't have names. For that reason, it's impossible to answer your
question of how to create objects with certain names. It would be like
asking a car salesman how to specify which color wings your new car will
come with.
What objects *do* have is references that point to them. References can
be stored in variables, which *do* have names. However, there is no way
to declare a new variable at runtime (except for, as someone pointed
out, creating a whole new class and generating Java bytecode to declare
variables in that class, then loading that class into the application at
runtime; you probably don't want to do that).
So the question is what exactly you mean by "name", and why you want to
do what you're asking for. "Zero" took some good guesses, but this
would be easier if you'd explain yourself. Chances are, using a HashMap
is the best option.
--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Carbon AS CE IOC-JMX Architecture V 0.2 is releasedCarbon AS Community Edition is a JMX compliant Open Source J2EE
Application Server project initiated by Aquosine (http://
www.aquosine.com). Carbon AS Community Edition is released under LGPL
and is free to use, modify and distribute. Aquosine is an open
standards based enterprise solutions provider.
Please visit the thread: http://www.theserverside.com/discussions/
thread.tss?thread_id=44178
-Abhilash
- 2
- Software QA InterviewSoftware QA Interview
http://trailfire.com/frank/trails/31938
Don't be SCARED. Be PREPARED. Practice interview questions before your
interview. Preparing your answers ahead of time makes you feel more
confident and gets you hired faster...
- 3
- I WANT YOU I WANT YOU
I LIKE YOU
PLEASE CLICH THIS:
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
http://myprofile3210.blogspot.com
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- 4
- Username String suggestionI'm doing Java excercises in University. Part of a program I am working on
requires me to input a both a surname and forename together and have the
program output the forename name only.
e.g:
Please enter student's name: Yuriy Ivanov
Yuriy scored (+ score) which is a (+ grade)
The only way I can think of doing this is to use a String method to output
everything until it hits a space, does this sound probable?
Of course, I would need validation incase only a space is entered.
If this sounds like I'm on the right lines please can someone tell me how
to do that, if not please can someone tell me a better way. I've only know
of String concatination which is the opposite of what I need.
If there is a way to do this without methods I'd prefer to have that as
this part of the program isn't meant to include methods or arrays yet.
Thank you in advance.
- 5
- how to make of a specific row toprow in jtableHi,
Please can you tell me how to make of a specific row the first row in
the visible area of a jtable.
For example:
i have a 100 rows and only then a visible.
Now i want to make of row 34, for example, the first one in the
visible area.
How can i do that.
Thank you.
Anand
- 6
- serialVersionUID.. ?Hello ,
I posted this message in the Eclpse group with no responses. I am using
Eclipse.
I resolved by defining this in my class:
static final long serialVersionUID = 0;
Now, all of a sudden, this is not working and getting error:
Syntax error on token "DETAIL_FOOTER", VariableDeclaratorId expected after
this token
Happens when I define this class var in applet or interface:
private DETAIL_FOOTER = "# detail footer";
I do not have a clue! Any one have any Ideas?
--
Thanks in Advance...
IchBin
_____________________________________________
'Black holes are where God divided by zero.'
-Steven Wright, comedian (1955- )
- 7
- url rewriting when the url contains parametersHi,
I am trying to maintain sessions by doing URL rewrite. Things were
working fine till the URL did not contain any parameters. The URL that
I have now is of the form:
http://myurl?id=1&user=null and on doing a sessionID append it becomes
http://myurl?id=1&user=null;jsessionId=xyzw..
Things still get authenticated but now when I try and get the value of
user I get passed the whole string after user= and not just null.
What is the right way to append the sessionID? Btw, I am using the URL
to connect to a servlet from a j2me client.
Thanks,
Gaurav
- 8
- ANN: New XML Differencing, Updated XML Mapping in Stylus Studio 5.3
A new update for the Stylus Studio XML IDE adds a new XML Differencing
Tool, updated visual XML mapping tools and many other features. Download
a free trial of Stylus Studio 5.3 at:
http://www.stylusstudio.com/xml_download.html
Highlights of new XML Differencing Tool:
* Differencing of XML files and folders using a customizable color-coded
XML tree view
* Support for one-to-one and many-to-one XML file
* Step through XML differences node-by-node
* View differences using "split-screen" and "merged changes" views
* Expand all changes, or collapse identical XML blocks to simplify the
display
* User-configurable XML differencing settings allow you to optionally
resolve or ignore
* XML entity references and XML namespaces
More information at: http://www.stylusstudio.com/xml_differencing.html
Updates to Stylus Studio XML Mapping Tools:
Stylus Studio's visual XML mapping tools now support new split-screen
editing mode that simultaneously display fully editable views of both
the visual XML mapping diagram and the underlying XSLT or XQuery source
code which implements the visual XML mapping. You can now edit either
the source code or the visual XML mapping diagram, and see instantly the
effect their changes have - all without clicking a separate tab or
opening another editor. The automatic synchronization of both the visual
mapping diagram and the XSLT or XQuery source code views is the most
productive mode for developing XML mappings and is a great way to learn
the intricacies of XSLT and XQuery. More information at:
http://www.stylusstudio.com/xml_to_xml_mapper.html
Sincerely,
The Stylus Studio Team
http://www.stylusstudio.com
- 9
- Capture conversion and containmentHi,
I'm writing a tool that analyses java-code, but I have a problem fully
understanding the rules defined in JLS3 for containment and their
combination with capture conversion.
Take the following classes:
class Box<T> {}
class ABox<T extends A> {}
class A {}
Why (because of which rules) is this type-correct code? :
ABox<? extends A> a1;
ABox<?> a2;
a1 = a2;
(And I really mean "a1 = a2" there, not "a2 = a1")
The extra bounds "? extends A" doesn't really make a difference,
ABox<? extends A> and ABox<?> are equivalent, because that parameter already
has a bound A from the definition of ABox. So, informally I understand why
this code is safe. But my problem is understanding the formal rules by
which we can derive that, and where those rules are defined.
My attempt at understanding this:
The constraint for the assignment is:
capture-of(ABox<?>) <: capture-of(ABox<? extends A>)
the capture of ABox<? extends A> is ABox<_T>
where _T is a fresh type variable with upperbounds A.
the capture of ABox<?> is ABox<_T2>
where _T2 is another fresh type variable, also with upperbounds A.
And ABox<_T2> <: ABox<_T> because _T2 <= _T (_T contains _T2). But why?
I see rules for containment defined (4.5.1.1) for wildcards, but not for
type variables created by capture conversion. While I would actually expect
that only rules for type variables would be needed, as types are always
capture converted before you use them. (And this example is chosen so
that "skipping" this capture conversion step doesn't work.)
Now, intuitively, I would say that one type variable contains another if all
its upperbounds are a supertype of one of the upperbounds of the other, and
all its lowerbounds are a subtype of one of the lowerbounds of the other.
But I'd like to see something like this in writing somewhere, and I can't
find an answer to this in the Java Language Specification or anywhere else.
And this intuitive rule doesn't work for Box<ABox<?>>, because the capture
conversion of that is just Box<ABox<?>> again.
So I'm quite confused about how this actually works.
I'd appreciate some help, or pointers to more information about this.
Wouter.
- 10
- Please can you help me how can apply unicode in javaI am tr y to develope a localization application.when i run the code
there is no the right output, it's square box but i can't fix the error
and why it's like that .but i know the unicode representation of my
language please look a sample of code and based on that give me
suggestion to fix the erro.
import java.io.*;
class Unicodechar{
public static void main(String[] args){
//declare a character initialized to Ethiopic
char fidel='\u1200';
// print Ethiopic Unicode (version 3.0)
while(fidel<='\u137C'){
for(int i=0;i<8;i++){
System.out.println((int)fidel +", ");
fidel++;
}
//System.out.println();
}
}
}
- 11
- the MI 5 spammeremail***@***.com wrote:
> Incorrect. None of the nasty things that you have said or implied
> about me are at all true.
Does this mean you still accuse me of hacking OpenOffice.org's mailing
lists? What a hoot!
- 12
- Spring tutorialHi!
Does anyone knows for a good and free SPRING tutorial?
Please send me some links.
I tryed to google it, but all I find is very poor tutorials.
Thanks!
Marko
--
Remove MakniMe from e-mail address
-----------------------------
SAILING IS A POETRY OF MOTION
-----------------------------
- 13
- "Linked List" AssistanceCan someone please point me to a url that will show me how to create a
linked list.
This needs to be a very simple example as Linked Lists are confusing me.
Thankyou for your assistance.
- 14
- commons transactionHi!
I would appretiate it if someone could direct me to a source where i
could get a feel of how exactly the FileResourceManager, in the
commons.transaction.file package is used to manage transactional files.
A source with an example or usage is cool too.
Thanks,
-D
- 15
- How to make sure stdout and stderr is caught from runtimeexecHi,
I have written a class that handles stdout and std err from a unix
command. How can I make sure that both threads have finished? Do I need
to synchronzie my StreamConverter?
cheers,
//mikael
> public class RuntimeExec {
>
> public RuntimeExec() {
> }
>
> /**
> * Executes a command
> * @param command
> * @return The result of the command
> * @throws IOException
> */
> public String exec(String command) throws IOException {
> int exitValue = 0;//0 - executed ok.
> String stdOut = null;
> String stdErr = null;
> String result = null;//result from clearcase operation
> StringBuffer out = new StringBuffer();
> StringBuffer err = new StringBuffer();
> Process process = Runtime.getRuntime().exec(command);
> StreamConverter outSc = new StreamConverter(process.getInputStream(),out);
> StreamConverter errSc = new StreamConverter(process.getErrorStream(),err);
> Thread outThread = new Thread(outSc);
> Thread errThread = new Thread(errSc);
> outThread.start();
> errThread.start();
> //Wait until the prosess finish
>
> long delayMillis = 5000; // 5 seconds
> try {
> //wait for threads to die.
> outThread.join(delayMillis);
> if (outThread.isAlive()) {
> // Timeout occurred; thread has not finished
> } else {
> // Finished
> }
> } catch (InterruptedException e) {
> // Thread was interrupted
> }
>
>
>
>
> return result;
>
>
> }
>
> // bridge between byte and character stream.
> class StreamConverter implements Runnable {
> private InputStreamReader isr = null;
> private StringBuffer sb = null;
> // end of steam
> private static final int EOS = -1;
>
> public StreamConverter(InputStream is, StringBuffer sb) {
> isr = new InputStreamReader(is);
> this.sb = sb;
> }
>
> public void run() {
> int character = 0;
> try{
> while ((character = isr.read()) != EOS) {
> sb.append((char)character);
> }
> }catch(IOException ioe){
> System.out.println("Could not read std out!"+ioe.getMessage());
> }
> }
>
> }
>
>
> }
|
|
|