jEdit Community - Resources for users of the jEdit Text Editor
Associating Files With jEdit
Submitted by doggroomer on Monday, 20 August, 2007 - 18:07
I really like using jEdit. It is a wonderful piece of software.
But with version 4.2 there is no way to associate file types with jEdit.
I was looking for a way to associate file types with jEdit in Windows.
Windows will not let you associate an executeable ".jar" file with a file type.
I like the function in windows of just double clicking on the file name and
having the file load in a particular application. When a file is double clicked
in Windows the file name is passed to the program associated with that file.
From some simple testing I knew that jEdit would accept a command line argument
with the file name in it. So all you have to do is create a simple executeable
file that will pass its command line arguments to jEdit and load jEdit. I did
this using Visual Studio 2005.


Create a new windows application and name it "jEdit".

Make the Icon for the executeable
In the Solution Explorer right click on the jEdit project and select
"Properties".
In the main screen on the left hand tab section choose the "Application"
tab.
Under icon browse to the jEdit icon saved wherever jEdit was installed on
your computer.

Add this code in the form load event

Try
Dim jFile As String = ""
If My.Application.CommandLineArgs.Count = 0 Then
'There are no command line arguments
'So there is no File Name supplied
'Will just load Jedit when .exe is double clicked
jFile = Nothing
Else
'A file associated with this appliction is doubled clicked
'The file name is passed in the first command line argument
'Enclose filename in quotation marks in case of spaes in file name
jFile = Chr(34) & My.Application.CommandLineArgs.Item(0) & Chr(34)
End If
Dim applicationName As String = "C:\Program Files\jEdit\jedit.jar"
Dim jProcess As New System.Diagnostics.Process
jProcess.StartInfo.FileName = applicationName
jProcess.StartInfo.Arguments = jFile
jProcess.Start()
jProcess.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "jEdit Load Error")
End Try
Me.Visible = False
Me.Close()

The "C:\Program Files\jEdit\jedit.jar" is installation location for the jEdit
executeable. So change this as necessary.

Build the project

Navigate to the Visual Studio 2005 project folder for the jEdit project you
created and locate the executeable created after the build.

Save the ".exe" in the jEdit installation directory.

You now have a "jEdit.exe" that you can associate file types too.
User login
Browse archives
« April 2024  
MoTuWeThFrSaSu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82348
Context Free Art (*.cfdg)   0.31   46055
JBuilder scheme   .001   18495
BBEdit scheme   1.0   18116
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293