stanfordnlp / CoreNLP

CoreNLP: A Java suite of core NLP tools for tokenization, sentence segmentation, NER, parsing, coreference, sentiment analysis, etc.
http://stanfordnlp.github.io/CoreNLP/
GNU General Public License v3.0
9.68k stars 2.7k forks source link

com.apple.eawt.Application can not be resolved to a type (in class OSXAdapter) #1400

Open scasadei opened 11 months ago

scasadei commented 11 months ago

Hello, in OSXAdapter, line 16 below:

13 public class OSXAdapter extends ApplicationAdapter { 14 15 private static OSXAdapter adapter; 16 private static com.apple.eawt.Application app;

the compiler says com.apple.eawt.Application can not be resolved to a type, even though, according to eclipse, com.apple.eawt.Application.class is on the build path (see attached screen shot)

OSXAdapter-Screenshot 2023-11-24 at 6 01 46 PM
AngledLuffa commented 11 months ago

Could the problem be that the Application package is not specifically imported? What happens if you add this to top?

import com.apple.eawt.Application;
scasadei commented 11 months ago

It doesn't help

AngledLuffa commented 11 months ago

Maybe this has something to do with it?

https://stackoverflow.com/questions/13978471/com-apple-eawt-what-exactly-i-should-install

According to people on that page, Java 9 on Mac no longer has that package. I don't really know anything about this, and I wasn't planning on doing Java dev on Mac any time soon - too much other stuff on my plate right now.

@manning any thoughts on replacing this?

scasadei commented 11 months ago

Nothing depends on OSXAdapter, so I have simply removed it for the time being. Thank you.

manning commented 9 months ago

Yeah, this is a to-do! com.apple.eawt.* was the ancient Apple-written code to support Java apps under the macOS GUI. It was discontinued and replaced by (Oracle-supported, in the JDK) java.awt.Desktop methods. We should move to using it, but the slight catch is that the new methods were only added after Java 8, so the straightforward move would be from supporting Java 8 to a minimum level of Java 11. However, maybe the amount of stuff is small enough that we could use reflection and then it would compile on Java 8+ but TregexGUI would only run on Java 11+. At any rate, having the code with com.apple.eawt.Application is useless for everybody, since it won't run on anything except an archaic version of macOS (OS X 10.9 or earlier, i.e., 2014 or earlier).

Maybe I'll try to fix this this week so that I feel like I've actually done something useful for 2024.