 |
 |
Index ‹ java-programmer
|
- Previous
- 3
- Sun Wireless Toolkit gives SecurityException - please help.I have a midlet (not written by me), and I would like to analyze how it
works. Unfortunately I am not able to run this midlet. Everything compiles
fine but I receive an runtime exception during running sun WTK emulator.
Incorrect domain name, switching to 'untrusted'
java.lang.SecurityException: untrusted domain is not configured
at com.sun.midp.security.Permissions.forDomain(+98)
at com.sun.midp.dev.DevMIDletSuitImpl.create(+39)
at com.sun.midp.dev.DevMIDletSuitImpl.create(+62)
at com.sun.midp.main.Main.runLocalClass(+20)
at com.sun.midp.main.Main.main(+116)
Exception completed.
14945 bytecodes executed
0 thread switches
738 classes in the system (including system classes)
229 dynamic objects allocated (14588 bytes)
1 garbage collections (0 bytes coolected)
I am not able to fing any solution via google. I hav e found only some not
clear instruction to delete MIDP_HOME environment variable. But I have not
any MIDP_HOME on my system.
I have also found some advices to change something in
java.security and java.policy files.
Unforunately I don't know what to change. Anyone has any idea how to fix my
problem ??
I will be appreciate for any advice. Thanks in advance.
--
RaW
Please fill free to correct my English.
- 5
- Bug in java.net.Socket close() behavior?According to the API for java.net.Socket close():
"Any thread currently blocked in an I/O operation upon this socket
will throw a SocketException."
http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html#close()
I have observed that java 1.5 on FreeBSD does not follow this while
the Windows and Linux ones I have tested do. On the FreeBSD runtimes
that I have tested, a thread blocked on reading a socket just hangs
forever if the socket is closed.
Attached is a simple program that tests this behavior. It just
connects to a port on one of my servers and has a reader thread
watching input from the socket and closes the socket in a different
thread to see if the reader thread gets an exception.
Java runtimes that I have tested this on:
# java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build diablo-1.5.0-b01)
Java HotSpot(TM) 64-Bit Server VM (build diablo-1.5.0_07-b01, mixed mode)
# java -version
java version "1.5.0-p2"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.5.0-p2-root_07_mar_2006_02_41)
Java HotSpot(TM) 64-Bit Server VM (build
1.5.0-p2-root_07_mar_2006_02_41, mixed mode)
- 5
- Generics and returning specific subclass from methodI have an abstract class called say Base and two subclasses, say Sub1 and
Sub2. Let me define a method in Super which I want to return a new instance
of the superclass itself but I want to access this without having to cast.
IE,
public class Super {
public <E extends Super> E partialCopy() {
return this; // return this for example
}
}
public class Sub1 extends Super { }
Then I want to do this without the cast.
Sub1 s1 = new Sub1();
Sub2 s2 = s1.partialCopy();
Can I do this with generics ?
- 5
- instanceOf operator new bie questionI am using Java 1.4.2.x
I wrote following code:
NumberFormat df;
df = NumberFormat.getInstance();
if (df instanceof DecimalFormat) {
((DecimalFormat) df).setMinimumIntegerDigits(1);
((DecimalFormat) df).setDecimalSeparatorAlwaysShown(true);
}
What does "df instanceof DecimalFormat" really mean? Does it mean that
NumberFormat can be converted to DecimalFormat? Because my
NumberFormat.getInstance() is returning me a NumberFormat and not
DecimalFormat what else could it mean.
I did read about instanceOf opeartor on google, but it is still
confusing to me.
Thanks a lot.
Prem
- 5
- StreamCorruptedExceptionHi
sorry my english is not very good [:())
i have something like that:
Socket------------------------------------------------class1------ObjectOutp
utStream
|
|
|
inner class in class1-thread-ObjectInputSt.
|
-----------------class2
| |
| inner class in class2 thread ObjectInputStream,
ObjectOutputStream
|
|
|
--------class3- and here when i create ObjectOutputStream in inner class in
class1 in thread
jumps out exception StreamCorruptedException
why?
please help
i don't know what i have should do?
Czeski
- 8
- create a new windows (xp) service that runs a jar fileHello guys,
Does anyone has experience/know how to create a new windows (xp)
service that runs a jar file? This issue rises as i need to hide the
most of the java implementation in this project before it goes live.
So the idea is, to have control on the exceution of the jar from
windows windows service console (which the users can define the startup
type i.e. manual, automatic, disabled and the running life cycle i.e.
start, stop, pause, resume, restart...).
so any leads to solving this will be appreciated.
Thanks in advance. Have a nice day!
- 9
- do XML/XSD validation with Ant 1.5.4 and JDK 1.4.2. How?Buried somewhere in the documentation for the 1.4 JDK is a statement that
the included XML parser class cannot do schema validation (DTD validation:
yes, Schema validation: no). However, I believe that Ant uses the XML
parser in its ANT_HOME/lib directory. You probably have an older xerxes.jar
and the your best bet is to delete that and download the latest xerces.jar
and drop it into the ANT_HOME/lib directory.
<email***@***.com> wrote in message
news:email***@***.com...
> I really need to be able to validate XML against an XSD, using Ant
> 1.5.4 and JDK 1.4.2. It appears this is straightforward to do with the
> latest Ant release and/or the latest JDK, but not with the releases
> that I'm limited to.
>
> I noticed the "iso-relax" sourceforge project, which includes the JARV
> library (which contains the Ant task). This was promising, but it
> causes an NPE to be thrown in Xerces' XMLSchemaValidator class, and I
> have no idea why.
>
> I'm querying the ant-user mlist about this, but I figured this would be
> another good place to try.
>
- 12
- Exec() Help!Hi,
I'm trying to start an external applet from an applet I'm writing. I know
Exec() Is the key, but I don't know how to use it. I know how to execute
external native programs (I.e. programs I have written in BASIC and
compiled). But starting an applet from an applet totally throws me. I have
tried searching the net, and that has a lot to say about executing shell
scripts, and natives - which I know how to do.
What classes do I need to import? what line of code invokes an external
applet? I don't need to grab output from the applet I want to execute, or
send input. I just want it to run.
Pleeeeeeez can anyone help, my project has to be handed in soon :-(
Thanks,
Dafydd.
- 12
- Formatting a string in JavaHi
I am a newby in Java and am trying to format a string into a fixed
number of positions( in this case 5).
So if I have a "5" in should be "00005", and "23" should be "00023".
I hav tried looking at the classes 'import java.text.NumberFormat' and
'import java.text.Format', but I didn't get far.
Can anyone help me how I can do this in java?
Any help will be appreciated.
Regards
- 13
- AbstractTableModel not compatible with SwingWhat happens when AbstractTableModel is no longer compatible with Swing?
I kinda see how to use it, but don't see how XMLEncoder would work in its
place.
"Warning: Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is appropriate
for short term storage or RMI between applications running the same
version of Swing. As of 1.4, support for long term storage of all
JavaBeansTM has been added to the java.beans package. Please see
XMLEncoder. "
http://java.sun.com/javase/6/docs/api/javax/swing/table/
AbstractTableModel.html
thanks,
Thufir
- 14
- Toward a generic Disk Sort for JavaI was thinking how you might go about writing a sort that could handle
more data than could fit in RAM. It handled the problem is Abundance
by checkpointing the app to disk to free up maximum RAM, then spawning
a copy of Opt-Tech sort. My records were roughly like DataOutputStream
would produce, so I could automatically generate the command script
sort the fields in any way I wanted.
I thought you might pull it off in Java this way.
1. You write a comparator as if you were going to sort Objects in an
ArrayList.
2. the external sort has an add method that also takes collections.
It accepts a "chunk" of records, and sorts them using Sun's sort.
Then it writes them out as SERIALISED objects in heavily buffered
stream. There may be some way to do a partial reset after each object
to speed it up.
Then you repeat collecting, sorting and writing another batch to
another file.
When you have created N files, you recycle, appending. (Optimal N to
be determined by experiment). Ideally each file would be on a
different physical drive.
Then when all the records have been added, you start merging chunks
into longer chunks, and writing out the longer chunks. Each N-way
merge cuts the number of chunks by 1/N and increases the length of the
chunks N times.
on the final merge pass does not happen until the user invokes the
Iterator to hand over the resulting records.
Another way it might be done is the records to be sorted must by byte
arrays, chunks effectively produced by DataOutputStream. You specify
offset, length and key type e.g.
int, byte, short, float, double, String.
This would require a detailed knowledge of the bit structure of the
records, the way you did in the olden days of assembler and C.
This would be clumsier to use, but would avoid the overhead of
pickling and reconstituting records on every pass.
Then of course, there is the possibility someone has already solved
this and done it well.
The universe has a sneaky habit. Problems start out small, and it
looks like a purely in RAM solution is perfectly adequate. Then they
bit by bit grow and grow and start pushing the limits of the RAM
solution. Suddenly you are faced with a major redesign.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
- 14
- Convert from text string "Hello" to floating-point number issueHi there,
My java lecturer has given us an assignment related to casting and
type conversion etc.
One of the conversions he wan't is convert "Hello" to a float.
I suspect this is a trick question on his part as "Hello" is not a
parsible value.
This is the code I have:
//Convert String object "s" to a Float object
//then convert Float object to float value
try { System.out.println("String is "+s+" float is
"+Float.valueOf(s).floatValue());
}
catch (NumberFormatException NFE)
{ System.out.println("NumberFormatException: "+ NFE.getMessage()+
" The input string does not contain a parsable number"); }
I emailed the guy but he says just to use your own judgement.
I looked at the API for the wrapper classes etc and I think a
conversion of this type is almost impossible.
Any ideas welcome.
- 15
- Vmx Smalltalk for JavaA Beta version of Vmx Smalltalk for Java is now available for download.
http://vmx-net.com/downloads/downloadjvm.php
Your comments are welcome,
email***@***.com
- 15
- 15
- JRE installation woesHi All
I have installed the latest version of Sun's JRE on my Windows XP Pro PC.
However, its "performance" is somewhere between abysmally slow and not at
all. If I e.g. open the Java Control Panel module and click on one of the
tabs, it takes over two minutes for that tab to display - this on a 3.4 GHz
dual-processor 4 GB memory PC. Java aplications run no better. It does seem
to "speed up" if I Alt-tab to another program and then Alt-tab back.
CPU load is negligible so clearly, the JRE is waiting for something that
occurs only rarely. But I have no idea where to look.
Any help will be very much appreciated.
Ebbe
|
| Author |
Message |
steve

|
Posted: 2003-10-25 9:07:00 |
Top |
java-programmer, J2ME
Hello,
Are there any newsgroups or forums specifically for J2ME? I would like to
make a game for mobile devices but I don't know where to start.
Thanks in advance,
Steve
|
| |
|
| |
 |
Digby

|
Posted: 2003-10-25 9:29:00 |
Top |
java-programmer >> J2ME
I'm not sure about any newsgroups, but check out http://forum.nokia.com for
tons of stuff. If you're not a Nokia person, not sure where you go.
"steve" <email***@***.com> wrote in message
news:81kmb.126990$email***@***.com...
> Hello,
>
> Are there any newsgroups or forums specifically for J2ME? I would like to
> make a game for mobile devices but I don't know where to start.
>
> Thanks in advance,
> Steve
>
>
>
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.528 / Virus Database: 324 - Release Date: 17/10/2003
|
| |
|
| |
 |
Darryl L. Pierce

|
Posted: 2003-10-28 1:36:00 |
Top |
java-programmer >> J2ME
steve wrote:
> Are there any newsgroups or forums specifically for J2ME? I would like to
> make a game for mobile devices but I don't know where to start.
No newsgroups, but there are several mailing lists an web-based forums
available. See the J2ME FAQ
<http://bellsouthpwp.net/m/c/mcpierce/j2mefaq.html> for more information on
the subject.
--
Darryl L. Pierce <email***@***.com>
Visit the Infobahn Offramp - <http://bellsouthpwp.net/m/c/mcpierce>
"What do you care what other people think, Mr. Feynman?"
|
| |
|
| |
 |
Oz Mortimer

|
Posted: 2003-12-15 23:56:00 |
Top |
java-programmer >> J2ME
Hi There,
I'm sure this is the wrong newsgroup but I couldn't find one for J2ME.
Does anyone out there know how to play back a mpeg file, I have tried
various things but cannot get it running....examples?
Many Thanks
Oz.
email***@***.com
|
| |
|
| |
 |
Darryl L. Pierce

|
Posted: 2004-4-2 1:45:00 |
Top |
java-programmer >> J2ME
curtis whaley wrote:
> is any one useing j2me i have idea
I've been working almost exclusively with the _MIDP_ for 5 years now. J2ME
is not itself a technology; it's just an umbrella term referring to
different technologies for handheld, wireless and embedded devices.
--
Darryl L. Pierce <email***@***.com>
Visit the Infobahn Offramp - <http://mypage.org/mcpierce>
"What do you care what other people think, Mr. Feynman?"
|
| |
|
| |
 |
Charles Keepax

|
Posted: 2004-4-11 20:32:00 |
Top |
java-programmer >> J2ME
Hi, sorry for the newbie question but I have downloaded CLDC and when
compiling it (for Windows) it can't find either ROMjavaWin.c or
nativeFunctionTableWin.c do I have to write these?
Thanks in Advance,
Charles
|
| |
|
| |
 |
degs

|
Posted: 2004-4-17 0:08:00 |
Top |
java-programmer >> J2ME
Charles Keepax wrote:
> *Hi, sorry for the newbie question but I have downloaded CLDC an
> when
> compiling it (for Windows) it can't find either ROMjavaWin.c or
> nativeFunctionTableWin.c do I have to write these?
>
> Thanks in Advance,
> Charles *
I hope you like Makefiles.
http://www.68k.org/~degs/wincejava/
That's how I fixed it up.
--deg
-
deg
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------
|
| |
|
| |
 |
asj

|
Posted: 2004-5-11 20:21:00 |
Top |
java-programmer >> J2ME
Roedy Green <email***@***.com> wrote in message news:<email***@***.com>...
> I get stung again and again answering a J2ME question as if it were a
> standard Java question. It would be nice to put all the handheld
> stuff in a different newsgroup
go for it, i'm all for it too...and while you're at it, move
serverside stuff to its own group. just post how to vote on it and
let's get the word out.
|
| |
|
| |
 |
JTK

|
Posted: 2004-5-12 9:16:00 |
Top |
java-programmer >> J2ME
Roedy Green wrote:
> I get stung again and again answering a J2ME question as if it were a
> standard Java question. It would be nice to put all the handheld
> stuff in a different newsgroup
I don't understand. I thought Java was supposed to be "Write Once, Run
Anywhere". You're telling me that is not the case?
|
| |
|
| |
 |
Luke Tulkas

|
Posted: 2004-5-12 17:40:00 |
Top |
java-programmer >> J2ME
"JTK" <email***@***.com> wrote in message
news:oVeoc.44832$email***@***.com...
> Roedy Green wrote:
> > I get stung again and again answering a J2ME question as if it were
a
> > standard Java question. It would be nice to put all the handheld
> > stuff in a different newsgroup
>
> I don't understand. I thought Java was supposed to be "Write Once,
Run
> Anywhere". You're telling me that is not the case?
As a M$ luver, you should know that, while almost all of their OS's have
Windoze in their names, there is a difference between
9598CEMENT2KXP2003ETC. Not counting service packs, versions & builds.
In other words: when smartcards catch up with PCs, WORA just might get
another (level of) <drumrole>meaning</drumrole>. ;-)
|
| |
|
| |
 |
The Ghost In The Machine

|
Posted: 2004-5-13 4:00:00 |
Top |
java-programmer >> J2ME
In comp.lang.java.advocacy, JTK
<email***@***.com>
wrote
on Wed, 12 May 2004 01:16:04 GMT
<oVeoc.44832$email***@***.com>:
> Roedy Green wrote:
>> I get stung again and again answering a J2ME question as if it were a
>> standard Java question. It would be nice to put all the handheld
>> stuff in a different newsgroup
>
> I don't understand. I thought Java was supposed to be "Write Once, Run
> Anywhere". You're telling me that is not the case?
Try the following program:
class Main { public static void main(String[] args) {
File f = new File("C:\Documents and Settings\" + username + "\Desktop\outfile.txt");
FileWriter fw = new FileWriter(f);
PrintWriter pw = new PrintWriter(fw);
pw.println("Hello, world!");
pw.println("This is an example of writing to the desktop");
pw.close();
}}
on a Unix system. Heck, try it on a Windows system. It probably
won't compile because of the ' \" '; the naive Windows programmer
may start asking dumb questions at this point ("Why does this
[swearword] language not support backslashes properly?"). C++
has a similar problem so perhaps that's not a big issue. I
doubt C# can handle a variant of the above, either, without
using '\\'.
After fixing that obvious bug, one gets either
File f = new File("C:/Documents and Settings/" + username + "/Desktop/outfile.txt");
or perhaps
File f = new File("C:\\Documents and Settings\\" + username + "\\Desktop\\outfile.txt");
both of which work nicely on a Windows system. Now upload the
test program to a high-powered z390 as part of the release process.
Hmm...why can't it find the directory 'C:'? Or perhaps the entire
pathname? Uh oh.
While this is a rather contrived bug I for one would have highly preferred
a single unified file system that Java sees -- one could have simply
nabbed the Unix convention, for example:
new File("//c/Documents and Settings/" + username + "/Desktop/outfile.txt");
(The '//' can be construed as a corruption of '\\', although I've
seen it far earlier; Apollo Domain DomainOS (nee Aegis) was using it
way back in the mid-80's.)
or done something very interesting, such as
new File(File.root("c").subdir("Documents and settings").subdir(username).subdir("Desktop"),"outfile.txt");
An assistor function might have been provided to find the desktop:
File.desktop(). On a Windows system it would generate
"%SYSTEMROOT%\Documents and Settings\" + username + "\Desktop"
(although on NT3.5 the path might differ -- but NT4 is deprecated
if not mortally wounded, and NT3.5 is effectively dead.)
On a Linux system it's not quite as clear but one could either
define an environment variable ($DESKTOP?) or try to hook into
Nautilus, KDE, CDE, or Gnome.
Sun doesn't support the desktop all that well. :-)
--
#191, email***@***.com
It's still legal to go .sigless.
|
| |
|
| |
 |
Harish Madhavan K

|
Posted: 2004-5-13 6:25:00 |
Top |
java-programmer >> J2ME
You should be using File.seperator etc
Also, a good software will not hard-code the path name like that, its true
for even non-java programs.
Ususally these kind of programs gets the direcory/path names from registry,
env, property files etc.
OK, if ur point is that WORA is not true for *all* the java programs?, then
yes I agree.
But it could be true for properly written programs?
Harish
"The Ghost In The Machine" <email***@***.com> wrote in
message news:email***@***.com...
> In comp.lang.java.advocacy, JTK
> <email***@***.com>
> wrote
> class Main { public static void main(String[] args) {
> File f = new File("C:\Documents and Settings\" + username +
"\Desktop\outfile.txt");
> FileWriter fw = new FileWriter(f);
> PrintWriter pw = new PrintWriter(fw);
> pw.println("Hello, world!");
> pw.println("This is an example of writing to the desktop");
> pw.close();
> }}
>
|
| |
|
| |
 |
asj

|
Posted: 2004-5-13 10:36:00 |
Top |
java-programmer >> J2ME
why not use a file separator?
http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html
obviously, hard coding file paths onto your program will not make it WORA.
The Ghost In The Machine <email***@***.com> wrote in message news
> Try the following program:
>
> class Main { public static void main(String[] args) {
> File f = new File("C:\Documents and Settings\" + username + "\Desktop\outfile.txt");
> FileWriter fw = new FileWriter(f);
> PrintWriter pw = new PrintWriter(fw);
> pw.println("Hello, world!");
> pw.println("This is an example of writing to the desktop");
> pw.close();
> }}
>
> on a Unix system. Heck, try it on a Windows system. It probably
> won't compile because of the ' \" '; the naive Windows programmer
> may start asking dumb questions at this point ("Why does this
> [swearword] language not support backslashes properly?"). C++
> has a similar problem so perhaps that's not a big issue. I
> doubt C# can handle a variant of the above, either, without
> using '\\'.
>
> After fixing that obvious bug, one gets either
>
> File f = new File("C:/Documents and Settings/" + username + "/Desktop/outfile.txt");
>
> or perhaps
>
> File f = new File("C:\\Documents and Settings\\" + username + "\\Desktop\\outfile.txt");
>
> both of which work nicely on a Windows system. Now upload the
> test program to a high-powered z390 as part of the release process.
>
> Hmm...why can't it find the directory 'C:'? Or perhaps the entire
> pathname? Uh oh.
>
> While this is a rather contrived bug I for one would have highly preferred
> a single unified file system that Java sees -- one could have simply
> nabbed the Unix convention, for example:
>
> new File("//c/Documents and Settings/" + username + "/Desktop/outfile.txt");
>
> (The '//' can be construed as a corruption of '\\', although I've
> seen it far earlier; Apollo Domain DomainOS (nee Aegis) was using it
> way back in the mid-80's.)
>
> or done something very interesting, such as
>
> new File(File.root("c").subdir("Documents and settings").subdir(username).subdir("Desktop"),"outfile.txt");
>
> An assistor function might have been provided to find the desktop:
> File.desktop(). On a Windows system it would generate
>
> "%SYSTEMROOT%\Documents and Settings\" + username + "\Desktop"
>
> (although on NT3.5 the path might differ -- but NT4 is deprecated
> if not mortally wounded, and NT3.5 is effectively dead.)
>
> On a Linux system it's not quite as clear but one could either
> define an environment variable ($DESKTOP?) or try to hook into
> Nautilus, KDE, CDE, or Gnome.
>
> Sun doesn't support the desktop all that well. :-)
|
| |
|
| |
 |
JTK

|
Posted: 2004-5-13 13:26:00 |
Top |
java-programmer >> J2ME
Luke Tulkas wrote:
> "JTK" <email***@***.com> wrote in message
> news:oVeoc.44832$email***@***.com...
>
>>Roedy Green wrote:
>>
>>>I get stung again and again answering a J2ME question as if it were
>
> a
>
>>>standard Java question. It would be nice to put all the handheld
>>>stuff in a different newsgroup
>>
>>I don't understand. I thought Java was supposed to be "Write Once,
>
> Run
>
>>Anywhere". You're telling me that is not the case?
>
>
> As a M$ luver,
You must be confused (yeah, understatement of all time, I know). I
probably "luv" "M$" less than you do, by several orders of magnitude.
> you should know that, while almost all of their OS's have
> Windoze in their names, there is a difference between
> 9598CEMENT2KXP2003ETC. Not counting service packs, versions & builds.
>
And this has what relationship to Java not being WORA, as promised by
McNealy et al?
> In other words: when smartcards catch up with PCs, WORA just might get
> another (level of) <drumrole>meaning</drumrole>. ;-)
>
And when you catch up to the common housecat in your ability to form
meaningful sentences, it'll be too late, because the Sun will have burnt
out long before then.
|
| |
|
| |
 |
JTK

|
Posted: 2004-5-13 13:41:00 |
Top |
java-programmer >> J2ME
The Ghost In The Machine wrote:
> In comp.lang.java.advocacy, JTK
> <email***@***.com>
> wrote
> on Wed, 12 May 2004 01:16:04 GMT
> <oVeoc.44832$email***@***.com>:
>
>>Roedy Green wrote:
>>
>>>I get stung again and again answering a J2ME question as if it were a
>>>standard Java question. It would be nice to put all the handheld
>>>stuff in a different newsgroup
>>
>>I don't understand. I thought Java was supposed to be "Write Once, Run
>>Anywhere". You're telling me that is not the case?
>
>
> Try the following program:
>
> class Main { public static void main(String[] args) {
> File f = new File("C:\Documents and Settings\" + username + "\Desktop\outfile.txt");
> FileWriter fw = new FileWriter(f);
> PrintWriter pw = new PrintWriter(fw);
> pw.println("Hello, world!");
> pw.println("This is an example of writing to the desktop");
> pw.close();
> }}
>
> on a Unix system. Heck, try it on a Windows system. It probably
> won't compile because of the ' \" '; the naive Windows programmer
> may start asking dumb questions at this point ("Why does this
> [swearword] language not support backslashes properly?"). C++
> has a similar problem so perhaps that's not a big issue. I
> doubt C# can handle a variant of the above, either, without
> using '\\'.
>
You don't have to prove my point for me, I know full well that you
cannot write a Java program "Once" and expect it to run "Anywhere", as
claimed by the Javapologists and Sun itself.
> After fixing that obvious bug,
That obvious bug in what? Your answer: the code. The real answer:
Java. To "Run Anywhere", it would have to abstract the differences in
paths away. And yeah, it's been done. Quite well actually. But not in
Java. Hence, as we both know, Java does not live up to its promise of WORA.
[snip more of the same example of a Java design flaw]
>
> While this is a rather contrived bug
It's not contrived at all. Unless you don't expect to deal with files
"Anywhere".
> I for one would have highly preferred
> a single unified file system that Java sees -- one could have simply
> nabbed the Unix convention, for example:
>
> new File("//c/Documents and Settings/" + username + "/Desktop/outfile.txt");
>
> (The '//' can be construed as a corruption of '\\', although I've
> seen it far earlier; Apollo Domain DomainOS (nee Aegis) was using it
> way back in the mid-80's.)
>
> or done something very interesting, such as
>
> new File(File.root("c").subdir("Documents and settings").subdir(username).subdir("Desktop"),"outfile.txt");
>
> An assistor function might have been provided to find the desktop:
> File.desktop(). On a Windows system it would generate
>
> "%SYSTEMROOT%\Documents and Settings\" + username + "\Desktop"
>
> (although on NT3.5 the path might differ -- but NT4 is deprecated
> if not mortally wounded, and NT3.5 is effectively dead.)
>
Yep, all this and more has been done. Not in Java though. Don't try to
Run a Java app that accesses files Anywhere, or you'll be in for one
heck of an epiphany!
> On a Linux system it's not quite as clear but one could either
> define an environment variable ($DESKTOP?) or try to hook into
> Nautilus, KDE, CDE, or Gnome.
>
> Sun doesn't support the desktop all that well. :-)
>
Sun and all other Unii. Yeah, the rest of the world has noticed and
moved on. Decades ago.
|
| |
|
| |
 |
JTK

|
Posted: 2004-5-13 13:44:00 |
Top |
java-programmer >> J2ME
asj wrote:
> why not use a file separator?
Why not have Java do it for me? Oh, right, because it isn't WORA.
Never was. WORA was a complete lie from the start.
> http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html
> obviously, hard coding file paths onto your program will not make it WORA.
>
obviously, not the point of the exercise.
|
| |
|
| |
 |
Tom Shelton

|
Posted: 2004-5-13 14:14:00 |
Top |
java-programmer >> J2ME
"The Ghost In The Machine" <email***@***.com> wrote in
message news:email***@***.com...
> In comp.lang.java.advocacy, JTK
> <email***@***.com>
> wrote
> on Wed, 12 May 2004 01:16:04 GMT
> <oVeoc.44832$email***@***.com>:
> > Roedy Green wrote:
> >> I get stung again and again answering a J2ME question as if it were a
> >> standard Java question. It would be nice to put all the handheld
> >> stuff in a different newsgroup
> >
> > I don't understand. I thought Java was supposed to be "Write Once, Run
> > Anywhere". You're telling me that is not the case?
>
> Try the following program:
>
> class Main { public static void main(String[] args) {
> File f = new File("C:\Documents and Settings\" + username +
"\Desktop\outfile.txt");
> FileWriter fw = new FileWriter(f);
> PrintWriter pw = new PrintWriter(fw);
> pw.println("Hello, world!");
> pw.println("This is an example of writing to the desktop");
> pw.close();
> }}
>
> on a Unix system. Heck, try it on a Windows system. It probably
> won't compile because of the ' \" '; the naive Windows programmer
> may start asking dumb questions at this point ("Why does this
> [swearword] language not support backslashes properly?"). C++
> has a similar problem so perhaps that's not a big issue. I
> doubt C# can handle a variant of the above, either, without
> using '\\'.
Actually, it can... Prefix the string with a @ and it becomes a literal
string - escape sequences are not processed. Example:
string path = @"C:\Program Files\New Folder";
Of course, you would probably want to use the System.IO.Path class in C# to
create the path.. Either using Path.Combine or concat the string with
Path.PathSeparator...
For your path above I would probably do:
using System;
using System.IO;
public class App
{
public static void Main()
{
string path = Path.Combine(
Environment.GetFolderPath(
Environment.SpecialFolder.DesktopDirectory),
"outfile.txt");
StreamWriter writer = new StreamWriter(File.OpenWrite(path));
writer.WriteLine("Hello, World!");
writer.WriteLine("This is an example of writing to the desktop");
writer.Close();
}
}
This should work on .NET, Mono, and CF (not positive on this one, since I
haven't really ever had any reason to do CF development).
Tom Shelton
|
| |
|
| |
 |
Roedy Green

|
Posted: 2004-5-13 14:21:00 |
Top |
java-programmer >> J2ME
On Thu, 13 May 2004 05:25:45 GMT, JTK <email***@***.com> wrote or
quoted :
>And this has what relationship to Java not being WORA, as promised by
>McNealy et al?
You are being a bit silly here. Either Java evolves or it stays
stagnant. Either way you bitch.
Because evolves you complain new code can't run on old JVMS.
If it stagnated, you would say it was dead.
All it really needs is to autoupdate the JVMs with the same ease that
JVWs apps autoupdate. If everyone stayed on the most recent release
we would be pretty well ok.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
|
| |
|
| |
 |
Roedy Green

|
Posted: 2004-5-13 14:23:00 |
Top |
java-programmer >> J2ME
On Wed, 12 May 2004 20:00:28 GMT, The Ghost In The Machine
<email***@***.com> wrote or quoted :
>File f = new File("C:\Documents and Settings\" + username + "\Desktop\outfile.txt");
that won't even compile! See
http://mindprod.com/jgloss/literals.html
With a hard coded file name that program is intended to be platform
specific.
For how to do it properly see http://mindprod.com/jgloss/file.html
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
|
| |
|
| |
 |
Roedy Green

|
Posted: 2004-5-13 14:25:00 |
Top |
java-programmer >> J2ME
On Thu, 13 May 2004 05:41:08 GMT, JTK <email***@***.com> wrote or
quoted :
>
>You don't have to prove my point for me, I know full well that you
>cannot write a Java program "Once" and expect it to run "Anywhere", as
>claimed by the Javapologists and Sun itself.
Why don't you test any of the programs on my website and see if any of
them fail to run on some platform. I know of only on that will fail,
setClock, and it could run on more platforms with a bit more JNI
implementations.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Bye Bye Toshiba: Samsung Ships the First Blu-Ray Playeremail***@***.com wrote:
> $1000 versus $500. You really think Toshiba will tank? You don't know
> much
about consumers.
considering these are targeted towards early adopters and the well-off,
and considering blu-ray has significantly greater storage, content, and
other capabilitles - uh, yes toshiba is in trouble. sales of toshiba
hddvd titles are already slow....
- 2
- [J2ME] UI /freezes/ after IOExceptionHi,
I have a MiDlet that starts a Thread through a Runnable, in which
there is IO activity:
Runnable runner = new Runnable() { // some IO stuff there };
Thread thd = new Thread(runner);
thd.start();
The application runs well, until I need to close the IO channels that
are opened in that separate Thread.
Of course, I catch the IOException in my Thread, and the Thread
completes properly (and dies...).
But after this catch, the UI is not responding: if I press a button the
menu will not show, and if I do some programmaticaly changes in the UI
it does not display and the call blocks (i.e. if I add an item in the
current screen, nothing happens and the next line --System.out.println--
doesn't execute).
I know the application didn't die, cause I have another Thread running a
'while' loop and printing "I am alive!" even when the UI freezes.
And also if I don't perform UI changes I can print stuff in the main Thread.
Any idea to help me ? Thank you.
--
JScoobyCed
What about a JScooby snack Shaggy ? ... Shaggy ?!
- 3
- applet signingHey
I'm attempting to sign some applets that will step outside the sandbox by
means of opening a network connection. What I want to know is there anyway
of creating a certificate instead of buying one from a "trusted authorithy"
even if its just for testing. and does anyone know if its difficult/time
consumeing to sign applets?
Thanking you niall
- 4
- Maven2 repository for GlassfishIs anybody know the location of a maven2 repository for Glassfish? I
mean groupId, artifactId and url for javaee and appserv-rt libs (and
maybe another libs)...
- 5
- Java and Windows InteractionDoes anyone know a way using Java to find the username of the person
currently logged into Windows? I have thought that I could access the
Windows registry to find the current user, but unfortunately I can't see a
way to access and read the registry. I've had a dig through JavaDocs and the
web but haven't been able to find anything I can use.
I have found, but do not want to use, commercial classes and code. If
someone could just point me in the right direction it would be most
appreciated.
Thanks..
Adam.
- 6
- Show a bean property in jsf....it's so difficult?????Hi....
i'm a simple problem but i don't found a working solution....
I have a jsf application and i have to show a bean value into a jsp
page.
I show you my passes...please correct me where i go wrong,,,
For the first i declare property in backing bean
private String[] arraylinee;
In my application an user clicks a button, the application calls bean's
method and creates this array of string,that's what i want to show in
my jsp page.
I've developed in my backing bean getter and setter methods..
public String[] getarraylinee(){
return arraylinee;
}
public void setarraylinee(String[] arraylinee){
this.arraylinee=arraylinee;
}
1a Question)
It's not needed that bean return property?
That is...my bean's method is
public String retrieveblob()throws
IOException,SQLException,NullPointerException{
Database2 db2 = new Database2("nomeDB","root","shevagol");
if (db2.connetti())
k=1;
else k=0;
//try{
Connection dbo=db2.getConnection();
Statement st = null;
try {
st = dbo.createStatement();
}
catch (NullPointerException exc) {
exc.printStackTrace();
}
ResultSet rs = null;
try {
rs = st.executeQuery("SELECT Data FROM tbl WHERE nome='1' ");
}
catch (NullPointerException exc) {
exc.printStackTrace();
}
try {
rs.first();
}
catch (NullPointerException exc) {
exc.printStackTrace();
}
try {
Blob blob = rs.getBlob("Data");
byte[] read = blob.getBytes(1, (int) blob.length());
st.close();
String lettura=new String(read);
String[] arraylinee=lettura.split(";");
}
catch (NullPointerException exc) {
exc.printStackTrace();
}
return "Result";
}
Result is a string useful for navigation...
Let's go to jsp page
codice:<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"
prefix="c" %>
<jsp:useBean id="myBean" class="giu.MyBean" scope="session"/>
<%@ page import="giu.MyBean" %>
<%-- Instantiate class --%>
<html>
<head>
<title></title>
</head>
<body>
<f:view>
<f:verbatim>
<h:outputText value="#{MyBean.k}"/>
<table>
<c:forEach items="${session.myBean.arraylinee}" var="linea" >
<tr>
<td>
<c:out value="${linea}" />
</td>
</tr>
</c:forEach>
</table>
</f:verbatim>
</f:view>
</body>
</html>
Don't care for MyBean.k, i use it for controlling if db connection
works fine...
In summary i want this jsp page prints my array of string,one for line.
How can i do?
The bean is called MyBean and it's in the package giu.
Can you help me correcting my code directly???
Ah....with my actual application the jsp output is:
1
${linea}
- 7
- Sr. Systems Analyst- National Institutes of Health-JAVA and C++SR. SYSTEMS ANALYST - (Bioinformatics R&D)
Summary:
MSD is an employee-owned company of over 500 professionals who support
the diverse technical, scientific, and administrative needs of the
Federal government. We are currently searching for an experienced Sr.
Systems Analyst to support one of our clients at the National
Institutes of Health. This opportunity is permanent, full-time, and on
site in Bethesda/Rockville, MD.
Job Summary
Our client requires the services of a Sr. Systems Analyst with a strong
background in computer application design and development with a
strength in Java-based client/server applications.
Job Duties
The successful candidate will be responsible for the following:
-Develop production software and perform data processing to support the
alignment and annotation phases of the genome data processing pipeline
within a department at the National Institutes of Health (NIH.) Will
also be responsible for improving data quality, performance,
reliability, and maintainability of the pipeline software and process.
-Develop genomic sequence assembly software in C and C++ for use on
multiple platforms (Windows, Unix, Apple). Will use a C++ Toolkit,
which provides platform-independent modules and APIs for programming
genomic data analysis software
-Will implement QA and reporting activities to reduce errors and avoid
major processing delays to result in a more stable pipeline process.
Will validate and improve data quality using methods such as close
inspection of data samples to identify and categorize annotation
errors.
-Will be responsible for providing continued support with change in the
data management environment using a BerkeleyDB data store with
object-oriented data encapsulation and migrating toward relational
database management using Microsoft SQL Server.
-Organize data flow and configuration management using standardized
procedures across organism-specific builds
-Design, implement, and factor code for incremental migration of
pipeline software from C to C++
-Assist with the factor pipeline processing software executed on
internal compute farm, which is a distributed, load-sharing and
job-scheduling environment using Platform Computing Corporation's
Load Sharing Facility (LSF).
-Employ C++ and Perl for software programming and performs data and
database management using BerkeleyDB and Microsoft SQL Server. This
internal department has recently migrated from Sun to Linux as a
development platform; candidates should be familiar with GNU C++
compiler and tools such as Purify, Quantify, and Valgrind.
REQUIREMENTS;
-4/5+ yrs experience in Java programming
-3 Yrs experience in C and C++ development/ Web applications
development.
-Min. MS in Computer Science or related technical discipline
PREFERRED:
-Biological Database /Statistical Data Analysis
-Candidates should have a preferred background in bioinformatics,
information retrieval and web based knowledge management. Scientific
background, biology a plus
Interested applicants should submit resume and salary requirements to
Monica Lyerly, Technical Recruiter. email***@***.com. We require a
short programming skill assessment completed prior to an interview,
upon receipt of your resume we will be sending you the required
assessment to be completed and returned to the same e mail address.Out
of area candidates will be considered for this opportunity.
EOE, M/F/D/V.
- 8
- J2ME Server on a PCI have a question about J2ME using bluetooth. I am trying to implement
a client server applicatin between my phone (Nokia 6630) and my PC. I
can send data over bluetooth to the PC on a virtual serial port but I
need a way to "catch" the data I sent on the PC end and turn it back
into an image. Are there any applications out there that do this
already? Can I run a J2ME server on my PC? Thanks
Mike
- 9
- Programming ForumHello,
I wanted to let you guys know that I've created a new forum for
developers and shareware authors to discuss programming, piracy tatics
(preventing), promotion, and more. The url is
http://forum.codecall.net Please take a moment to have a look.
Thanks,
Jordan
- 10
- Question: getting a real path from a mapped drive.My question:
If I have a mapped driver letter g: that referes to
\\servername\d\foldername
How do I get java to convert it from g: to the real path so I can use
it?
I have a script that allows someone to locate a file on the server,
but most will use there mapped drives as they know nothing better.
Although I've tried to standardize the drives, its difficult to
maintain all the time with so many users. So, when they find their
file on the network g:\thisFolder\thisFile.txt...I want the script to
convert it to \\servername\d\foldername\thisFolder\thisFile.txt. Any
help would be greatly appreciated. Thanks!!!
- 11
- jboss 4.0.3 jboss portal 2.2.1hi
i am a one week newbie to j2ee world ( no java exp )
however i am to deploy application ( that is compiere ) onto existing
platform ( pentaho that is )
as per this date my assumptions are :
= point of integration would be in portal
= compiere application itself, war, would be deployed on jboss /deploy
= jsp be made to enable access from portal to war
could somebody help me on what is the definable steps to do the
integration?
- 12
- Expanding on Video Formats
I'm wondering if somebody with java knowledge will be able answer my
question.
Would it be within the realms of possibility to create a web-based
video editing suite? (Which media format -- Windows, Quicktime, etc. --
might best lend itself to such a task?)
Also, I imagine that this application may require a desaturation
process to bring down the memory size for the raw footage.
I don't know enough about java programming to even guess about this;
but with the current prevalence of digital editing software, an online
version has convenience written all over it.
Thanks,
- 13
- JAWS failureThis just started happening.
I can run a JAWS app from within the browser.
But when I later go to run from the desktop icon it says I don't have
Java 1.6 installed.
Here is a typical JNLP file after JAWS has normalised it:
<jnlp spec="1.6+" codebase="http://mindprod.com/replicator/"
href="http://mindprod.com/replicator/replicatorreceiverwebsite.jnlp">
<information>
<title>The Replicator 9.6 via website</title>
<vendor>Canadian Mind Products</vendor>
<homepage href="http://www.mindprod.com/"/>
<description>Replicates files via website. Also keeps them up to
date efficiently.</description>
<description kind="short">Replicates files via
website.</description>
<description kind="one-line">Replicates files via
website.</description>
<description kind="tooltip">the Replicator</description>
<icon href="http://mindprod.com/replicator/replicator.gif"
height="64" width="64" kind="default"/>
<icon href="http://mindprod.com/replicator/replicatorsplash.gif"
height="128" width="128" kind="splash"/>
<shortcut online="true">
<desktop/>
<menu submenu="The Replicator"/>
</shortcut>
</information>
<security>
<all-permissions/>
</security>
<update check="timeout" policy="always"/>
<resources>
<java initial-heap-size="134217728" max-heap-size="536870912"
java-vm-args="-ea" href="http://java.sun.com/products/autodl/j2se"
version="1.6+"/>
<jar href="http://mindprod.com/replicator/replicator.jar"
download="eager" main="false"/>
<property name="VIA" value="website"/>
<property name="PROJECT_NAME" value="Mindprod.com"/>
<property name="UNIQUE_PROJECT_NAME"
value="com.mindprod.replicator"/>
<property name="SUGGESTED_RECEIVER_BASE_DIR" value="C:\mindprod"/>
<property name="SUGGESTED_RECEIVER_ZIP_STAGING_DIR"
value="C:\mpstaging"/>
<property name="WEBSITE_ZIP_URL"
value="http://mindprod.com/replicator"/>
<property name="SUGGESTED_LAN_ZIP_URL"
value="http://mindprod.com/replicator"/>
<property name="KEEP_ZIPS" value="false"/>
<property name="UNPACK_ZIPS" value="true"/>
<property name="AUTHENTICATION" value="none"/>
<property name="DEBUGGING" value="true"/>
</resources>
<application-desc main-class="com.mindprod.replicator.Replicator"/>
</jnlp>
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
- 14
- In praise of EclipseOn Sat, 16 Jul 2005 20:02:41 GMT, Dale King
<email***@***.com> wrote or quoted :
>As I said, you are actually not pointing to anything because the site
>doesn't exist, Rumsfeld explained nothing, and last I checked even if he
>had he is not a member of the Bush family.
The link has gone stale. The site itself still exists. Last time I
looked, a month or so ago it showed you a C-SPAN video of McKinney
going after Rumsfeld.
I spent 20 minutes unsuccessfully last night trying to find a new
source for it.
For more details on the loss/embezzlements see
http://mindprod.com/politics/iraqeconomics.html
This is not the forum to discuss. Try alt.politics.bush
--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
- 15
- set guarded blockHow I can define, modify, delete a guarded block in NetBeans?
The gaurded block is writen by me (not by IDE).
Where is documentation about writing guarded block?
--
WOJSAL
http://www.wojsal.prv.pl
|
|
|