Crosshairs

I made a cube in 3rd person view which shoots cannonballs from the cube at the center of the screen. I also made crosshairs which are not in the center of the screen but above center. How can I make the cube shoot cannonballs at the crosshairs?

If the crosshairs are not aligned with the source of the cannonball then this is not an answerable question.

What does ‘shoot at the crosshairs’ mean? x distance away… automatically at the object that happens to be under the crosshair? etc.

When it’s aligned with the source of the bullets, it’s easy. Just make a ray that goes through that point of the screen. Shoot the cannonballs along the ray.

From what I see, there could be a couple ways to interpret your question.
First of all, are you asking how to get the crosshair icon in the center of your screen? In that case, we will need more details about what GUI you are using.
If you are trying to get the aim correct, you may want to consult this article:
https://www.forrestthewoods.com/blog/adventures_with_guns_in_a_third_person_shooter/
In short, you will have to at minimum make two ray traces. The first from the camera outward to determine where you want the attack to land (this will be where the crosshair will be aiming at). The second one goes from the gun to whatever the point of impact of the first ray trace was. This will be the path of the shot itself. The source is different, but the destination will hopefully be the same.

Also, if the crosshair being above the center of the screen is intentional, you can always rework the mouse picking code from Mouse Picking :: jMonkeyEngine Docs and just set the click2d variable to however high above the camera center your crosshair should be when you are doing your first raycast.

public Vector3f getAimTarget(Camera cam, Node rootNode) {
    CollisionResults results = new CollisionResults();
    /*
    * Just set this variable here.
    */
    Vector2f click2d = new Vector2f(0, VERTICAL_OFFSET);

    Vector3f click3d = cam.getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 0f).clone();
    Vector3f dir = cam.getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 1f).subtractLocal(click3d).normalizeLocal();
    Ray ray = new Ray(click3d, dir);
    rootNode.collideWith(ray, results);
    
    for (int i = 0; i < results.size(); i++) {
        float dist = results.getCollision(i).getDistance();
        Vector3f pt = results.getCollision(i).getContactPoint();
        String target = results.getCollision(i).getGeometry().getName();
    }
    if (results.size() > 0) {
        return results.getCollision(0).getContactPoint();
    }
    else {
        return null;
    }
}