Skip to content
Advertisement

Generic error messages when compiling basic program through mac terminal [closed]

I am using linux and emacs, I got a program working fine on one computer but when I try to compile it through my mac terminal it refuses to work, giving an error message that reads as follows:

Jamess-MacBook-Pro:uni_shit James$ javac /Users/James/Desktop/uni_shit/cp4a.java
/Users/James/Desktop/uni_shit/cp4a.java:43: error: class, interface, or enum expected
}
^
1 error

The code is copied and pasted from what was working perfectly. Here is my code:

http://s30.postimg.org/9zmp2rr35/Screen_Shot_2014_10_08_at_18_20_43.png

Advertisement

Answer

It looks like you’ve pasted everything from the terminal running Emacs into the Xcode editor, including the status bar Emacs prints at the bottom (which is not part of your code). Delete everything from -uuu to the end of the file.

In the future, save the file in Emacs (e.g. on a flash drive or online storage) and open it up in Xcode (or whatever editor you choose), rather than copying and pasting. That will cut down on errors like this; and besides, you might have a program longer than one screen some day.

I should add, in case you’re interested, that Emacs works fine on Macs too. There’s actually a version of it included in OS X, although it’s pretty old; for the current version, there are a few options to choose from, of which the most popular seem to be Emacs For OS X and Aquamacs. The main difference is that Aquamacs acts a little more like a Mac app in its handling of keyboard shortcuts and things like that; but the standard one also includes nice Command key shortcuts for a lot of things.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement