Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on Why I am unable to find a class after implementing library also?
Post
Why I am unable to find a class after implementing library also?
I had found a better way to plot in Java.
int n = Integer.parseInt(args[0]);
// the function y = sin(4x) + sin(20x), sampled at n+1 points
// between x = 0 and x = pi
double[] x = new double[n+1];
double[] y = new double[n+1];
for (int i = 0; i <= n; i++) {
x[i] = Math.PI * i / n;
y[i] = Math.sin(4*x[i]) + Math.sin(20*x[i]);
}
// rescale the coordinate system
StdDraw.setXscale(0, Math.PI);
StdDraw.setYscale(-2.1, +2.1);
// plot the approximation to the function
for (int i = 0; i < n; i++) {
StdDraw.line(x[i], y[i], x[i+1], y[i+1]);
}
I don't have the StdDraw class. I was searching in internet what should I do to import the class. I had seen that they said to use
import StdDraw;
//or
import stddraw.StdDraw;
//or
import StdDraw.*;
None of them are helpful cause I don't have the StdDraw package. I had found it then. I can see StdDraw there. But I don't have any idea how can I convert that .java.html to .jar. I had found it to import the package. But the problem is I can't download the package at first.
What!! I can't see any project structure option in netbeans. Ohh They had wrote the answer for IntelliJ. But I am using Netbeans. Even I don't have any file called /lib
. I know that I have to put a line in gradle.build
implementation 'file_name'
But I don't have any idea where I should put that jar file. I have created a folder called libs and pasted that jar file there. Then added the line to gradle.build
implementation fileTree(dir: 'libs', include: ['*.jar'])
I have re-sync my project. Although I can't find that StdDraw class. I have tried to import that class manually..
import stdlib.StdDraw;
But stdlib
doesn't exist. That's what I am getting as error. ~ I was following the answer
2 comment threads