• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Getting Main Method Args

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

This could well be a question for install4j, but I'm not sure, and I hoped others here might have had the same problem.

Basically, I use install4j to create installers and application files for both Windows and Mac. In both cases I can associate the files created by my application with that application, so that double-clicking on a saved file opens the application, just as double-clicking a .doc file opens Microsoft Word.

This is great, except that on the Mac, I'm struggling to get the application to open the file that was double-clicked.

In Windows, the path and filename of the file are passed into the String array in the main() method (args[0]), and I can then open the file from there. On the Mac, this isn't the case, does anyone know what is likely to happen to the file path when the user double-clicks?

Apologies if this is an install4j question, but I'm really stuck!

 
Rancher
Posts: 43024
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The way to do this on the Mac is to implement InvocationHandler, which has hooks for OS events like app open, doc open, doc print, app quit, show about and show preferences. The OSXAdapter demonstrates how this is done. (Incidentally, if you're doing cross-platform work involving the Mac, you might also be interested in the AppleJavaExtensions.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic