Able to build JPF and SPF from the terminal, but failed to run the .jpf examples from eclipse

90 views
Skip to first unread message

Shiqi Zhang

unread,
Feb 22, 2023, 11:55:39 AM2/22/23
to Java™ Pathfinder
Hi, I'm able to run ant build and ant test in the terminal to build both core and symbc. However, I have encountered this error when trying to run Test.jpf using the given configuration. I have double checked that I'm using JDK1.8

Screen Shot 2023-02-22 at 08.55.02.png

Shiqi Zhang

unread,
Feb 22, 2023, 11:58:45 AM2/22/23
to Java™ Pathfinder

[Console output redirected to file:/Applications/Eclipse.app/Contents/MacOS/output]

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

   The type java.lang.invoke.VarHandle cannot be resolved. It is indirectly referenced from required .class files

   at gov.nasa.jpf.Config.<init>(Config.java:1985)

   at gov.nasa.jpf.tool.RunJPF.main(RunJPF.java:87)

Cyrille Artho

unread,
Feb 24, 2023, 5:37:44 AM2/24/23
to Java™ Pathfinder
Hi,
VarHandle is a new feature from Java 9. Perhaps you are using the branch `java-10-gradle` on Java 8, or you compiled the code using javac version 9 or higher, or you are running Java 9 or higher. This can easily happen when using Eclipse because it is harder to see what all the configuration options in use are.

Shiqi Zhang

unread,
Feb 24, 2023, 10:46:05 AM2/24/23
to java-pa...@googlegroups.com
I’m using SPF, so I just cloned the separate JPF repo listed on the symbc README. Is this the correct approach? I’ve also checked the project compiler/JRE, and they are at 1.8. Is there anywhere else I should double check in eclipse? Thank you!

--

---
You received this message because you are subscribed to a topic in the Google Groups "Java™ Pathfinder" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/java-pathfinder/1y3OG_2ZCcc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to java-pathfind...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/java-pathfinder/e7266a6a-8ce3-4347-a205-79d239adc73dn%40googlegroups.com.

so...@umn.edu

unread,
Mar 5, 2023, 2:17:23 AM3/5/23
to Java™ Pathfinder
Hi Shiqi,

You need to follow the steps in the readme here (https://github.com/SymbolicPathFinder/jpf-symbc). Note that for you to run SPF you need both SPF and JPF:
1. you can find the JPF version here (https://github.com/SymbolicPathFinder/jpf-symbc)
2. and you can find the SPF version here (https://github.com/corinus/jpf-core)


After that, you need to follow the steps in the readme file, as I mentioned before. These steps tell you how to set up SPF using Eclipse. Like you suggested, you need to make sure that you have java8 on your machine. Also, you need to make sure that both of your projects are using java 8. To ensure that click on the properties of the two projects and check the version on the Java Compiler. 

If you try to build your project and still see compilation errors, it might be because of a problem on your build path. To check, follow these steps:
  1. click on the project and select “build path”
  2. then select “configure build path”
  3. then go to the “libraries” tab
  4. select the JRE that exists, in my case, it was “Amazon Corretto 11”, and remove it, we want to have java 8 in there.
  5. select add “add library”
  6. select "JRE System Library”
  7. select “Alternate JRE”, and choose Java 1.8, or java 8 SE, if you do not see these selections, then you do not have java 8 installed on your machine. Install it first then repeat these steps.

You need to do the above steps for both jpf-core and jpf-symbc. After that, you can select BuildAll projects, and you should see no compilation errors.


I hope that helps,


Soha
Reply all
Reply to author
Forward
0 new messages