stephen84s 550 Nearly a Posting Virtuoso Featured Poster

The Program is looking for a class called: "javaapplication7.TelephoneDirectory"
Your class (atleast the code you pasted) is in the default package, you need to declare your classes to be in the "javaapplication7" package by adding the following statement at the top of your Java file (Even before the import statements)

package javaapplication7;

Also note your classfile will need to be in a folder called 'javaapplication7'.
If you are doing this via an IDE, then I suppose it will handle these teenie weenie details.

stultuske commented: missed that one, should 've read the code more carefully :) +15
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

It compiled and ran without errors beforehand anyways.

I literally just removed generic types and added a few // UNUSED lines

Considering the OP never gave stack traces, I don't know how else to help.

How about wait for him to respond with relevant info,
Now as you see he has again skipped the error message.


@raym
Error messages please ??

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

So .... what functionality you want to add, what have you tried to add that functionality, if not I would suggest you jot down somewhere clearly what you want this calculator ... and then work on an implementation. If you get stuck there we are here to help ..

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I copied and pasted the code into Eclipse and got rid of warnings, ran it and tested no issues.

Here is the code I used.

Link

(Used pastebin to reduce spam)

Hmmm, giving fish instead of teaching someone to fish ....

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

For Line 4, I am guessing now its a warning, since the O.P. hasn't provided type arguments for Comparable.
'Directory' has a default access level, so it's name doesn't need to match the name of the file, it is only required for classes with 'public' access level.

@raym.mart
You may want to look into this tutorial on Object ordering: http://docs.oracle.com/javase/tutorial/collections/interfaces/order.html

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Just a guess for the error on Line 50, is your Java file correctly named as : TelephoneDirectory.java (even the case, don't care if you are on windows or linux), the name of the file, should match the name of the public class it contains

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Dude, the error messages .... my crystal ball isn't lighting up !!! :P

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

First let us know what you are trying to do, next tell us the errors, or the incorrect behaviour in your code, do you seriously expect people to sift through 200 lines of code searching for errors ??

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

You already have that part figured out here, in your chunk of code:-

System.out.println("Now please enter the location of this text file!\nAn example would be: C:\\Users\\Your Name\\Desktop\\FolderWithTextFile\textfile.txt");
  Scanner userInput = new Scanner(System.in);
  String nameWithLocation = userInput.nextLine();

'nameWithLocation' already has the path to the file the user specified, you just need that to construct your FileReader object as mentioned in the given tutorial. Just go on and give it a try ...

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Checkout the Scanner tutorial here: http://docs.oracle.com/javase/tutorial/essential/io/scanning.html , the example mentioned is doing something similar.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Seriously just wondering, Shouldn't C:\'Users\'gourav\'Documents\'NetBeansProjects\'WebApplication2\'web\'league1.txt actually be C:\\Users\\gourav\\Documents\\NetBeansProjects\\WebApplication2\\web\\league1.txt

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Hi everyone,

I am doing a Java course at uni at the moment and it kinda doesn't make you become a real programmer with the confidence that a programmer should have. I really want to program in Java and any language(not python though because it is not a user-friendly programming language... its syntax is horrible!!! sorry python programmers) The problem I'm facing is that I don't know how to think like a real programmer.. If anyone can help, that'd be GREAT and be a life saver for a young man like me..

Looking forward to fellows' thoughts on this...

You seem to be looking for a fast track way to become a good programmer and no just positive thinking isn't enough, and you are correct your course will not perform some enchantments on you that viola at the end of it you will become a good programmer.

A programmer is just a problem solver, First hes given a problem, next he has to solve it, When he successfully solves the problem, he backtracks on the steps he used to solve the problem (the Algorithm) and then converts the steps into code.

And how do you get good at solving problems ... by solving problems (start small like printing the pascal triangle or some patterns and slowly moving up).

Ezzaral commented: Agreed. +15
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

And How do you expect us to help, we do not know what is you are trying to do, what problem you have run into.
You have just told us the name of an encryption algo ???

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Well since I had a lot of time on my hands :P , I studied every line of code, the problem looks to be on line 109 you have reinitialized the variable 'jlbMovie', while on line 119 you are setting the bounds for the text field 'jtfMovie' which has never been initialized, so is null.

I am guessing the O.P. intended to initialize 'jtfMovie' on line 109.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

You can use the JAVA_OPTS environment variable.
It is similar to enabling gc logging for a normal JVM just pass the same options in JAVA_OPTS and restart tomcat.

example on Linux:-

export JAVA_OPTS=-verbose:gc -Xloggc:logfile

the above should work, but remember the 'logfile' will be cleared at every JVM restart.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Did you create a runnable jar ? or just a jar ?

For a runnable jar you can give the runtime configuration, which will include the main class, something your manifest file seems to be missing.

From the console try running your jar file as:-

java -jar jarfilename.jar <fully qualified name of Main Class>

If it runs via the above command, then the only issue is the main class attribute in your manifest file, else extract your jar file using any zip extraction utilities and check what you are missing.

If you are creating jar files for the first time then knowing the jar file format helps understand such problems, you can check the following link: http://download.oracle.com/javase/tutorial/deployment/jar/index.html

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

that how can we implement BFS algo. in Java.

Translate the Algo into Java code and you will have its implementation.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

hi.....
i need to do a project on bulk sms.
i request you to send
java application for sending bulk sms from pc to mobile
by
kareena

I think the idea of it being your project is that you should make the application, not rip someone's hard work for your marks (if its an academic project) or money (if you are doing it commercially).

You have in this thread what you need to start making your own application, if you run into any road blocks you can definitely count on the people in this community to help out, but only if you put in the effort.

peter_budo commented: Obviously some students do not get it that in deed has to be their work not stolen material +15
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Ok ... If the JSP file is not too long could you post it ?
Cause I can't spot any reason for that error, from what has been posted.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster
<%
----
---
-----

UrlGen urlg = new UrlGen(request.getQueryString(), "UTF-8");
String url = "Contacts.jsp"+"?"+urlg;

%>
<a href="<%=url%>"><img src="images/hide.gif" border=0 align="middle">
</a>
<%
--
--
%>

If that is the exact reproduction of your JSP file, then you are bound to get errors and tons of them cause, "---" is not valid Java syntax.
Remove all those hyphens ("-") and retry.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

A Quote from the announcement section:-

Also, to keep DaniWeb a student-friendly place to learn, don't expect quick solutions to your homework. We'll help you get started and exchange algorithm ideas, but only if you show that you're willing to put in effort as well.

So ... where is your effort ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

but somebody tell me why i was getting this error?

You did not post the contents of your web.xml file, so unless and until someone has a crystal ball here which can look into your past, it cannot be answered. All that can be guessed is, you did not add your servlet correctly the first time around to your web.xml

@Override - is an annotation, a marker, If a method marked with @Override fails to correctly override a method in one of its superclasses, the compiler generates an error.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Post the contents of your web.xml file, since the problem appears to be there.
Also I hope you have placed your class file (of the Servlet class), at the correct location (WEB-INF/classes or WEB-INF/lib[for jars]).

Another thing is remember to close your PrintWriter once you are done using it, like in processRequest().

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Yep, thats it.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

It probably doesn't because it extends AbstractMap which already defines equals to perform content based comparison, not reference based.

AbstractMap defines the equals method based on which Maps, extending it can be compared. It seems to me that you are confusing it with the equals() method of the 'keys' which are stored inside the Map.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

how do i go about checking for the last character of the line if I just want to discard the line that has H at the end of it and wants the other lines that contains C, O and N?

Thats the reason why I have added link to the regex tutorial, read it and construct your pattern according to what you wish to check, I already have given an example pattern which checks the Starting and ending character of a String.

Read your input file one line at a time into a String against which you check for the occurrence of your pattern (using the matches() method). If the match is successful concatenate this String, with a third string which contains the data you want to write to the new file.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Using regular expressions you can check for patterns in your input.
Example:

String a = new String("1234");
if (a.matches("[0-9]+")) {
  System.out.println("String is a number");
}

In the above chunk of code the regex "[0-9]+" tests if the Given String is a number, you can construct a regular expression for your pattern along similar lines.
Example If I want to test for a String starting with "A" and ending with "N" the regex (regular expression) would be "[A][.]*[N]"

Use the regular expression to test if the input matches your pattern, if it does, then concatenate the data you wish to write to the file in another String variable (ex: dataToWrite).
Once you are done processing the input use File IO to dump the data in your dataToWrite variable into a File.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Use Regular Expressions for Pattern Matching.
Tutorial for Regular Expressions:- http://java.sun.com/docs/books/tutorial/essential/regex/

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

-Xbootclasspath/p:'D:\Document's\Downloads\wiiuse\SampleAppWiiuseJ\${endorsed.classpath}'

Checkout line 199 in your build-impl.xml, and see if the extra quote in Document's is valid, if you have no such folder, then delete the quote.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

The API says:-

BlockingQueue implementations are thread-safe. All queuing methods achieve their effects atomically using internal locks or other forms of concurrency control. However, the bulk Collection operations addAll, containsAll, retainAll and removeAll are not necessarily performed atomically unless specified otherwise in an implementation

It says specifically "bulk Collection operations .... are not thread safe unless specified otherwise in an implementation", and if you think about it "drainTo()" does fall in the said category.