Hi,
I need a class for a Java program that can do the following:
When i select a file in windows, this class should return this files
path on my computer.
Does such class exist?
Thanks
Andrew Thompson - 19 Mar 2007 16:11 GMT
..
> I need a class for a Java program that can do the following:
> When i select a file in windows, this class should return this files
> path on my computer.
>
> Does such class exist?
Not to my knowledge, in fact, I cannot see
that it would be possible without a platform
specific piece of native code that calls
Java when a file is selected.
There are relatively easy ways to get a file
path for a file that is Drag'n'Drop ed onto
a running Java application, or alternatelty a
file can be *associated* with a Java (web
start) app. such that if it is double clicked,
it can be made available to the application.
Unfortunately, neither of those helps much,
the first is a lot more than simply 'selecting'
the file, and the second would require that
the end user both be willing, and able, to
'associate' /each/ of the file types interest
to the web start application.
Andrew T.
Ingo R. Homann - 19 Mar 2007 16:12 GMT
Hi,
> Hi,
> I need a class for a Java program that can do the following:
> When i select a file in windows, this class should return this files
> path on my computer.
>
> Does such class exist?
Are you looking for java.awt.FileDialog or javax.swing.JFileChooser?
Ciao,
Ingo
Andrew Thompson - 19 Mar 2007 16:16 GMT
> mnlop...@gmail.com wrote:
..
> > I need a class for a Java program that can do the following:
> > When i select a file in windows, this class should return this files
> > path on my computer.
..
> Are you looking for java.awt.FileDialog or javax.swing.JFileChooser?
Good question. I took the OP's comment of
'in windows' to mean that the JVM had not
yet been started, but maybe I misunderstood.
Andrew T.
mnlopez3@gmail.com - 19 Mar 2007 16:40 GMT
Thanks for the quick replay.
This program needs to work without java.awt.FileDialog or
javax.swing.JFileChooser.
I think i need the described native code to call JAVA. I need c or c++
for this, right?
Andrew Thompson - 19 Mar 2007 17:06 GMT
..
> This program needs to work without java.awt.FileDialog or
> javax.swing.JFileChooser.
Got it.
> I think i need the described native code to call JAVA. I need c or c++
> for this, right?
C/C++ could sure call up a Java class in the JVM.
But I suspect that would be a huge overhead for
merely finding the path of a file, and that if you
are prepared to write native code, it will probably
make more sense to do the entire thing in native
code, than ever start up a JVM.
Is it *only* windows that you need it for?
You might also look to .NET (I am not even sure
what MS calls the language of .NET - VB?).
I think that Java is not well suited to being
*any* part of the solution to this problem.
Andrew T.
Andrew Thompson - 19 Mar 2007 16:35 GMT
..me an email. It hit my spam-trap.
Note the 'Quote'.
<http://groups.google.com/groups/profile?
enc_user=7mTjyhYAAADCSWBnolz9mAH1YeBMyEJTo4cocwWvDVg2RHsu8f1bCg>
Andrew T.
mnlopez3@gmail.com - 19 Mar 2007 16:44 GMT
> ..me an email. It hit my spam-trap.
> Note the 'Quote'.
> <http://groups.google.com/groups/profile?
> enc_user=7mTjyhYAAADCSWBnolz9mAH1YeBMyEJTo4cocwWvDVg2RHsu8f1bCg>
>
> Andrew T.
Sorry about this. I'm using google groups to post my messages. I think
whatever you are using thinks I am sending spam.
Andrew Thompson - 19 Mar 2007 17:00 GMT
> > ..me an email. It hit my spam-trap.
> > Note the 'Quote'.
> > <http://groups.google.com/groups/profile?
> > enc_user=7mTjyhYAAADCSWBnolz9mAH1YeBMyEJTo4cocwWvDVg2RHsu8f1bCg>
...
> Sorry about this. I'm using google groups to post my messages. I think
> whatever you are using thinks I am sending spam.
'My brain' is what tells me to dump unsolicited
emails. 'Spam-trap' is my euphemism for 'saw
*another* bloody email from a Google groups user
and trash-canned it, unread'.
For that, I offer no apologies. But back to
your technical question in a public forum..
Andrew T.