Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java API (Windows) - No Main entry point in jpgf.jar #151

Open
UserBoi1 opened this issue Feb 1, 2023 · 6 comments
Open

Java API (Windows) - No Main entry point in jpgf.jar #151

UserBoi1 opened this issue Feb 1, 2023 · 6 comments

Comments

@UserBoi1
Copy link

UserBoi1 commented Feb 1, 2023

"C:\Program Files\Java\jdk1.8.0_261\bin\java.exe" -Dfile.encoding=windows-1252 -jar "C:\Users\Glen\Documents\Grammatical Framework (GF)\gf-3.11-windows\tmp-dist\java\jpgf.jar"
no main manifest attribute, in C:\Users\Glen\Documents\Grammatical Framework (GF)\gf-3.11-windows\tmp-dist\java\jpgf.jar

Process finished with exit code 1

I am using IntelliJ with the jfpg.jar added as a dependency to my project.

It's not just the MANIFEST.MF missing a mention of the entry point. I have searched through all the classes in jpgf.jar and none of them has a static void main(String[] args) in them.

I don't really know much about JARs, but from what I can google, it seems it has to have such an entry point. Is jpgf.jar a kind of non-executable JAR? What is it that I'm missing here?

Any help appreciated.

@krangelov
Copy link
Member

krangelov commented Feb 2, 2023 via email

@krangelov
Copy link
Member

krangelov commented Feb 3, 2023 via email

@UserBoi1
Copy link
Author

UserBoi1 commented Feb 4, 2023

Hi Krasimir,

Thank you for your response. As a result, I applied -Djava.library.path=C:\Users\Glen\Documents\GrammaticalFramework\java and it got past the error!

Unfortunately, I am now getting a different error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Glen\Documents\GrammaticalFramework\java\jpgf.dll: Can't find dependent libraries
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1850)
	at java.lang.Runtime.loadLibrary0(Runtime.java:871)
	at java.lang.System.loadLibrary(System.java:1122)
	at org.grammaticalframework.pgf.PGF.<clinit>(PGF.java:88)
	at Game.main(Game.java:20)

Process finished with exit code 1

I used dependency walker to find the DLLs it depends on:

  • C:\Users\Glen\Documents\GrammaticalFramework\c\libpgf-0.dll
  • C:\Users\Glen\Documents\GrammaticalFramework\c\libgu-0.dll
  • C:\Windows\System32\Kernel32.dll
  • C:\Windows\System32\msys-2.0.dll

I copied the two GF ones into the java folder and that seemed to make dependency walker happy.
Kernel32 is fine.
But it said msys2 was not fine.
I have it on my machine, but under C:\msys64. I didn't know if it was a risky move to install it to System32 so I just copied the msys-2.0.dll in. Made no difference. Dependency walker still unhappy. Code still produces the same mysterious error. So I copied msys-2.0.dll into my C:\Users\Glen\Documents\GrammaticalFramework\java, seeing as that worked for the GF ones. Made no difference.

Any advice?

Many thanks,
Glen

@krangelov
Copy link
Member

krangelov commented Feb 4, 2023 via email

@UserBoi1
Copy link
Author

UserBoi1 commented Feb 4, 2023

I downloaded the GF windows binaries from here:
https://github.com/GrammaticalFramework/gf-core/releases/tag/3.11

I am looking into how I would compile it myself instead. I've cloned the GitHub repo and I'm looking in gf-core/src/runtime/java. The INSTALL file tells me I need to do C first. The INSTALL file for C says:

For Windows users
-----------------

- Install MinGW: http://www.mingw.org/. From the installer you need
  to select at least the following packages:
     - Mingw-developer-toolkit
     - Mingw-base
     - Msys-base
  After the installation, don't forget to fix the fstab file. See here:
     http://www.mingw.org/wiki/Getting_Started

- From the MSYS shell (c:/MinGW/msys/1.0/msys.bat) go to the directory
  which contains the INSTALL file and do:

  $ autoreconf -i
  $ ./configure
  $ make
  $ make install

  The compiled binaries should be now in c:/MinGW/msys/1.0/local/bin.

This is quite confusing for a few reasons. http://www.mingw.org/ is no longer a valid link. A quick Google reveals that it has been succeeded by a project called https://www.mingw-w64.org/.
And it talks about both Mingw and Msys. You mentioned avoiding compiling with Msys so should I disregard these instructions?

@krangelov
Copy link
Member

krangelov commented Feb 5, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants