• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to set java-app voor filetype

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everybody,
Does anyone know how I can set a java application to be the default application to load a filetype. So that the effect in Windows will be that when you double click a file it will open you java application.
Regards,
Mark Monster
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you write a batch file which takes one arg
in this run java command as
<jdk_path>/bin/jave -cp <classpath> %1
now set this batch file as a default app to open your file type.
If batch file doesn't work then use a c program to run Java command.
 
M.K.A. Monster
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This just isn't the solution I really like, I hate batch and building a C program also isn't a solution. Does anyone have a real nice solution?
Regards,
Mark Monster
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here you go:
In Windows Explorer, go to Tools->Folder OPtions from the menu bar. Select the "File Types" tag (If you don't see the tag, select a different folder and repeat).
Press "New".
A dialog box will appear.
Enter your extension and press "OK"
Press the "Change" button. Browse to the java application ({JAVA_HOME}/bin/java.exe or javaw.exe; probably the latter, since it suppresses the DOS window).
Press "OK"
Press "Advanced"
Press "New"
In the "Action" text field, type "Open".
In the "Application used to perform action" text field, again browse to the java application.
Press "OK"
Edit the "Application used to perform action" text field so that it is the command line that you wishe to perform:
Example:
"C:\Program Files\Java\j2re1.4.1_02\bin\java.exe" my.package.and.Application "%1"
Note that the parameter (%1--The file on which you are double clicking) must be in quotes; otherwise, you will receive multiple parameters if the file has a space in either its path or name.
Press "OK"
Press "OK"
Press "Close"
Double click your file. It should launch your application.
 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can also create a shortcut to it. in explorer, create a new shortcut. edit the properties so that the command is the path to java.exe or javaw.exe followed by your class name and any other arguments. you can also use the environment variables if they are set:
%JAVA_HOME%\bin\java.exe MyApp param1 param2
then, edit the "start in" box so that the path is the directory of your app. you should then be able to double click on it and launch the program.
 
reply
    Bookmark Topic Watch Topic
  • New Topic