jEdit Community - Resources for users of the jEdit Text Editor
How to launch jEdit from inside another Java program?
Submitted by trader_stuart on Monday, 23 October, 2006 - 10:56
Sorry people this is probably a really dumb question but I've been searching the forum and the net for 2 hours and I can't find the answer.

I have a Java program that maintains a list of web pages. Presently the program is configurable to allow the user to select an editor of choice e.g. NotePad, WordPad, DreamWeaver etc. That editor is opened with the files that the user has selected from a list box. I would like it to be possible for jEdit to be used, however I have failed completely to get jEdit to launch. I have found numerous examples of code on the web that make a call like this -> jEdit.openFile(null, path) but when I use null for the View I get a null pointer exception. I've tried using jEdit.getCurrentView and that returns null (not surprisingly), I've even launched jEdit manually and getCurrentView still returns a null.

What am I missing, I assume this is possible? I don't want multiple instances, I just want a single instance of jEdit running with the ability to set it viewing one or more files that have been selected from inside of my Java program.

Any help most appreciated. I'm running jEdit 4.3pre7 under Windows XP Home.
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
like every program
by Robert Schwenn on Mon, 23/10/2006 - 20:15
It can be launched like every external program:

command = "cmd /c start javaw.exe -jar G:\\tools\\jedit\\jedit.jar \"" + filepath + "\"";
Runtime.getRuntime().exec(command);
 
My stupidity was of a very su
by trader_stuart on Mon, 23/10/2006 - 22:10
My stupidity was of a very subtle nature, I had tried to launch it externally but I was using java.exe (not javaw.exe) D'oh!

Thank you very much Robert.
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