-
Notifications
You must be signed in to change notification settings - Fork 35
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
Comments
Hi Glen,
The jar doesn't have to have a main function. Some jars do have it if they
are meant to be executed as a standalone program. Instead jpgf.jar is a
library that you call from your own program. You provide the main method
yourself where you load the grammar by using the library.
Best Regards,
Krasimir
…On Wed, 1 Feb 2023 at 14:26, Glen B ***@***.***> wrote:
"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.
—
Reply to this email directly, view it on GitHub
<#151>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEYFSZD4272LUIGHDXNKKODWVJQBVANCNFSM6AAAAAAUNXFQNQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
You are confusing the system path with the Java path. See here:
https://stackoverflow.com/questions/1734207/how-to-set-java-library-path-for-processing
…On Thu, 2 Feb 2023 at 23:41, Glen B ***@***.***> wrote:
Hi Krasimir,
Thanks for your response. As a result, I have been attempting to load it
as a library.
I'm getting this:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jpgf in java.library.path
My Windows user PATH includes:
C:\Users\Glen\Documents\Grammatical Framework (GF)\gf-3.11-windows\tmp-dist
And my jpgf.jar is at:
C:\Users\Glen\Documents\Grammatical Framework
(GF)\gf-3.11-windows\tmp-dist\java
Any ideas on what the issue could be?
Thanks,
Glen
—
Reply to this email directly, view it on GitHub
<#151 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEYFSZBQZRYSNA2ZMW44MLDWVQZ2VANCNFSM6AAAAAAUNXFQNQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Hi Krasimir, Thank you for your response. As a result, I applied Unfortunately, I am now getting a different error:
I used dependency walker to find the DLLs it depends on:
I copied the two GF ones into the java folder and that seemed to make dependency walker happy. Any advice? Many thanks, |
It is hard to say when I don't know what Dependency Walker told you about
msys. It has been a long time since I last compiled the Java binding on
Windows, but in general I try to avoid compiling with the MSYS runtime.
MSYS tries to do full Linux emulation which is usually not what you want.
Did you compile the GF libraries yourself or did you get them from
somewhere?
Now I don't remember what are the steps to compile with MinGW but maybe
this will help:
https://stackoverflow.com/questions/60101673/learning-how-to-use-configure-make-with-mingw
…On Sat, 4 Feb 2023 at 03:32, Glen B ***@***.***> wrote:
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
—
Reply to this email directly, view it on GitHub
<#151 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEYFSZH2VE4GMYP3L24NOL3WVW5VXANCNFSM6AAAAAAUNXFQNQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I downloaded the GF windows binaries from here: I am looking into how I would compile it myself instead. I've cloned the GitHub repo and I'm looking in
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/. |
The whole process on Windows is confusing. I have to rediscover it
everytime. MSYS is a set of Linux compatible tools. The result from the
compilation is either an MSYS compatible binary or a native binary i.e. a
one for MinGW. The difference is which C runtime is used msys.dll or
msvcrt.dll.
I will change the web site in the instructions.
…On Sat, 4 Feb 2023 at 17:51, Glen B ***@***.***> wrote:
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?
—
Reply to this email directly, view it on GitHub
<#151 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEYFSZAA4MBZUYL4JCOK32LWV2CIRANCNFSM6AAAAAAUNXFQNQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
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.
The text was updated successfully, but these errors were encountered: