Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2008

Tip: Looking for answers? Try searching our database.

return result to php

Thread view: 
Rose - 31 Jan 2008 10:37 GMT
When I call

system('/mnt/hd9/a.out');

the prog sucessfully print a message to web browser. (a.out is an object
file compiled from a C file).

But when I change it to java, nothing generates. Should I change
System.out.println to some other functions?
Rose - 31 Jan 2008 11:29 GMT
> When I call
>
[quoted text clipped - 5 lines]
> But when I change it to java, nothing generates. Should I change
> System.out.println to some other functions?

the error is like this:

SearchDatabase4.java
74:  Class.forName("com.mysql.jdbc.Driver");
344:   new SearchDatabase4(args[0], Double.parseDouble(args[1]),

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at
java.net.URLClassLoader$1.run(URLClassLoader.java:200) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:188) at
java.lang.ClassLoader.loadClass(ClassLoader.java:306) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at
java.lang.ClassLoader.loadClass(ClassLoader.java:251) at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at
java.lang.Class.forName0(Native Method) at
java.lang.Class.forName(Class.java:169) at
SearchDatabase4.(SearchDatabase4.java:74) at
SearchDatabase4.main(SearchDatabase4.java:344)
RedGrittyBrick - 31 Jan 2008 11:41 GMT
>> When I call
>>
[quoted text clipped - 4 lines]
>>
>> But when I change it to java, nothing generates.

but what does your system() call look like?

> Should I change System.out.println to some other functions?

No.

> the error is like this:
>
[quoted text clipped - 3 lines]
>
> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at

A ClassNotFoundException means that Java cannot find the
com.mysql.jdbc.Driver class. I guess you need to tell Java the location
 of a Jar file that contains the MySQL drivers.

See
http://mindprod.com/jgloss/jar.html#TIPS
http://mindprod.com/jgloss/classpath.html#JAR
Lew - 31 Jan 2008 15:46 GMT
Rose wrote:
>>> When I call
>>>
[quoted text clipped - 4 lines]
>>>
>>> But when I change it to java, nothing generates.

It's spelled "Java".  When you change what to Java, exactly?  How are you
invoking this Java code?  Surely you are not trying to use it as a CGI program?

>> Should I change System.out.println to some other functions?

> No.

Yes!

System.out.println() in a JavaEE web app does not write to the client.  In a
Java CGI app it would, but that would be a very, very silly architecture.

Signature

Lew

Arne Vajhøj - 01 Feb 2008 02:37 GMT
> Rose wrote:
>>>> When I call
[quoted text clipped - 19 lines]
> In a Java CGI app it would, but that would be a very, very silly
> architecture.

No !!

http://www.php.net/manual/en/function.system.php

Arne
Arne Vajhøj - 01 Feb 2008 02:38 GMT
>> Rose wrote:
>>>>> When I call
[quoted text clipped - 23 lines]
>
> http://www.php.net/manual/en/function.system.php

The point being that is is not Java EE or Java as CGI but
PHP calling a standard Java SE app.

Arne
Lew - 01 Feb 2008 02:44 GMT
Lew wrote:
>>> System.out.println() in a JavaEE web app does not write to the
>>> client.  In a Java CGI app it would, but that would be a very, very
>>> silly architecture.

>> No !!
>>
>> http://www.php.net/manual/en/function.system.php
>
> The point being that is is not Java EE or Java as CGI but
> PHP calling a standard Java SE app.

So when the OP said, "... when I change it to Java" they meant the called
program, not the PHP code?

I thought they meant when they use Java as the web app, eliminating the need
for PHP or C.

The other way, you are correct, of course.

Signature

Lew

Gordon Beaton - 31 Jan 2008 11:44 GMT
> When I call
>
> system('/mnt/hd9/a.out');
>
> the prog sucessfully print a message to web browser. (a.out is an
> object file compiled from a C file).

Some context would help here...

Where are you making this call?

> But when I change it to java, nothing generates. Should I change
> System.out.println to some other functions?

Please define "change it to java".

Did you replace a.out with a Java program? Or did you replace system()
with Runtime.getRuntime().exec("/mnt/hd9/a.out")?

In your other message you posted a stack dump, but here you only said
"nothing generates" and failed to mention JDBC or mysql or even
anything really. The error message seems to indicate classpath
problems, for whatever that's worth.

The help you get is only as good as the information you provide.

/gordon

--


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.