Hello,
I am using Emacs without JDE. When writing a .java file, then
compiling it e.g. using
$ javac myfile.java
, emacs does not recognize the comment. It is even worse, as emacs
does not allow me to type the whole command, because it does not
recognize what "javac" is. However, it works using a terminal (and
thus without Emacs). How can I manage to make it work?
Thanks.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkqza18ACgkQM0LLzLt8MhyvtgCgj+HLkDdlgwIhZ5+EXXHagd++
rgAAoKqJYfUSEEhlTkN4GmxJR5KrXNv2
=aY7z
-----END PGP SIGNATURE-----
> I am using Emacs without JDE. When writing a .java file, then
> compiling it e.g. using
> $ javac myfile.java
> , emacs does not recognize the comment. It is even worse, as emacs
> does not allow me to type the whole command, because it does not
> recognize what "javac" is. However, it works using a terminal (and
> thus without Emacs). How can I manage to make it work?
What does M-: (executable-find "javac") give you? Compare the output
of M-x show-variable<RET>exec-path<RET> with echo $PATH in your
shell. Do you start emacs from your shell? If not, does starting it
from the shell make the problem go away?
HTH,
Anselm
--
Anselm Helbig
mailto:anselm.helb...@googlemail.com
> It is even worse, as emacs
> does not allow me to type the whole command, because it does not
> recognize what "javac" is. However, it works using a terminal (and
> thus without Emacs). How can I manage to make it work?
It seems as if your "terminal" runs a login shell while GNU Emacs
does not (in which interactive buffer, shell, eshell, term are you
invoking javac?). You could compare the value of the environment
variable PATH in both environments.
So what you need to do is to change your shell setup to have in a
"normal" shell at least the same value for PATH as in a login shell.
--
Greetings
Pete
Basic, n.:
A programming language. Related to certain social diseases in
that those who have it will not admit it in polite company.
Anselm Helbig <anselm.helb...@googlemail.com> writes:
> What does M-: (executable-find "javac") give you?
This command seems not to work on my (however standard) Emacs.
However, I can still do ESC ! to type a shell command, but it is
tedious.
> Compare the output
> of M-x show-variable<RET>exec-path<RET> with echo $PATH in your
> shell.
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/games
Shouldn't I add some lines to this?
> Do you start emacs from your shell?
Yes.
> If not, does starting it
> from the shell make the problem go away?
Whatever the method of starting Emacs, there is no modification about
javac. (I tried both methods.)
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkqzhEcACgkQM0LLzLt8Mhz6VACdHAe8eQy+g/XclpgQgp3dCV6/
fRwAn1Rpz2o4ytlZx5xMhu2VS9FXpJVE
=SKa+
-----END PGP SIGNATURE-----
Peter Dyballa <Peter_...@Web.DE> writes:
> It seems as if your "terminal" runs a login shell while GNU Emacs
> does not (in which interactive buffer, shell, eshell, term are you
> invoking javac?).
Using M-x then typing "javac nameofmyfile". That's the same way as I
habitually do "make -B *.c", for example.
> You could compare the value of the environment
> variable PATH in both environments.
M-x then "echo" is not a recognized command. I think that M-x aims at
executing a limited set of (Emacs-)predefined commands. Am I right?
>
> So what you need to do is to change your shell setup to have in a
> "normal" shell at least the same value for PATH as in a login shell.
Using ESC-!, I can type any shell command, but the output of
echo $PATH
is still the same as in a real terminal (but that is normal).
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkqzhPoACgkQM0LLzLt8Mhx8VQCfcdjLvkADOAQO+wDaNsCH8QNf
YXkAnjVBNGSP++G+ylnE1lQyRVdA4OdJ
=eeLw
-----END PGP SIGNATURE-----
What do you mean, it doesn't work? And what's a standard emacs,
anyway? GNU Emacs? What version?
> However, I can still do ESC ! to type a shell command, but it is
> tedious.
> > Compare the output
> > of M-x show-variable<RET>exec-path<RET> with echo $PATH in your
> > shell.
> $ echo $PATH
> /usr/local/bin:/usr/bin:/bin:/usr/games
So what's the output of M-x show-variable <RET> exec-path <RET> ?
> Shouldn't I add some lines to this?
Not necessarily. What does
which javac
on the shell give you? Which is roughly equivalent to the
executable-find function I asked you to call before, btw.
> > Do you start emacs from your shell?
> Yes.
Hm, strange.
> > If not, does starting it
> > from the shell make the problem go away?
> Whatever the method of starting Emacs, there is no modification about
> javac. (I tried both methods.)
--
Anselm Helbig
mailto:anselm.helb...@googlemail.com
This can not work, because javac is not an emacs command. You have to
use M-! instead of M-x.
> > You could compare the value of the environment
> > variable PATH in both environments.
> M-x then "echo" is not a recognized command. I think that M-x aims at
> executing a limited set of (Emacs-)predefined commands. Am I right?
M-x is for calling emacs commands. I wouldn't call it limited, though,
there are some thousands.
M-! is for calling shell commands, M-: is for evaluation expressions
in emacs lisp.
> > So what you need to do is to change your shell setup to have in a
> > "normal" shell at least the same value for PATH as in a login shell.
> Using ESC-!, I can type any shell command, but the output of
> echo $PATH
> is still the same as in a real terminal (but that is normal).
HTH,
Anselm
> Peter Dyballa <Peter_...@Web.DE> writes:
>
>> It seems as if your "terminal" runs a login shell while GNU Emacs
>> does not (in which interactive buffer, shell, eshell, term are you
>> invoking javac?).
> Using M-x then typing "javac nameofmyfile". That's the same way as I
> habitually do "make -B *.c", for example.
Not unless you defined a command named make--B-*.c
Typing M-x "javac nameofmyfile" RET may work only if you defined a
command named \"javac\ nameofmyfile\".
(defun \"javac\ nameofmyfile\" ()
(interactive)
(do-something))
And then, yes, you may type M-x "javac nameofmyfile" RET
Perhaps you wanted to type:
M-x compile RET C-a C-k javac nameofmyfile RET
but that's something entirely different.
>> You could compare the value of the environment
>> variable PATH in both environments.
> M-x then "echo" is not a recognized command. I think that M-x aims at
> executing a limited set of (Emacs-)predefined commands. Am I right?
Right.
>> So what you need to do is to change your shell setup to have in a
>> "normal" shell at least the same value for PATH as in a login shell.
> Using ESC-!, I can type any shell command, but the output of
> echo $PATH
> is still the same as in a real terminal (but that is normal).
You should get the same path with:
M-x compile RET C-a C-k echo "$PATH" RET
than with:
M-! echo "$PATH" RET
--
__Pascal Bourguignon__
> Merciadri Luca <Luca.Me...@student.ulg.ac.be> writes:
>
>> Peter Dyballa <Peter_...@Web.DE> writes:
>>
>>> It seems as if your "terminal" runs a login shell while GNU Emacs
>>> does not (in which interactive buffer, shell, eshell, term are you
>>> invoking javac?).
>> Using M-x then typing "javac nameofmyfile". That's the same way as I
>> habitually do "make -B *.c", for example.
>
> Not unless you defined a command named make--B-*.c
>
> Typing M-x "javac nameofmyfile" RET may work only if you defined a
> command named \"javac\ nameofmyfile\".
>
> (defun \"javac\ nameofmyfile\" ()
> (interactive)
> (do-something))
>
> And then, yes, you may type M-x "javac nameofmyfile" RET
Wouldn't it just be easier to say he needed to use "M-! javac blah.java"
? it's a very common error on the part of newcomers to Emacs.
>
>
>
> Perhaps you wanted to type:
>
> M-x compile RET C-a C-k javac nameofmyfile RET
>
> but that's something entirely different.
As a side note to the OP, using compile is much nicer since there are
helped functions such as "next-error" which helps navigate to bad
lines. In my c buffers for example I bind F11 to "next-error".
p...@informatimago.com (Pascal J. Bourguignon) writes:
> You should get the same path with:
>
> M-x compile RET C-a C-k echo "$PATH" RET
> than with:
> M-! echo "$PATH" RET
>
That is the case. And?
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkqzqvIACgkQM0LLzLt8Mhx2bgCfVmLCb7AxiWw1HjamlVgkNdd8
Eg0AoJp9TMTREs/+z5AUVQHF/ojcYbqD
=Fgzc
-----END PGP SIGNATURE-----
Richard Riley <riley...@gmail.com> writes:
>> Perhaps you wanted to type:
>>
>> M-x compile RET C-a C-k javac nameofmyfile RET
>>
>> but that's something entirely different.
>
> As a side note to the OP, using compile is much nicer since there are
> helped functions such as "next-error" which helps navigate to bad
> lines. In my c buffers for example I bind F11 to "next-error".
Okay. This command is not easy to keep in your head, but if it is
needed, okay.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkqzq04ACgkQM0LLzLt8MhyP3QCfV0iAuu7mHggjpWbTnG2Cg1Z/
2r8An3Vpu1UUzJdqb8lsl9HYwk4eKVLw
=C0xc
-----END PGP SIGNATURE-----
Thanks for your answer, Anselm.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkqzq4wACgkQM0LLzLt8MhwNLwCfZXxLo/8QSVupPDd4hrpfhXDZ
370An1hDlwUx3I1Wak7mCdfQmCc2+ZKr
=+c2g
-----END PGP SIGNATURE-----
I have this in my .xemacs/init.el
(The Xemacs equivalent of .emacs).
I'm not sure if the key-definition
syntax is correct for FSF Emacs.
It defines M-! c to run (compile),
as I use compile frequently.
HTH,
Colin S. Miller
(global-unset-key '[(meta !)])
(global-set-key '[(meta !) (meta !)] 'shell-command)
(global-set-key '[(meta !) c] 'compile)
(global-set-key '[(meta !) g] 'grep)
(global-set-key '[(meta !) s] 'shell)
(when (eq system-type 'windows-nt)
(defun csm-handle-start-dot ()
(interactive)
(shell-command "start .")
)
(global-set-key '[(meta !) \.] 'csm-handle-start-dot)
)
--
Replace the obvious in my email address with the first three letters of the hostname to reply.
> This command is not easy to keep in your head, but if it is
> needed, okay.
If you are usually compiling Java sources, then you can customise the
variable compile-command to become javac instead of 'make -k'.
--
Greetings
Pete
There's no place like ~
– (UNIX Guru)
Peter Dyballa <Peter_...@Web.DE> writes:
> If you are usually compiling Java sources, then you can customise the
> variable compile-command to become javac instead of 'make -k'.
Nice idea. Thanks.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkqz2wgACgkQM0LLzLt8MhwCpQCeOCoDvKy8EepLeV3l3n+tDPXt
FxQAn0Vk1oLCc+UlcWp1zi2gmEe7D8EU
=LIAM
-----END PGP SIGNATURE-----
Thanks for this. I have saved it.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkqz2yQACgkQM0LLzLt8Mhx82QCfYs568MZCQLuFau4N5lIzcSM2
TpgAnixz3UGNJBQULw9nfTL49qABnuiD
=SLvS
-----END PGP SIGNATURE-----
Anselm Helbig <anselm.helb...@googlemail.com> writes:
> At Fri, 18 Sep 2009 14:59:51 +0200,
> Merciadri Luca <Luca.Me...@student.ulg.ac.be> wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Anselm Helbig <anselm.helb...@googlemail.com> writes:
>>
>> > What does M-: (executable-find "javac") give you?
>> This command seems not to work on my (however standard) Emacs.
>
> What do you mean, it doesn't work? And what's a standard emacs,
> anyway? GNU Emacs? What version?
It show me
"Trailing garbage following expression". It also does this when typing
executable-find javac
. Why? I am using GNU Emacs 22.2.1. Sorry for my imprecisions.
>
>> However, I can still do ESC ! to type a shell command, but it is
>> tedious.
>> > Compare the output
>> > of M-x show-variable<RET>exec-path<RET> with echo $PATH in your
>> > shell.
>> $ echo $PATH
>> /usr/local/bin:/usr/bin:/bin:/usr/games
>
> So what's the output of M-x show-variable <RET> exec-path <RET> ?
I would like to be able to give it to you, but M-x show-variable
returns "[No match]".
>
>> Shouldn't I add some lines to this?
>
> Not necessarily. What does
>
> which javac
>
> on the shell give you? Which is roughly equivalent to the
> executable-find function I asked you to call before, btw.
It gives /usr/bin/javac .
>
>> > Do you start emacs from your shell?
>> Yes.
>
> Hm, strange.
I know.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkqz3IMACgkQM0LLzLt8Mhx35gCeM7SAwS4De5NLMOwjWo+S8JvG
CGgAn13fOFertsp31g77gQQ6trfEhxba
=QJNO
-----END PGP SIGNATURE-----
What I find *really* strange is that, according to my $PATH variable
(assuming the kernel recursively looks in directories when such a
variable is specified), javac's directory should be detected. However,
it is not the case. I do not understand.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkqz3OsACgkQM0LLzLt8Mhy3agCfQyJ7rtUa/RHaLRLOjM+9SNrM
DuIAn0MKfuifT7N+p5AW11Kr9V8a0fiI
=vXzC
-----END PGP SIGNATURE-----
> What I find *really* strange is that, according to my $PATH variable
> (assuming the kernel recursively looks in directories when such a
> variable is specified),
The kernel never does such silly things. This is performed by some
shell. (The kernel even has no idea of a concept named "PATH.")
> javac's directory should be detected.
This is no executable and therefore adding it to $PATH is, in
politically correct words, not recommended.
--
Greetings
Pete
To most people solutions mean finding the answers. But to chemists
solutions
are things that are still all mixed up.
Peter Dyballa <Peter_...@Web.DE> writes:
>> javac's directory should be detected.
>
> This is no executable and therefore adding it to $PATH is, in
> politically correct words, not recommended.
That is what I thought. My problem is solved using M-x compile RET
javac foo.java RET
Thanks.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkq0lHQACgkQM0LLzLt8MhyJJACgpiZvKaAN1PqbLOFg9VjsbTny
rsEAn06P1/PeszwfBcgTEo7RJyboV1cV
=zrDW
-----END PGP SIGNATURE-----