Alan Hampson

Ranch Hand
+ Follow
since Apr 10, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
3
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 Alan Hampson

db2cmd is probably OK with utf8, the problem is that the Windows command prompt isn't. That's why you see the weird characters when you type the file.

So the command prompt is probably causing problems with db2cmd. According to what I just read (here) the solution is to change the code page with the chcp command and use a unicode compliant font (Lucida console is recommended).

I can't speak to this with great authority, since I use Linux most of the time. Take a look at the link and see what you think.
Jan,

I wasn't arguing with you, it appears we were both typing at the same moment. Thanks for your better answer.

I think you have a problem with your string delimiters. The string should look like this:


You're missing some single quotes, parens and pipes. Putting that whole thing into double quotes to make it a string literal would look like this:




Which command line, Linux or Windows?

Because this works with a DB editor, but not from the command line, I'd guess that your command prompt is not utf8. What happens if you display the contents of the file using the command line without any editor?

More details would be good.

Some suggestions:

If you can run the war file in either Netbeans or Eclipse, the output of the logging will go to a console window and, as a bonus, you can use the debugger (set break points to stop execution, examine variable values, etc.).

If you can open the log file in an editor; most modern editors will let you refresh the view when the file changes.

Finally, if you are on a Linux/Unix based server, the command tail -f logfile will give you a constant show of what is being written to the file in real time. the PowerShell command gc can be used for this on Windows, or tail commands are available for download.

I'm not sure why you would want to connect Tomcat to Glassfish. As I've said before, they are both application servers, so you'd have a duplication of functionality there.

What you probably want to do is deploy the Java application code you developed in Netbeans running under Glassfish to Tomcat, so it will run there.

13 years ago

Michele Smith wrote:Hi this is really more helpful than anything we have talked about for me. Thanks so much!


You're welcome!


I wondered, do you mean Apache Tomcat when you say Web Server as well as the JVM. The reason why I ask is that you have listed Apache under Web Server and Apache Tomcat under JVM.


No, when I say web server, I mean Apache httpd. Completely different from Tomcat. Apache httpd is similar to IIS. Tomcat is an application server.

JVM is the Java virtual machine. It is used by Glassfish and Tomcat both to make them run and by them to execute your application code. I included the JVM on the diagram because it was on your diagram, so I felt it was important to you. The correct terminology for Tomcat or Glassfish is "Application Server"

So, you have your web server which talks to clients via the internet and to your application server via (usually) a local intranet connection. The Application server does work and sends the results back to the web server, which sends them back to the client.


Since we already are into GlassFish, maybe we will not need Apache at all.

Thanks,
Michele



Remember that you need IIS or Apache httpd as a web server to face the internet. Without them, you'll have to expose Glassfish or Tomcat directly to the internet, which your security people are probably not going to like. But, yes you can use Glassfish in place of Tomcat, as they are both application servers.

13 years ago
You can take a look at the Java RegEx Turorial. It's pretty clear and helpful.
13 years ago
Cloud computing is a client/server setup where you have a thin client attached to a server containing applications.

Virtualization is running a number of "computers" on a single computer. This can be done to save resources (many virtual servers on a single box) or to have multiple operating systems on a single system running at the same time.

BTW, what makes this a Java question?
13 years ago

Maybe more importantly, why is Stock an inner class of main? It doesn't need to be, and it rather looks like this was one more patch repair after the IDE complained about it being a public class in main.java.



Yup. Well I wasn't even going to go there!

You are correct though. It should be a separate class in it's own file.
13 years ago
You have two issues here. First, as was already mentioned, you have to have the static keyword on your main method. The two methods

and


are two different methods because they have different signatures. If you don't have the static in the method signature, the classloader can't find main when it tries to run your program.

When you put static back in, you do get an error on line 15


This is because your class, Stock isn't static and is nested in the main class. In order to use it in the static main, Stock must be static as well. If you add the static keyword to the Stock class, your code will build and run. At least it did for me.


I would also agree with others here that you probably shouldn't name your class main. This is bad form and shouldn't become a habit when you are just learning java.

13 years ago

Also I asked the questions in your last email to the others I am working with.


So they told you Apache httpd web server and Glassfish application server? If so, you would be on the right track with the Glassfish/Apache article.

13 years ago
I'd ask exactly what kind of "problems" are you having. Compile time? Runtime? Code throws an exception or doesn't run correctly?

A little more detail would help, because the code you posted here won't even compile for me.

Also confusing for me is what you're using the StringBuffer for. You load it with a random set of characters from array, but then you don't use it again.

You are performing operations on array, and those won't affect sb at all, even if they would work. Rethink your logic, then update your code accordingly.
13 years ago
You'll get more help if you describe what you're trying to do and show us some code.

Right now all anyone can tell you is what the exception says: your FTP connection closed and didn't tell your program why.

13 years ago