• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Compile JavaFX project on Raspberry Pi, Error: "Could not find or load main class..."

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 85
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First I would check contents of this jar file:

and check the manifest file as well
 
Sheriff
Posts: 6033
157
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you post the command you issue in SSH?  Do you have a package statement in your Java code?
 
andrew mcnamara
Greenhorn
Posts: 18
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!