So looking through forum and discord i saw bunch of people using java to simulate their code.
For example theo made this amazing java simulator for pure pursuit, and i am wondering if there is anybody here who is willing to share code to the simulator similar to that so i can tweak around and see how everything works with java. if theres a github repo already that could help me with this please let me know
Hi! I also use GitHub. It works great. I am very familiar with C++ but not much with Java. I know someone, @Skynet that has really nice programming skills. I bet if you pm him you can get your answers he also works with GitHub. I hope that helps! If not, sorry about that.
i dont think you understood what my question was asking, i am not asking about github but rather using java to simulate code such as this
What you truly want is to learn about new algorithms, not people’s developed simulations.
Btw, there are plenty of pure pursuit simulations on github, just search.
if possible could you give an example of a github repo that has a pure pursuit simulation? because i found several repos that had a simulation but i wasnt able to run it on my computer so i could mess around with it
For example with https://github.com/xiaoxiae/PurePursuitAlgorithm, how would i run the simulation on my computer?
Clone the project and run it like you would any other java project. If you don’t know how, google it, I’m sure its pretty straightforward to download and run a java interpreter.
hey so i got Java downloaded and working on my laptop but when i run this https://github.com/xiaoxiae/PurePursuitAlgorithm specifically the PathFollower.java file it shows an error like this
Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedClassVersionError: PathFollower has been compiled by a more recent version of the Java Runtime (class file version 58.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
and when i run the PurePursuit.java File it says bunch of errors https://paste.ubuntu.com/p/tTc3p5nWR4/
Do you have any ideas to fix this?
First of all, you should be running the PurePursuit.java file, since the main method is there. Secondly, the bunch of errors you see stem from the very first error:
PurePursuit.java:3: error: package processing.core does not exist import processing.core.PApplet;
You can’t just expect Java to know where processing is. You need to use an IDE like Eclipse or Intellij & import the Processing library (IDK if the Processing IDE works here). A quick search came up with this guide on how to do that.
Line 2 of the error gives you all the information you need:
PathFollower has been compiled by a more recent version of the Java Runtime (class file version 58.0), this version of the Java Runtime only recognizes class file versions up to 52.0
You need to use a newer version of the JRE (Java Runtime Environment) to run it. Specifically, in this case, you need Java 14 or newer.
so i followed the instructions here https://riptutorial.com/processing/example/24291/using-processing-with-atom-editor
(i am following atom instructions because thats what i use) and i still get the same error, i added processing to the Path as well
C:\Program Files (x86)\processing-3.5.4\
Any ideas on what i could be doing wrong ?
As for the version i believe i am running on the latest Java version
when i run
java -version i get this
java version "1.8.0_251" Java(TM) SE Runtime Environment (build 1.8.0_251-b08) Java HotSpot(TM) Client VM (build 25.251-b08, mixed mode)
and when i run
javac -version i get this
It looks like you have JDK 14 installed, but you also have JRE 8 installed. Uninstalling JRE 8 should result in the
java command pointing to JDK 14 instead of JRE 8.
hey so that did fix the version problem but now it dhows a different error so first i ran
javac PathFollower.java which created a class file, then i ran
java PathFollower which gave this error
Error: Could not find or load main class PathFollower Caused by: java.lang.NoClassDefFoundError: main/PathFollower (wrong name: PathFollower)
BTW i have never used this before so if i am making dumb mistakes my bad
PurePursuitAlgorithm-master.zip (945.0 KB)
So i wasnt able to get the repo to work but thanks to George | BUFF | 4610D from discord, above is a link to the simulation that you can mess around with.