• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

JavaFX JAR executable created in BlueJ Interactive Tutorial throws no Main method error from command

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,  

This is my first post  and from what I can tell the only ( recent ?) one.

I originally learned of this forum through Raspberrypi and Bluej IDE on pi4.

I sent the following to BlueJ support before realizing I could get some help here.

It looks promising.

I appreciate ANY suggestions.  Thank you in advance.




Installation Details

BlueJ version 4.2.1

Java version 11.0.13

JavaFX Version 11.0.10-internal+0 2021-02-03-151839

Virtual Machine: OpenJDK Server VM 11.0.13+8-post-Raspbian-1deb11u1 (Raspbian)

Running on: Linux 5.10.63-v7l+ (arm)

Java Home: /usr/lib/jvm/java-11-openjdk-armhf

Problem Details

-BlueJ Quick Introduction Interactive Tutorial completed

-Successfully created compiled and ran CatView Class as a JavaFX Application in BlueJ IDE

-Created a JAR File of CatView Class

-In Windows 10 double clicked on CatView.jar executable file and no output

-running command line interface from the directory where CatView.jar located using "java -jar CatView.jar" recevied error message

"Error: Could not find or load main class CatView Caused by: java.lang.NoClassDefFoundError: javafx/application/Application"

According the the tutorial a Main class is not required to run a JavaFX executable such as the one created in BlueJ interactive tutorial
.


As far as an instructional beginners tutorial this statement seems to me to be very misleading at this point.

-Also imported CatView.jar into NetBeans 12.6 IDE.

Not sure if this was done correctly so some suggestion on a correct way to create a NetBeans project with an imported and accessible JAR file would be appreciated.

Started a new project and added CatView.jar to it as a Java Application.

Set the libraries for JavaFX in the properties for the project. Build was successful however on running the project with CatView.jar in it, kept receiving runtime error:

"javafx.controls not found"
Main question is: will this BlueJ interactive tutorial run as a standalone executable JAR file anywhere outside of a BlueJ IDE.

I have run nonJar NetBeans JavaFX projects successfully inside of NetBeans but my goal here is to run a JAR file in NetBeans and outside of it.
 
Marshal
Posts: 76867
366
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

There is something different about how you start an FX app, You need a class you will start off the app from, and it calls its launch() method, inherited from Application. I have forgotten most of the details, but you may require a start() method too.If the app launched from BlueJ and not as an executable XXX.jar, please tell us the contents of the manifest file in the XXX.jar, and how the class with the main() method was specified.
 
J Weinstein
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you.

I will post the contents from the .jar manifest file and how the main class method was specified.

Currently,  I am away from the desktop I created the .jar file and will have to post a reply later today or tomorrow.

Thanks again.

 
Campbell Ritchie
Marshal
Posts: 76867
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

J Weinstein wrote:. . . Thank you.

That's a pleasure

. . . later today or tomorrow. . . .

AOK
 
J Weinstein
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

If the app launched from BlueJ and not as an executable XXX.jar, please tell us the contents of the manifest file in the XXX.jar, and how the class with the main() method was specified.



Here are the contents of the manifest file in CatView.jar

Manifest-Version: 1.0
Main-Class: CatView


And here is the CatView.java that is lacking any main method per the tutorials instruction!




Two suggestions you have led me to consider are inserting this main method with launcher and edit the MANIFEST.MF.





 
J Weinstein
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Sheriff,  I done got it done on the command line by installing openjfx and adding the path to the openjfx module and it worked.

Two things,

1 - I added a main method to the class that extends Application ....




2 - installed openjfx and directed the run command

java -jar CatView.jar

to the correct openjfx libraries as follows:




Thanks again,

I will look forward to any additional feedback you may offer if so inclined.




 
Campbell Ritchie
Marshal
Posts: 76867
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well done

Feedback: if you solved the problem with only a little help, you will remember the solution better in future
 
Don't mess with me you fool! I'm cooking with gas! Here, read this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic