Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何将JFreeChart文件中的External.jar添加到BlueJ?_Java_Jar_Jfreechart_Packages_Bluej - Fatal编程技术网

Java 如何将JFreeChart文件中的External.jar添加到BlueJ?

Java 如何将JFreeChart文件中的External.jar添加到BlueJ?,java,jar,jfreechart,packages,bluej,Java,Jar,Jfreechart,Packages,Bluej,我正在做一个程序,在这个程序中,我计算三维空间中两点之间的距离。现在我需要JFreeChart在XYZ轴上绘制这两个点形成的线。另外,这个程序需要在另一台使用BlueJ的计算机上运行,因此我想以包的形式导入JFreeChart库。但我甚至无法将其作为外部.jars添加到Tools\Preferences\Libraries中,我确实重新启动了BlueJ。所以,请告诉我如何做到这一点,特别是作为一个包。提前谢谢。我的部分代码如下: String Sx1,Sx2,Sy1,Sy2,Sz1,Sz2;

我正在做一个程序,在这个程序中,我计算三维空间中两点之间的距离。现在我需要JFreeChart在XYZ轴上绘制这两个点形成的线。另外,这个程序需要在另一台使用BlueJ的计算机上运行,因此我想以包的形式导入JFreeChart库。但我甚至无法将其作为外部.jars添加到Tools\Preferences\Libraries中,我确实重新启动了BlueJ。所以,请告诉我如何做到这一点,特别是作为一个包。提前谢谢。我的部分代码如下:

String Sx1,Sx2,Sy1,Sy2,Sz1,Sz2;
                Sx1=tAX.getText();
                Sy1=tAY.getText();
                Sz1=tAZ.getText();
                Sx2=tBX.getText();
                Sy2=tBY.getText();
                Sz2=tBZ.getText();
                double mx,xi,yi,zi,x1,y1,z1,x2,y2,z2,px,py,pz,dXY,dist,c,mz,cmain,c2;
                double re1;
                boolean v1=false,v2=false,v3=false,v4=false;
                x1=Integer.parseInt(Sx1);
                y1=Integer.parseInt(Sy1);
                z1=Integer.parseInt(Sz1);
                x2=Integer.parseInt(Sx2);
                y2=Integer.parseInt(Sy2);
                z2=Integer.parseInt(Sz2);
                px=Math.abs(x2-x1);
                py=Math.abs(y2-y1);
                pz=Math.abs(z2-z1);
                dXY=Math.sqrt((px*px)+(py*py));
                dist=Math.sqrt((dXY*dXY)+(pz*pz));

                mx=py/px;
                mz=py/pz;

                c=y1-(mx*x1);
                c2=y1-(mz*z1);

                JFrame f2=new JFrame("Answers");
                f2.setSize(600,600);
                f2.setVisible(true);
                f2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                Dimension dim=Toolkit.getDefaultToolkit().getScreenSize();
                f2.setLocation(dim.width/2-f2.getSize().width/2,dim.height/2-f2.getSize().height/2);

                JPanel p2=new JPanel(new GridBagLayout());

                JLabel L1=new JLabel("The distance between the two points is "+dist);
                gbc.insets=new Insets(5,5,5,5);
                gbc.gridx=0;
                gbc.gridy=1;
                p2.add(L1,gbc);

                JLabel L2=new JLabel("The slope of the line on the x axis is  "+mx);
                gbc.insets=new Insets(5,5,5,5);
                gbc.gridx=0;
                gbc.gridy=2;
                p2.add(L2,gbc);

                if(c!=0)
                {
                    JLabel L3=new JLabel("The equation of the line on the XY plane is: y="+mx+"x+"+c);
                    gbc.insets=new Insets(5,5,5,5);
                    gbc.gridx=0;
                    gbc.gridy=3;
                    p2.add(L3,gbc);
                }
                else 
                {
                    JLabel L3=new JLabel("The equation of the line on the XY plane is: y="+mx+"x");
                    gbc.insets=new Insets(5,5,5,5);
                    gbc.gridx=0;
                    gbc.gridy=3;
                    p2.add(L3,gbc);
                }

                if(c2!=0)
                {
                    JLabel L4=new JLabel("The equation of the line on the YZ plane is: y="+mz+"z+"+c2);
                    gbc.insets=new Insets(5,5,5,5);
                    gbc.gridx=0;
                    gbc.gridy=4;
                    p2.add(L4,gbc);
                }
                else 
                {
                    JLabel L4=new JLabel("The equation of the line on the YZ plane is: y="+mz+"z");
                    gbc.insets=new Insets(5,5,5,5);
                    gbc.gridx=0;
                    gbc.gridy=4;
                    p2.add(L4,gbc);
                }



                f2.add(p2);

在这里,我需要根据这两个方程画出这条线。任何关于这方面的建议都很好

首先,您可以始终从命令提示符/终端窗口运行程序,并使用开始脚本指定外部JAR文件。以下是Windows环境中的示例:

C:> java -classpath C:\java\MyClasses\myclasses.jar utility.myapp.Cool

至于第二个选项,我不确定BlueJ是否使目录工具\首选项\库中的库可供您开始使用它的程序使用。我假设BlueJ在IDE中有某种方法可以在启动程序时将打包成JAR文件的外部库添加到Java类路径中。

谢谢,但C:>代表什么?它是Windows操作系统上硬盘的C-drive或默认名称。命令本身以您必须键入的“java…”开头。你在用什么操作系统?在基于Unix的环境中,它通常显示您的姓名,而不是此C:>和/或美元符号与当前目录的组合。