Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Nick Petas

Ranch Hand
+ Follow
since Jan 31, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nick Petas

I just found the solution.
The problem is that at the 90% of the web pages they forget to add .: before the path of the jar..
Here is the correct solution :

java -cp .:/Users/Administrator/Downloads/stdlib.jar Average
6 years ago
Hello guys.
I am reading the excellent book Algorithms.
The author of this book is using his own libraries.
I have downloaded the libraries (it is a file called stdlib.jar) and I've store it in a directory called ~/Downloads(I am using a macbook pro).
Then I have created a project with IntelliJ Idea 14.1 using the default package (as it is the only way for a program to 'see' these libraries).
The program is running inside the ide, but because of the nature of this book, all the included code must be run from the command line.
The problem is that I cannot run for example the Average class from the command line because the system asks for the external library.
Specifically the error is :

I enter : java -cp . Average

and the Error I get is :

Exception in thread "main" java.lang.NoClassDefFoundError: StdIn
at Average.main(Average.java:11)
Caused by: java.lang.ClassNotFoundException: StdIn
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more

The Average class is the following :



6 years ago
I have three classes in the same directory.
The 3rd class is using one of the others.
Although I have compiled the first two classes in the same directory , when I try to compile the 3rd class I get the classic cannot find symbol error pointing to the type that is already compiled in this same directory.
How can I overcome this problem?
Thank you.
10 years ago
I created a new web application project but when I am trying to run it I get the following errors :



Any ideas on what is ghoing on here?
Thank you.
(I am using snow leopard, tomcat 7, and NetBeans 7)
Thnx a lot Darryl for your answer.Now I get it.
Is there anywhere any complete api tree(maybe as an image) so that I can have a general view?
10 years ago
I am reading a book about java and I have the following question.

Why import java.awt.* is different from import java.awt.event.* ?

Both these imports are being used in a sample program in the book.

Thank you.
10 years ago
There is a constructor of view subclasses of the form :



In there as I read in a book we can pass an activity.
What is the purpose of doing that?
Thank you.
11 years ago
The problem is that android marketplace is not available yet in many countries(for example for greece where I live).
11 years ago
Oh yes of course.
Now I get it.
Thanks a lot for the rapid answer!
11 years ago
I stumbled uppon this code :



Is it valid code and what exactly does it do?
Thank you.
11 years ago
ok I stopped the derby network server from running from the command prompt using derbyrun.jar.
More info about this here :
http://download.oracle.com/javadb/10.4.2.1/getstart/getstart-single.html
11 years ago
I tried to start java db from inside netbeans but I get this error.
I run TCPview to see what is going on and I see that the program that uses this port is java.exe
What should I do now?
Why java.exe is running even though I have closed netbeans?
Thank you.
11 years ago
Where exactly does it return?In the try block?
11 years ago
What does a single return in a catch block do?
Thank you.
11 years ago