System.out.println("....") doesn't show by run invoiceMail.jar on command
Hi,
I tried to run invoiceMail.jar and expected print out System.out.println("....") on command line ,
I works on java -jar invoiceMail.jar -date 08/08/2008, but not invoiceMail.jar -date 08/08/2008
How to do that?
Thanks
C:\Documents and Settings\fsze88\桌面>invoiceMail.jar -date 08/08/2008
C:\Documents and Settings\fsze88\桌面>java -jar invoiceMail.jar -date 08/08/2008
args[0] : -date
args[1] : 08/08/2008
email sent 關於 2008年8月8日 前仍未收到的 Invoice
fsze88 wrote:
run java -jar invoiceMail.jar -date 08/08/2008 on prompt command, it gave me output by System.out.println("....");
args[0] : -date
args[1] : 08/08/2008
email sent 關於 2008年8月8日 前仍未收到的 Invoicerun invoiceMail.jar -date 08/08/2008 on prompt command, it gave me nothing.
C:\Documents and Settings\fsze88\桌面>invoiceMail.jar -date 08/08/2008
C:\Documents and Settings\fsze88\桌面>java -jar invoiceMail.jar -date 08/08/2008
args[0] : -date
args[1] : 08/08/2008
email sent 關於 2008年8月8日 前仍未收到的 InvoiceHope this clear..
Thank you!That is how it is and that's how it's supposed to be.
Similar Messages
-
How can I show a System.out.println(""); into a JSP?
Is a simple doubt that would help me a lot to reach other thing that I wished reach with a JSP.
Thank you!!!Hi!!!
Thank you to answer me......my question�is because�my problem is a little more complicated��let me tell you�.
My problem is that I wish to do some queries to a table of a Municipalities DB, I have read about that....and according with the exemples....my JSP...should be running and executing very well....but I haven�t had success with that...:(
My JSP file is:
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<!-- Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.-->
<head>
<title>Query of Municipalities</title>
</head>
<body bgcolor=#FFFFFF>
<font face="Helvetica">
<h1>
<font color=#DB1260>
Municipalities List
</font>
</h1>
<%@ page import="
weblogic.db.jdbc.*,
weblogic.html.*,
java.sql.*
" %>
<p>
<%
Connection conn = null;
try {
Class.forName("weblogic.jdbc.pool.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:weblogic:pool:DESAPool");
catch (Exception e) {
e.printStackTrace();
Statement stmt = conn.createStatement();
stmt.execute("select * from cat_municipio");
ResultSet rs = stmt.getResultSet();
while (rs.next()) {
System.out.println(rs.getInt("cve_municipio") + " - " + rs.getInt("cve_sepomex") + " - " + rs.getString("desc_municipio"));
stmt.close();
conn.close();
%>
<p>Please call Mary with any updates ASAP!
<p>
<font size=-1>Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
</font>
</font>
</body>
</html>
My result obtained is the following:
Municipalities List
Please call Mary with any updates ASAP!
Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
I don�t obtain nothing.....is like DB table were without information......but in reality the DB table has information.....and I can obtain it with the following JSP:
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<!-- Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.-->
<head>
<title>Query of Municipalities</title>
</head>
<body bgcolor=#FFFFFF>
<font face="Helvetica">
<h1>
<font color=#DB1260>
Municipalities List
</font>
</h1>
<%@ page import="
weblogic.db.jdbc.*,
weblogic.html.*,
java.sql.*
" %>
<p>
<%
Connection conn = null;
try {
Class.forName("weblogic.jdbc.pool.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:weblogic:pool:DESAPool");
// Fetch all records from the database in a TableDataSet
DataSet dSet = new TableDataSet(conn, "cat_municipio").fetchRecords();
TableElement tE = new TableElement(dSet);
tE.setBorder(1);
out.print(tE);
} catch (SQLException sqle) {
out.print("Sorry, the database is not available.");
out.print("Exception: " + sqle);
} catch (Exception e) {
out.print("Exception occured: " + e);
} finally {
if(conn != null)
try {
conn.close();
} catch(SQLException sqle) {}
%>
<p>Please call Mary with any updates ASAP!
<p>
<font size=-1>Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
</font>
</font>
</body>
</html>
and with this JSP I obtain all the following information:
Municipalities List
CVE_MUNICIPIO CVE_SEPOMEX DESC_MUNICIPIO
1 1 ACAJETE
2 2 ACATENO
3 3 ACATLAN
4 4 ACATZINGO
5 5 ACTEOPAN
Now...I need that the first JSP work very well, because...with that way...I can do queries and obtain the needed results for showing them in the Browser......
So, I already find out�.that�any string that I send to the browser with System.out.println(); isn�t showed�.so it is the reason of my question�..how I can see my results of a query using a loop (like a for, while) resolving it....I think my problem would be resolved.
So...I hope you understand me, and you could help me please...thanks.....
Mary
P.D. I also attempted with the following JSP...but the result is the same....I don�t obtain none result...
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<!-- Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.-->
<head>
<title>Query of Municipalities</title>
</head>
<body bgcolor=#FFFFFF>
<font face="Helvetica">
<h1>
<font color=#DB1260>
Municipalities List
</font>
</h1>
<%@ page import="
weblogic.db.jdbc.*,
weblogic.html.*,
java.sql.*
" %>
<p>
<%
Connection conn = null;
try {
Class.forName("weblogic.jdbc.pool.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:weblogic:pool:DESAPool");
catch (Exception e) {
e.printStackTrace();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select CVE_MUNICIPIO, CVE_SEPOMEX, DESC_MUNICIPIO from cat_municipio");
while (rs.next()) {
System.out.println(rs.getInt(1) + " - " + rs.getInt(2) + " - " + rs.getString(3));
rs.close();
stmt.close();
conn.close();
%>
<p>Please call Mary with any updates ASAP!
<p>
<font size=-1>Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
</font>
</font>
</body>
</html> -
How use system.out.println with a Java Swing Applet?
Hi guys,
I was just wondering what can I use to view output on the Java console with a Java Swing Applet?
At the moment I'm using a JTextArea within the Applet for debugging but I want output to appear in the browser java console but system.out.println doesn't work.
I'm viewing the Swing Applet on Netscape 4.7 browser.
Any ideas?System.out.println()s work fine! I'm guessing that your problem is that you are looking at the wrong console window!
You're using the Java Plug-in, right? On Windows, go to your Control Panel and double click "Java Plug-in". You should find a checkbox option to "Show Java Console" - make sure this is checked. Next time you fire up you JApplet, you should see a Java Console window popup.
Hope this helps! -
Is there a way to force System.out.println to run when called
I working on my first threaded program and having a hard time debugging. I've used System.out.println to let me know what's going on but due (I assume) to the nature of threads the output is not sequential. Is there a way to force println to execute immediatly so that they show up in the order they were called?
Thanks --- Mikemjs1138 wrote:
endasil, Thanks for the reply. I'm currenlty running the program from within the NetBeans IDE. It is the output displayed by in NetBeans "output" that I'm looking at.
--- MikeI don't use Netbeans, but I would guess that it too pipes Standard Out and Standard Error to the same console. You didn't address my comment. Are you printing to System.err as well? This happens implicitly if you use Exception.printStackTrace(), for example. -
Can't run java apps with System.out.println on any builder.
Hello,
I'm currently using Vista RC2, which is the immediate problem.
Classes with System.out.println won't launch the console window. As I'm a student and practicing on these steps, I do have quite a problem on my hands. I click on run, build succesfull, nothing happens.
I have tried Netbeans and Jcreator, and gave up on trying different builds, as I reckon I'll have to find some other way to counter this; any way to get println messages working in vista?It is run as a desktop app, and other runs with commands such as JOptionPane do function, only the println windows don't appear at all. So I think JRE is installed and working.
I did notice there was one command for input where I'd be able to enter it at the bottom of Netbeans.
Like just now I clicked build and run for the following code
import java.util.*;
public class FirstProgram
public static void main(String[] args)
System.out.println("Hello out there.");
System.out.println("I will add two numbers for you.");
System.out.println("Enter two whole numbers on a line:");
int n1, n2;
Scanner keyboard = new Scanner(System.in);
n1=keyboard.nextInt();
n2=keyboard.nextInt();
System.out.println("The sum of those two numbers is");
System.out.println(n1+n2)
}Resulting in a brief flash of "input" in the output window (which is below the coding window) and it dissapears. But this also occurs when I don't include system scanner code.
Using commands in cmd
java -jar "C:\Users\Alegis\Netb\MyApp\dist\MyApp.jar"
Does not yield desired results either. Nothing happens. -
System.out.println not showing up in the console
Hi,
I've some System.out.println statements in a static block in a Stateless
Session Bean. I could not see these outputs in the Weblogic console. I'm
using Weblogic 5.1 Any one faced this problem before? any help is
appreciated.
Thanks & Regards,
Nithi.Take a look in the weblogic log files they might be redirecting std out.
"Ryan LeCompte" <[email protected]> wrote:
>
Hello Nithi,
I'm all out of ideas, unfortunately! However, check out the following
links for
some possible insight into the problem:
http://groups.google.com/groups?q=System.out.println+5.1+WebLogic&start=60&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3d3df18e%40newsgroups.bea.com&rnum=69
http://groups.google.com/groups?q=System.out.println+5.1+WebLogic&start=70&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3977417b%40newsgroups.bea.com&rnum=71
http://groups.google.com/groups?q=System.out.println+5.1+WebLogic&start=200&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3bc20346%241%40newsgroups.bea.com&rnum=209
Best regards,
Ryan LeCompte
[email protected]
http://www.louisiana.edu/~rml7669
"Nithi Rajan" <[email protected]> wrote:
Hi Ryan,
Thanks for your reply and sorry for the long silence. I was on vocation.
Thre problem still remains.I'm very sure that the EJB
is deployed by WebLogic as I'm able to call some methods.
and I'm also calling EJB methods from Servlet. But my
System.out.println statments work fine in the Servlet and
not inside EJB (or anyother classes used by EJB).
Any one has faced similar problems? BTW am using WebLogic 5.1
Thanks in advance,
Regards,
Nithi.
"Ryan LeCompte" <[email protected]> wrote in message
news:[email protected]...
Hello Nithi,
I find it strange that your System.out.println statements are beingexecuted from
within your servlets, but not in your stateless session bean. Are
you
positive
that your EJB is being located and deployed by WebLogic? The statementsin
your
static { } block should be executed as soon as the WebLogic class
loader
finds
the class and loads it into the JVM. I would suggest examining theconsole
and
try to determine if your EJB is in fact being deployed. Are you invokingmethods
on the EJB inside of your servlets? Are you using any logging frameworkfrom within
the EJBs which would redirect output to a file?
Best regards,
Ryan LeCompte
[email protected]
http://www.louisiana.edu/~rml7669
"Nithi Rajan" <[email protected]> wrote:
Hi Ryan,
Thanks for your reply. The setting in the weblogic.properties is
as
follows.
weblogic.system.enableConsole=true
So, that tells me that I should see all the System.out.printlns right?
(Pleasecorrect me if I'm wrong). I can see all the System.out.println
from
my
servletand not from the Session Bean (even if the System.out.println
is
outside
static block).
Please let me know your thoughts.
Thanks & Regards,
Nithi.
"Ryan LeCompte" <[email protected]> wrote in message
news:[email protected]...
Hello Nithi,
Are you sure that you don't have WebLogic configured to redirect
all
messages
to a file instead of the console? Are you able to see yourSystem.out.println
statements when placed within other methods of your stateless sessionbean? Please
be a bit more specific.
Thank you,
Ryan LeCompte
[email protected]
http://www.louisiana.edu/~rml7669
"Nithi Rajan" <[email protected]> wrote:
Hi,
I've some System.out.println statements in a static block in a
Stateless
Session Bean. I could not see these outputs in the Weblogic console.
I'm
using Weblogic 5.1 Any one faced this problem before? any helpis
appreciated.
Thanks & Regards,
Nithi. -
Why doesn't System.out.println work for Palm?
In my Java code,
how come I don't see any output on my screen (Palm Vx) when I try this?
System.out.println("Hello World");
Where is the output really going to???Hi,
On POSE (Palm OS emulator), the System.out.println() method output is a file called STDOUT.txt, filed in some directory of the emulator.
On the eal device, I think theres no output for system.out.println().
Ricardo -
System.out.println ....syntax error?
Hi,
I am workin on my first java program here...and althought my classes compile just fine I can't manage to get what I want to appear on the screen on Button action....
Clicking on cost should trigger the appearance of the total cost...but nothing happens.
Can you have a look and tell me where I went wrong please?
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.util.*;
public class Booking extends Applet implements ItemListener,ActionListener
String[][] c = { {"French Language","250","130","70"}, {"Painting","270","140","70"}, {"Yoga","250","130","70"} };
Courses courses_list = new Courses(c);
Choice ChoiceCourse;
Choice ChoicePeople;
Checkbox cb1, cb2, cb3;
boolean fulltime = false;
boolean parttime = false;
boolean concessions = false;
Button b1;
int c1;
int p1;
int price;
public void init()
add(new Label("Courses available for booking : "));
ChoiceCourse = new Choice();
add(ChoiceCourse);
//the following populates the ChoiceCourse dropDown Menu with the Courses'Titles
int i=0;
while (i<c.length)
ChoiceCourse.addItem(courses_list.getTitle(i));
i++;
ChoiceCourse.addItemListener(this);
add(new Label("Number of participants for the course selected : "));
ChoicePeople = new Choice();
add(ChoicePeople);
//the following populates the ChoicePeople dropDown Menu with "numbers" from 1 to 10
int j=1;
while (j<11)
ChoicePeople.addItem(new Integer(j).toString());
j++;
ChoicePeople.addItemListener(this);
cb1 = new Checkbox ("Full-Time");
add(cb1);
cb2 = new Checkbox ("Part-Time");
add (cb2);
cb3 = new Checkbox ("Concessions");
add (cb3);
b1 = new Button ("Cost");
add (b1);
b1.addActionListener(this);
public void itemStateChanged(ItemEvent e)
if (e.getSource() == ChoiceCourse)
String c2 = (String) e.getItem(); // When ChoiceCourse is modified
if (c2 == "French Language")
int c1 = 0;
if (c2 == "Painting")
int c1 = 1;
else
int c1 = 2;
if (e.getSource() == ChoicePeople)
String p2 = (String) e.getItem(); // When ChoicePeople is modified
int p1=Integer.parseInt(p2); // converts the String into an integer
public void actionPerformed(ActionEvent e)
if ( e.getActionCommand() == "Cost" )
fulltime = cb1.getState();
parttime = cb2.getState();
concessions = cb3.getState();
if (fulltime == true)
int price = 1;
if (parttime == true)
int price = 2;
else
int price = 3;
int mode = Integer.parseInt(c[c1][price]);
System.out.println("total cost of your selection is: �" + courses_list.getCost(p1,mode));
}Thanks for the guidance and the explanations. I've improved my code according to your recommendations (1, 2 &3) and it compiles just fine.
However, the println still doesn't work...but there is improvement:
When I run my applet using the AppletViewer at the very end I get a log of what happened...and it's now showing:
"D:\JBuilder8\jdk1.4\bin\appletviewer.exe Booking.html
total cost of your selection is: �0"
Which means that the println is being called but is not printing where it should be (on my screen)....the other problem is that it is obviously not properly calculating the total cost since it shouldn't be �0.
Here is my new (improved) code, and below is the code for the Courses class (which does some of the calculation):
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.util.*;
public class Booking extends Applet implements ItemListener,ActionListener
String[][] c = { {"French Language","250","130","70"}, {"Painting","270","140","70"}, {"Yoga","250","130","70"} };
Courses courses_list = new Courses(c);
Choice ChoiceCourse;
Choice ChoicePeople;
Checkbox cb1, cb2, cb3;
boolean fulltime = false;
boolean parttime = false;
boolean concessions = false;
Button b1;
int c1;
int p1;
int price;
public void init()
add(new Label("Courses available for booking : "));
ChoiceCourse = new Choice();
add(ChoiceCourse);
//the following populates the ChoiceCourse dropDown Menu with the Courses'Titles
int i=0;
while (i<c.length)
ChoiceCourse.addItem(courses_list.getTitle(i));
i++;
ChoiceCourse.addItemListener(this);
add(new Label("Number of participants for the course selected : "));
ChoicePeople = new Choice();
add(ChoicePeople);
//the following populates the ChoicePeople dropDown Menu with "numbers" from 1 to 10
int j=1;
while (j<11)
ChoicePeople.addItem(new Integer(j).toString());
j++;
ChoicePeople.addItemListener(this);
cb1 = new Checkbox ("Full-Time");
add(cb1);
cb2 = new Checkbox ("Part-Time");
add (cb2);
cb3 = new Checkbox ("Concessions");
add (cb3);
b1 = new Button ("Cost");
add (b1);
b1.addActionListener(this);
public void itemStateChanged(ItemEvent e)
if (e.getSource().equals (ChoiceCourse)) //should this be == or .equals? it doesn't work either way but compiles
String c2 = (String) e.getItem(); // When ChoiceCourse is modified
if (c2.equals ("French Language"))
c1 = 0;
if (c2.equals ("Painting"))
c1 = 1;
else
c1 = 2;
if (e.getSource().equals (ChoicePeople)) //should this be == or .equals?it doesn't work either way but compiles
String p2 = (String) e.getItem(); // When ChoicePeople is modified
p1=Integer.parseInt(p2); // converts the String into an integer
public void actionPerformed(ActionEvent e)
if ( e.getActionCommand().equals ("Cost") )
fulltime = cb1.getState();
parttime = cb2.getState();
concessions = cb3.getState();
if (fulltime)
price = 1;
if (parttime)
price = 2;
else
price = 3;
int mode = Integer.parseInt(c[c1][price]);
System.out.println("total cost of your selection is: �" + courses_list.getCost(p1,mode));
class Courses
import java.util.*;
public class Courses
private String[][] Listing = new String[3][4]; //create array 3 rows * 4 columns
Courses(String[][] c)
this.Listing=c;
int i;
int j;
int p;
int price;
int people;
int cost;
String t;
String p1;
String getTitle(int i) //return Course Title
t=Listing[0];
return t;
int getPrice(int i, int j) //return Price (Full-Time, Part-Time, Concessions)
p1=Listing[i][j];
p=Integer.parseInt(p1);
return p;
int getCost(int pe, int pp)
pe=price;
pp=people;
cost=pe*pp;
return cost; -
General question regarding System.out.println
Just for my knowledge fellas,
When you have a few System.out.println's in your code, what happens to the lines written to standard out when you run your application from the executable jar file? I know if you run your app in cmd prompt, then the lines are outputted to the cmd screen, and in Netbeans, in the output section...but where do those lines go when you run the app as an executeable? Are they still written, but there's nothing to show the written lines?
Thanks.
...DJVege...Just for my knowledge fellas,
When you have a few System.out.println's in your
code, what happens to the lines written to standard
out when you run your application from the executable
jar file?They get written to standard out, usually the console... doesn't matter at all if it's a JAR or not.
I know if you run your app in cmd prompt,
then the lines are outputted to the cmd screen, and
in Netbeans, in the output section...but where do
those lines go when you run the app as an
executeable?cmd screen. Or Java console if you run javaw. -
System.out.println
Can anyone tell me the file location of where System.out.println writes to? Does it only write to the console? We're running BEA 5.1 Server. Thanks!
System.out is 'stdout', so if you haven't redirected stdout to a file, the output
will show up on the 'console'.
Mike
Doug <[email protected]> wrote:
Can anyone tell me the file location of where System.out.println writes
to? Does it only write to the console? We're running BEA 5.1 Server.
Thanks! -
System.out.println() problem
When I use operator + for concatenate the following Strings
md.getDriverName() + md.getDriverVersion()
as follow in a try block:
try {
con = DriverManager.getConnection(sourceURL,user,pass);
md = con.getMetaData();
System.out.println(md.getDriverName().+md.getDriverVersion());
when I have tried run java -cp postgresql.jar errors message appers :
Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: conx
at java.lang.VMClassLoader.transformException(java.lang.Class, java.lang.Throwable) (/usr/lib/libgcj.so.6.0.0)
at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.6.0.0)
at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.6.0.0)
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.6.0.0)
at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)
Caused by: java.lang.ClassNotFoundException: java.lang.StringBuilder not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:postgresql.jar,file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.6.0.0)
at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgcj.so.6.0.0)
at java.lang.ClassLoader.loadClass(java.lang.String) (/usr/lib/libgcj.so.6.0.0)
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.6.0.0)
But when I have used netBeans IDE v 4.0 it works fine.
Might somebody help me for solve it.Caused by: java.lang.ClassNotFoundException: java.lang.StringBuilder not found in
gnu.gcj.runtime.SystemClassLoader{urls=[file:postgresql.jar,file:./],
As I noted in your other post, your computer is configured to use gnu.gcj, not Sun's Java - and it appears that gcj doesn't have the StringBuilder class; it was added to Sun Java in Java 5. -
Hi all,
I have a program which uses System.out.println() a lot. As the whole program needed to be in GUI form, I have to abbandon the console window and print all my outputs to a special text pane which I have already created and tested.
My problem is, is there a way for me to keep my System.out.println() statements as they are and print the outputs to my text pane instead of printing it to the console?
Can I use some kind of overriding of System.out.println()? If so can anybody tell me how to do it?
Thank you all in advanceHi again guys,
I managed to get the system.out working. Thanks again. But I was trying to do the same to system.in using a class that inherits from InputStream and failed, can you help me out again pliz.
following is a simplified version of the code. problem I have is that the input I get on readButton click(see the code) is always -1. The code doesn't wait for user input . How can I correct this. please help Thanx
public class Main() implements ActionListener
JTextPane textPane;
JButton readButton;
public Main()
this.initGUI();
Console myConsole = new Console(this.textPane);
System.setIn(new myInputStream(myConsole));
private void initGUI()
this.textPane = new JTextPane();
this.readButton = new readButton();
this.readButton.AddActionListener(this);
//code to create the GUI and show the textPane
//follows
public void ActionPerformed(ActionEvent e)
try
int keyCode = System.in.read();
}Catch(Exception e)
System.out.println("Pressed Key Code is " + keyCode);
public static void main(String[] args)
new Main();
public class Console extends KeyListener
JTextPane textPane;
int pressedKey = -1;
public console(JTextPane textPane)
this.textPane = textPane;
this.textPane.addKeyListener(this);
public void keypressed(KeyEvent e)
this.pressedKey = e.getKeyCode();
public int read()
return this.pressedKey;
public class myInputStream extends InputStream
Console console;
public myInputStream(Console console)
this.console = console;
public int read()
return this.console.read();
} -
Problems with System.out.println()
I tried writing a simple 'Hello world'-program:
public class Test{
public static void main(String[] args){
System.out.println("Hello World!");
}//main()
}//Test
But the text wouldn't appear in the DOS-window. The only text that showed up was the standard 'Press any key to close the window'. The program compiled without any problems, but didn't work when I tried to run it.
Does anyone have any idea what's wrong?Are u sure , the main() class part is donecorrectly.
Becuse program will compile but not run without a
main() class.what do you mean by main() class???First of all main() is a method, not a class. The main() method the JRE recognizes and runs is the:
public static void main(String[] params)
If you don�t have exaclty those modifiers and receive an array of Strings parameter it will send you an runtime exception.
Your code compiles and runs fine, the problem isn�t really System.out.print() it is something with your configuration.
I have to rename the class to TestF. Here is the running:
C:\cJava>javac TestF.java
C:\cJava>java TestF
Hello World! -
System.out.println and EJBs
Hi,
I'm trying to develop an application that has 2 main components:
1) A stateless session EJB, which is called by the container timer service periodically and makes some DB uptades.
2) A servlet which basically calls the create method in the EJB.
I've implemented a prototype of the app and the servlet code looks like this:
try {
Context context = new InitialContext();
MyClassLocalHome home = (MyClassLocalHome)PortableRemoteObject.narrow(
context.lookup("java:comp/env/ejb/MyClass"),
MyClassLocalHome.class);
System.out.println("Narrowed");
MyClassLocal timer;
// create a new instance
timer = home.create();
System.out.println("Created!");
In the ejbCreate() in MyClass callback, all I have is a System.out.println("ejbCreate() called") to show the method was called.
My problem is the even though the servlet code runs without errors and I can see the output in the application server's SystemOut.log, I can't find "ejbCreate() called" message. Am I looking in the wrong place? Am I doing something wrong?
Thanks in advance.
PedroHi Pedro,
You're not necessarily doing something wrong. Where are you actually invoking a business method on the Stateless Session bean? In the Stateless Session Bean lifecycle, the actual bean instance creation is not required to be linked to the Home.create() call. That's because Stateless Session bean instances have no client-specific state. The container can delay the bean instance creation until an actual business method is called. Only then would the bean instance's ejbCreate method be called.
--ken -
Where are all the System.out.printlns sent to?
I have log4j running but when this fails to load I rely on System.out's to see what went wrong. I checked the application log for the application in application-deployments/<application-name>/home_default_island_1 directory but it doesn't record the System.out's.
Regards,
AnthonyThanks Avi,
However the OC4J Home Page is not always the answer to every question. I don't want to sound ungrateful but OAS has way too much documentation. Granted it has alot of features and operating OAS should not be delegated to a lone developer but I can 't be sifting through documentation looking for a simple answer as "Where do System.out.printlns go to"
I mean simply put OC4J (running inside OAS) has a local log per application application-deployments/<application-name>/home_default_island_1 which I would expect to be the default location for any System.outs to be. Isn't it just logical thinking? I'm not sure exactly what opmn's relationship with OC4J is but from a developer point of view it's a different entity!?!
For now I'm still refining our development processes for an upcoming project so it looks like I'll be ditching developer testing on OAS full install to running a local OC4J standalone - too much time is wasted deploying an app for a start and there is no easy access to the remote console logs. Also the System.outs in standalone are easily visible anyway.
Please understand this is not a formal complaint or grudge but a developers desparate cry to try and get a job done.
Anthony
Maybe you are looking for
-
Iphone won't appear in the itunes page
My Iphone 3G won't appear in the in the itunes. I did all I could with the support web pages. Anyone know what I could do? I might add it use to appear but not anymore. Thanks, joy
-
Cant download software updates
When I run software update the update downloads but wont install,I get the message NSURLErrorDomain-1005 networking error please check internet connection and try again. I have evdo with a sprint broadband card and a phobeus router.
-
Problem in rebate agreement type 0005
Hi I created a rebate agreement of type 0005 and maintained amount Rs 5000 for a customer while creating billing document the condition type BO06 was determined in the billing doc but without anu value the analysis shows that condition record has bee
-
I am trying to update so I can edit my PDF files and it says it cant updat?
How do I go about deleting a blank page in a PDF document?
-
Hello, i implemented a simple mailer with javamail and all works fine. now the project is for a community with a lot of members and i tested the send performance with following code: MTAtransport = MTAsession.getTransport("smtp"); MTAtransport.connec