stephen84s 550 Nearly a Posting Virtuoso Featured Poster
java -jar "/home/viber/JAVAFINAL/dist/JAVAFINAL.jar"

Now I see the reason for the problem. I am guessing your username is "viber" on your computer and you are running this application is user "viber" and your O.S is Unix/Linux based.

Now when you create the "txt" file what path have you hardcoded in your program ? Does it create the file in the current directory or have you hardcoded the some path inside "/home/viber", eg "/home/viber/sample.txt".
If you have not done the latter the problem is just of simple file permissions on your Linux / Unix box. By default a normal user is not allowed to create or edit files inside the "/", only the "root" user can create/edit/delete any file he wants.
If any other user in Linux wishes to create/edit/delete files in any folder other that his "home", you will need to grant him permissions on the folder explicitly using either the chown,chgrp or by adding that user specifically to some group and allowing that group to access to modify the contents of that folder.

You can learn more about file permissions in Unix here.

Alternatively you could just change your working directory to your "home" i.e. "/home/viber" and execute the JAR file as :-

java -jar JAVAFINAL/dist/JAVAFINAL.jar
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Show me some code, on how you are creating your file, also the exact command how you are executing your jar file.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

535

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Define what you mean by "can it doesn't work".

Do you have any errors or exception StackTraces to help us go on ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Can you show us the code of what you have been doing, so we can get a clearer picture of what you are trying to achieve.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Would you mind post your coding so we can have look at it and find what is going wrong?

Unfortunately Peter this is not the first time srs_grp is writing such a poorly constructed post.

@srs_grp
How many posts will it take for you to learn how to construct your threads and the information you should provide in your post. I have seen similar posts like these in the past with a vague description, no background information and either too little or no code at all (e.x. 1,2,3,4).

I strongly suggest you read the essay "How to ask questions the Smart Way" so that you can help us help you better.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

-1137

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

532

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I want a simple RPG game, but also want to make a GUI.

If you want to make a game, first of all hopefully your basics in Java (and 3D/2D Geometry) are thorough, Next you might want to see the "Starting Java" Sticky. ~s.o.s~ has mentioned the JMonkey Engine for making games in Java.

As Far as making GUIs is concerned almost most Java IDE's now-a-days ship in with a form designer ( Eclipse , NetBeans , IntelliJ ), still its best to design your first few forms by hand. For AWT [ 1 , 2 ] and this for Swing (which is more richer that AWT) should help you get started with making your own GUIs in Java in whichever one of the two toolkits you wish to use.

Then to make GUIs theres also the SWT library which can be found here . However I wouldn't recommend on using it since it doesn't ship along with the JDK unlike AWT and Swing.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

528

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

@Robdale
This isn't Team A vs Team B. You have to just decrement the counter.
Once again I correct the counter skew and set it to "-1135" (-3 for Robdale, -1 For Anupam's double post and -1 for me)

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

524

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

518

Seems like this is gonna be another crushing defeat for Team B.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

We need more details as to the type of "st" and your entire query, table structure etc.
What do you expect us to solve from the given information.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

512

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

We will help you if and only if you show some effort else do not expect too much from this forum.
So Show what have you coded so far ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

508

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Here is some ready made code for an MP3 playlist.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Hi, everyone! I wish i could find someone who is diligent in answering to my queries since i am a beginner when it talks about java. I understand visual basic very well since it was the language i used when i am doing my thesis, and now i am working, but now i would like to focus on java, but don't know how.. i also have knowledge with C, assembly language. Thank you very to whoever takes his/her time with me. God bless..

If you are "Starting Java" then there is a Sticky at the top of the thread list titled "Starting Java". You should refer to that and honestly posting this thread for just for announcing that !!! Really makes no sense, There are so many guys who are starting to learn Java, wonder what would happen if they all would start making threads on daniweb like yourself ??? :P

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I tried the convertion method that bertt's described . bt I can't get the jar that contain the ' import officetools.OfficeFile' can any one please suggest a method to convert HTML to PDF

Thats the reason why his post has received a Bad Rep (RED Mark) and my post which was the actual answer received a Good Rep (Green Mark) if you had cared to observe.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

-1131

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Although the thread has been solved I just stumbled across the actual reason why the JSFs does not work with Tomcat 5.5, the JSF 1.2 implementation requires the Java Servlet 2.5 implementation whereas Tomcat 5.5 supports the Java Servlet 2.4 implementation.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

You need to first tell us what exactly are you expecting to be passed in the "code" parameter.
Give us an example of how a correct format of String inside "code" (one that would output "yes") and an incorrect format example (one that would output "no").

Also are you even sure whether this code compiles, from what I see there are syntax errors in there also.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

HTI cause have never been on the Moon.

Drinking ..................................................................................... water ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

-1129

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I would have but unfortunately forgot what they were.

Will the next person be able to remind me of them ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

http://www.javamex.com/

Came across this site a few days ago, although they could make the site a lot more pleasing to the eyes, I found the articles quite informative especially from a beginner point of view.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

504

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

i would say lazy student wouldn't even bother posting questions.

Do not be so judgmental, If you hang around here long enough you will see your fair share of them.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

As Peter suggested change your approach to use the MVC-2 model mentioned in the Sticky.
Normally we do not help anyone performing database connectivity directly from within a JSP.
I gave you two options a quickfix which would get your code running and a link to the way it is actually supposed to be done. However you opted for the first option and just skipped the second one on good practices.

In short what I want to say is if you want stick to doing this web application the wrong way then you are on your own. Do not expect too much help from us (we already have hinted you on the problems), on the other hand if you want do it the right way as mentioned in the sticky we will definitely not mind going the extra mile to help you out.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

how do I place it in code?

Thats what I meant by try it. Trust yourself a little and take the jump. At most you will get a compile error or a wrong output, the world will not end with that.
The help offered here is more like if your car has a problem we will help you sort it out, but we will not push / drive the car for you.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Put this chunk of code in a main inside class, compile it, then run it, add a System.out.println() after every statement to trace what is happening to your variables.
Thats the most optimal way of finding out rather than asking people for a line by line explanation.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Yes, Next time you post wrap your code inside
[code=java] and [/code] tags. Also what do you need help for ? Tell us the problem (compile errors,logic problems etc etc) you are facing and this time please do not give the reason "I am a beginner" for not attempting something.:)

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Print the content to see what value you have for this :-

request.getParameter("'id';")

Cause most probably that is coming as "null" as a result of which your where clause does not match any rows in the database and hence does not update any.

But most importantly do not perform database connectivity directly from within a JSP. They are supposed to be the view layer only in the MVC architecture. To know how servlets, JSP and Java beans should be organized and work together check the sticky JSP database connectivity according to Model View Controller (MVC) Model 2. Its a nice tutorial on how servlets,JSPs and Beans should be actually working together in a Web Application.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Just as my location suggests I live in India.

Is Jupiter only made of gases ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Try this.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Hey, but wait!

Doesn't the do- while loop work in a way that it first executes the code and at the end evaluates the boolean? If the boolean is true it should go for another round, if false it should terminate. Right?

If this is correct then my boolean should be correct. If allocated would be smaller than c it would continue, else if equal it should stop?
Is this correct?

Eeep !!! Sorry Confused myself on that one, heres what I think is going wrong.
Now I just went through your code the problem seems to be a tad more deeper than I thought.

You see at the class level itself you have a member called allocated.

private int allocated;

Now let us look closely at your do-while loop.

do{
  int allocated = 0;
  for(int i = 0; ((allocated < c) && (i < n)); i++){
    this.road[i]=binaryGenerator();
    if(this.road[i]==1) {
      allocated = allocated +1;
    }
  }
  System.out.println("T "+ allocated +"  " + c);
} // This is where the scope of the "allocated" variable
  // declared inside the loop ends
while(allocated < c); // The allocated being referred to here is
                                // the one declared at the class level

Now inside you are manipulating the variable "allocated" which is declared inside the do-while block and it is this variables variable that is printed in your System.out.println("T "+ allocated +" " + c); , However thats where the scope of this "allocated" variable ends. In the …

Ezzaral commented: helpful +17
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

JSP is server side while Javascript is client side, you cannot access objects created inside your JSP in Javascript.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Ok then lets start, I am setting the counter to "500".

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I think even the current administration doesn't know about that, just Bush did.

Do time and tide wait for anyone ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

"allocated" clearly prints as equal to c

But the condition in your do-while loop is

while(allocated < c)

So definitely it wouldn't stop because technically "allocated" is not less than "c".

If you want it to terminate when "allocated" and "c" are equal also then change the "<" to "<="

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Dont be so harsch on the poor guy. We all started with such trivialities...

Yes NightStrider, we do all start with such trivialities but the fact that makes us what we are is "What we do about them".

Putting myself in his shoes, I wouldn't have been on a public forum asking for the magic pill which would hardwire all the concepts of Java "for" loop inside my brain, rather I (and most of the others who excel at programming) would spend that extra time reading that Java Reference Book (again and again) or just making up some trivial code snippets and experimenting with them trying out what happens if when you add "X" to your code, remove "Y" from somewhere else and observe what happens and so on, even others(who do not have this appetite) would opt to ask their instructor what to do just as Verruckt suggested.

@nandomendoza

Thank you, I just started learning this stuff.

Just because you are new to Java doesn't give you a license to be unaware of basics like these and not experiment and find out the behaviour of Java on your own. Also the sticky "Starting Java" has numerous resources that are supposed to help beginners like yourself, How many of those did you read before posting this thread ?
When beginners show the effort by writing their code or by showing some effort on research on their own from the web or by citing from their …

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

If you are using a Swing Form to get Input then I would suggest dropping the while loop altogether because your actionPerformed() method will be called whenever your user clicks on the GuessButton and you can perform all the necessary processing then.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

If you are going to call your "javac" compiler like this :-

C:\Program Files\Java\jdk1.6.0_11\bin\javac HelloWorldApp.java

You will need to put your "Program Files" in double quotes because of the space in "Program Files" (Courtesy MicroSoft for setting a lousy trend of accepting spaces in file and folder names).
Because of that space your command prompt thinks that your actual path to the executable is
"C:\Program" and the rest "Files\Java\jdk1.6.0_11\bin\javac HelloWorldApp.java" are just command line arguments to that program / executable.

Paste the entire content of your PATH(not the one belonging to System Variables Section) variable, Also I hope you opened a new console Window after saving the value of the PATH variable, cause this effect would not be repeated in an already open console.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

You can start here.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Well one word about the StringTokenizer class, this is what the javadocs have to say about it:-

StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Sounds like an assignment question, can you tell us the answer from whatever research (reading books or the resources on the web) you did ? We will add to it or correct you even, if we see you have put in the effort to really find out.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Hate it

Analyzing and Solving Problems ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Damn my mouths already watering here.