andrew mcnamara

Greenhorn
+ Follow
since Apr 15, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
2
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by andrew mcnamara

Hello all,

Many thanks for your responses. Yes, I see now that this was purely a class path issue. I was able to resolve it last night by building a fat jar:

https://stackoverflow.com/questions/18451052/how-to-include-jars-in-lib-into-project-jar-file-in-netbeans/30172972

Your advice here led me to the solution.

Thanks again,
3 days ago
@ Paul : The Java file with the main method is called GUI.java, but the package name in NetBeans where all the source files are is simply “<default package>” (I know, bad move on my part, this is from a while ago). Is there a way we can tell that to the terminal (i.e. something like WITPhoneHome.GUI or main.GUI) since it won’t recognize “<default package>”?

$ java -classpath /home/pi/Desktop/Jars/ <default package>.GUI
-bash: default: No such file or directory
4 days ago
I was still using that version of the java command, yes.

What is a simple way to run our jar on the Pi through terminal while including multiple 3rd-party library jars in the class path?
4 days ago
It's possibly a netbeans problem, but I assume I'm doing something wrong. I also tried to put the jars directly in the runnable jar and running on the pi from terminal. That resulted in the same errors.

To apply libraries, I right click the project folder --> properties --> Libraries (under "categories") --> add (the "+" sign) compile-time class path jar

Please somebody tell me I'm a dummy and I've done something simple and incorrect.

1 week ago
Precisely the same error results when I run with the jars in the WITPhoneHome folder.
1 week ago
When I compile over SSH to the Pi, netbeans creates a runnable jar on the Pi in the directory:

home/pi/NetBeansProjects/WITPhoneHome/dist/WITPhoneHome.jar

I try to put the apache jars inside the WITPhoneHome folder, but that doesn't work. Putting things in the dist folder also didn't work. Any other ideas?

Many thanks for your help.
1 week ago
I only have Netbeans on the macbook. From netbeans on the macbook, I compile on the pi over SSH.
1 week ago
No, that apache jars are not in the runnable jar. Any advice as to where I should put them?

Many thanks for your help.
1 week ago
The project folder is the project directory on netbeans on my work station. I am compiling the project to pi in netbeans over SSH. I should have mentioned this.

Is it possible to add it to the class path so that all library jars are included in the jar which runs on the Pi?
1 week ago
I get this monolith to console:



Connecting to 10.18.20.119:22
cmd : cd '/home/pi/NetBeansProjects//WITPhoneHome'; '/opt/jdk1.8.0_211/bin/java'  -Dfile.encoding=UTF-8   -jar /home/pi/NetBeansProjects//WITPhoneHome/dist/WITPhoneHome.jar
Exception in thread "JavaFX Application Thread"
java.lang.NoClassDefFoundError: org/apache/commons/net/telnet/TelnetClient
at Path.<clinit>(Unknown Source)
at GUI.callConstructors(Unknown Source)
at GUI$5.lambda$handle$0(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8411)
at javafx.scene.control.Button.fire(Button.java:185)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3761)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3489)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2498)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:352)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:275)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:388)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:391)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:387)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.monocle.MonocleView.notifyMouse(MonocleView.java:119)
at com.sun.glass.ui.monocle.MouseInput.notifyMouse(MouseInput.java:314)
at com.sun.glass.ui.monocle.MouseInput.lambda$postMouseEvent$101(MouseInput.java:227)
at com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:93)
at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:52)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.net.telnet.TelnetClient
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 53 more
"
1 week ago

Matt Wong wrote:if you want to use an external lib in your application you just have to add it to the classpath - where this lies in the filesystem is up to you



The library jars are imported into the project folder. They must be in the class path then, right?
1 week ago
Hello all,

I developed much of a java program using JavaFX for use on a raspberry pi. In the process, I used an open-source apache library for some handy telnet methods. That library is here: https://commons.apache.org/proper/commons-net/download_net.cgi

My issue is that my code runs perfectly on my macbook, but crashes on the rPi. Commenting out the apache content allows it to run flawlessly on the Pi. I know I need to put the apache library jars somewhere on the rPi, but I have no idea where.

Any feedback is much appreciated.

Thanks.
1 week ago
Hey guys,

Many thanks for your replies. I was able to solve this issue by figuring out WHICH package I was missing. JavaFX is missing in the Pi.

I fixed it by installing the jars using instructions here:
https://stackoverflow.com/questions/38359076/how-can-i-get-javafx-working-on-raspberry-pi-3

Thanks again.
1 week ago
Hello Code Ranchers,

When I attempt to compile a java FX project on raspberry Pi, I get the message, "Error: Could not find or load main class GUI", where GUI is my main class.

I am coding on MacOS with NetBeans and compling to Raspberry Pi over SSH. See here: https://www.instructables.com/id/Efficient-Development-of-Java-for-the-Raspberry-Pi/

My program compiles perfectly on MacOS in NetBeans. Compiling over SSH results in the error. A runnable JAR is generated on the rPi when I try to compile over SSH. When I try to run this JAR in terminal with "java -jar WITPhoneHome.jar", I get the same error.

I am running java version "1.8.0.211" on the rPi. Also running Java8 on MacOS.

I manually installed Java8 to rPi from here: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Any suggestions are welcomed.
1 week ago
I solved this problem.

Before writing a command to the server, one must check that the final character or string prompt has arrived.

For those out there trying to write a user name or password as a command (for example), first check for that string on the input stream before sending the response on the output stream. I guess this is especially relevant if using threads.



Thanks for your help, Tim!