This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Getting Main Method Args  RSS feed

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • 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: 43009
76
  • Mark post as helpful
  • send pies
  • 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.
 
If you like strawberry rhubarb pie, try blueberry rhubarb (bluebarb) pie. And try this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!