473,405 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Cross-Platform File Opening Issue

Hi all,

Just spent some hours banging my head on a brick wall with this one. I've got a program where I have to open a file given its pathname as a String. I've got code that works fine on Mac and Linux, but it'll only work on Windows XP for certain file types - for example .m4a will open with iTunes quite happily, but .avi produces this error:

Expand|Select|Wrap|Line Numbers
  1. java.io.IOException: Failed to open file:/C:/Documents%20and%20Settings/Chris/Desktop/In.Treatment.S01E21.avi. Error message: The parameter is incorrect.
  2.  
  3. at sun.awt.windows.WDesktopPeer.ShellExecute(Unknown Source)
  4. at sun.awt.windows.WDesktopPeer.open(Unknown Source)
  5. at java.awt.Desktop.open(Unknown Source) 
(the stack trace goes on a while, but I won't type it all out unless more is needed)

The bit of code causing this is:

Expand|Select|Wrap|Line Numbers
  1. try {d.open (new java.io.File(path));} // path is a String with a pathname
  2. catch(Exception ex) {ex.printStackTrace();}
  3.  
I've tried this with the default application for .avi being Windows Media Player and VLC (that error is with the latter set, the former gives a similar but slightly different error). Does Windows XP just not fully support the java.awt.Desktop class?

Any ideas very welcome! :)
Mar 2 '08 #1
1 1847
sukatoa
539 512MB
Hi all,

Just spent some hours banging my head on a brick wall with this one. I've got a program where I have to open a file given its pathname as a String. I've got code that works fine on Mac and Linux, but it'll only work on Windows XP for certain file types - for example .m4a will open with iTunes quite happily, but .avi produces this error:

Expand|Select|Wrap|Line Numbers
  1. java.io.IOException: Failed to open file:/C:/Documents%20and%20Settings/Chris/Desktop/In.Treatment.S01E21.avi. Error message: The parameter is incorrect.
  2.  
  3. at sun.awt.windows.WDesktopPeer.ShellExecute(Unknown Source)
  4. at sun.awt.windows.WDesktopPeer.open(Unknown Source)
  5. at java.awt.Desktop.open(Unknown Source) 
(the stack trace goes on a while, but I won't type it all out unless more is needed)

The bit of code causing this is:

Expand|Select|Wrap|Line Numbers
  1. try {d.open (new java.io.File(path));} // path is a String with a pathname
  2. catch(Exception ex) {ex.printStackTrace();}
  3.  
I've tried this with the default application for .avi being Windows Media Player and VLC (that error is with the latter set, the former gives a similar but slightly different error). Does Windows XP just not fully support the java.awt.Desktop class?

Any ideas very welcome! :)

About the error, try to change '/' to '\'...

Expand|Select|Wrap|Line Numbers
  1. file:/C:/Documents%20and%20Settings/Chris/Desktop/In.Treatment.S01E21.avi
Mar 2 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics,...
12
by: * ProteanThread * | last post by:
but depends upon the clique: ...
0
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics,...
4
by: David Peach | last post by:
Hello, hope somebody here can help me... I have a query that lists defects recorded in a user defined date range. That query is then used as the source for a Cross Tab query that cross-tabs count...
23
by: Jeff Rodriguez | last post by:
Here's what I want do: Have a main daemon which starts up several threads in a Boss-Queue structure. From those threads, I want them all to sit and watch a queue. Once an entry goes into the...
0
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics,...
1
by: Rob Woodworth | last post by:
Hi, I'm having serious problems getting my report to work. I need to generate a timesheet report which will contain info for one employee between certain dates (one week's worth of dates). I...
6
by: Simon | last post by:
Hi All, An experiment i'm doing requires requires a synchronous cross-domain request, without using a proxy. I wondered if anyone had any ideas to help me achieve this. Below is what I have...
6
by: Bart Van der Donck | last post by:
Hello, I'm presenting my new library 'AJAX Cross Domain' - a javascript extension that allows to perform cross-domain AJAX requests. http://www.ajax-cross-domain.com/ Any comments or...
6
by: ampo | last post by:
Hello. Can anyone help with cross-domain problem? I have HTML page from server1 that send xmlHTTPRequest to server2. How can I do it? Thanks.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.