Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In my java code why am I still recieving this error code: Error: Could not find or load main class Shapes.Shape Caused by: java.lang.NoClassDefFoundError: javafx

In my java code why am I still recieving this error code: Error: Could not find or load main class Shapes.Shape
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application. import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.Group;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.scene.shape.Line;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
//
public class Shape extends Application {
//defining the X variable
private static final int x =50;
@Override
public void start(Stage primaryStage){
//created rectangle
//set properties
Rectangle angle = new Rectangle();
angle.setX(50);
angle.setY(50);
angle.setHeight(2* x);
angle.setWidth(2* x);
angle.setStroke(Color.BLUE);
angle.setFill(Color.BLUE);
angle.setStrokeWidth(3);
//created circle
//set properties
Circle c = new Circle(x);
c.setStroke(Color.RED);
c.setFill(Color.RED);
c.setStrokeWidth(3);
Line line11= new Line(-x /1.5,-x /2.5, x /1.5,-x /2.5);
Line line12= new Line(0,-x,0, x);
line11.setStroke(Color.GREEN);
line11.setStrokeWidth(6);
line12.setStroke(Color.GREEN);
line12.setStrokeWidth(6);
StackPane lines = new StackPane();
GridPane pane = new GridPane();
pane.setPadding(new Insets(10,10,10,10));
pane.add(lines,2,2);
pane.add(angle,0,0);
pane.add(c,1,1);
pane.add(new Group(),2,2);
Scene scene = new Scene(pane);
primaryStage.setTitle("Shapes in Grid");
primaryStage.setScene(scene);
primaryStage.show();
primaryStage.setResizable(false);
}
public static void main(String[] args){
launch(args);
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions