This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
This message just means that you're loading the Oracle JDBC driver in a static initializer for your main class (mailNotifica.Notificacao is creating an instance of comum.ConexaoOracle, which is trying to load the driver), and because the driver is not being found, Java can't fully load the class and run your main() method. You need to include the Oracle driver jar file on your class path when you run the application.
Erro no método buscaTotal - Classe Notificacaojava.sql.SQLSyntaxErrorException: ORA-00911: invalid character null
java.lang.Exception at mailNotifica.Notificacao.mandaEmail(Notificacao.java:126)
Erro no método mandaEmail - Classe PontoEstoqueEmailjava.lang.Exception
To give you an example of what might cause this...
When loading from the command line I would often take files that were edited in NetBeans or Eclipse. I would then use the javac command and it would not compile my files into class files, and would tell me that "No Main class found"
The reason for this.. is becuase NetBeans and Eclipse editors at the line at the beginging
When you try to compile a .JAVA file with this line. It begins searching for a package that it will not find. Therefore, no main class was found. Remove this line and it willl compile you class file for you.
Hope this helps....
author and iconoclast
Joe is addressing the problem you've already solved, and not in a good way: generally all java classes should be defined in a package.
This error message means that the query being sent to the database has a bad character in it -- ie it is not valid SQL. You may need to use the debugger or add logging (print statements) to see what's wrong with the query (unless you can just show it to us here.)
Joined: Oct 13, 2005
I am not convinced that will cause either of the two Exceptions we saw. If you have the .class files in the wrong location you tend to get errors like class not found or wrong class name.
Are you sure about the Java versions? You will have problems if you use the Java7 JDK and the Java6 JRE together. If the Java7 JDK appears first in your System PATH, as described here and here, then you will only ever use Java7. If java -version returns 1.7.0_10, then you have probably set your PATH correctly.
As for the SQL exception: don’t know. Find the documentation (?Oracle) and see what ORA-0911 means.
Try to work out from the line numbers which query it was, or run every SQL query at the command line, rather than via a Java front‑end, and see which produces an Exception. Show is the full query, characters like ã included.
I think this discussion would now fit better in our databases fora. Moving it.