Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7061105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:26:00+00:00 2026-05-28T04:26:00+00:00

I am thinking if I can bridge java and php without Tomcat installed. I

  • 0

I am thinking if I can bridge java and php without Tomcat installed. I just installed jdk17, I set up the PATH to C:\jdk17\bin and my first program is like this

<html>
<body>
<?php
  $system = new Java("java.lang.System");
  print "Java version=".$system->getProperty("java.version")." <br>\n";
  print "Java vendor=".$system->getProperty("java.vendor")." <p>\n\n";
  print "OS=".$system->getProperty("os.name")." ".
              $system->getProperty("os.version")." on ".
              $system->getProperty("os.arch")." <br>\n";

  $formatter = new Java("java.text.SimpleDateFormat","EEEE, 
    MMMM dd, yyyy 'at' h:mm:ss a zzzz");
  print $formatter->format(new Java("java.util.Date"))."\n";

?>
</body>
</html>

and fact is it doesn’t work. nothing is shown on the browser. I think I need to add something else into the php.ini but don’t know what and where in the file I can do that.
Sorry I am dumb about all of these, thank you for any help.

Edit: What can java do with php ? Some companies use these two although I am opposed to it thinking ASP and C# should do better. Do they think LINUX hosting and storage are UNHACKABLE ?

Edit: By the way, I am using IIS as my webserver not traditional Apache, thanks for your concern.

Edit: I think I am in a complete confusion now about java world (Tomcat, apache, xxxsuits, ant, soap, xxxprotocol….). Could someone post a short post to summarize all of these ? [something easy to understand like an micky course lecture] please.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:26:01+00:00Added an answer on May 28, 2026 at 4:26 am

    Here is your problem:

    new Java("java.text.SimpleDateFormat","EEEE, 
    

    I’m unaware of any sort of object called “Java” on PHP that you’ll get out of the box by simply installing Java. I think you’re trying to execute the Java Bridge integration which means you’ll need to download the Java Bridge distribution and execute the Java Bridge server before executing your PHP page.

    Java is different than PHP because it is compiled. PHP is interpreted which means you don’t compile it. The PHP interpreter reads the source code at runtime and interprets the source code to make it execute instructions the computer really understands. This means you deploy the source code to the production servers. It also means you can simply change the source code and rerun the file and it will change its behavior.

    Java is different. The source code is parsed at compile time when the developer is writing the code. Compiling translates the source code into instructions prior to deployment. That means the source code isn’t deployed. Therefore, Java doesn’t spend any extra time at runtime to convert source code into instructions. That’s done prior to deployment. Java also converts the bytecode (java instructions) into native instructions using something called the JIT (just in time compilation). The JIT is crazy fast. Java is much faster than PHP in execution time. But, if you want to change the behavior you have to change the source and recompile it. Ant is a tool that helps compile, package, and deploy Java code. There is also Maven, but it has a higher learning curve. Much of this is the same story for C# too. It is also a compiled language.

    Java support structure is massive. There is tons of tooling and libraries for Java that just aren’t available to other stacks. Things like Lucene, Spring, Hadoop, Tomcat, PDF generation, etc. What Java brings to the table is access to lots of code that isn’t always possible with PHP only. For example, I have a PHP website that I’m generating barcodes and PDF files of those barcodes. I have to use Java to generate this and have PHP call it remotely through Tomcat. Generating barcodes, PDFs, are easier in Java because libraries exist for this. Working with Java is easier than using C (and safer). PHP is great at fast integration because it will run anything.

    If you wanted to do quick integration with Java you can execute the java executable from the command line. PHP can exec() any program, and Java is not different from the view of the OS. It’s just an executable. The upside is you don’t need extra tooling like Tomcat, Servlets, etc. The downside is the Java VM can take up a fair amount of memory and time to startup. If you are exec()’ing lots of Java VMs you could easily eat up memory on your server. That’s where something like Tomcat can help because it would run a long running program within a single Java VM that you can interact with either through sockets, HTTP, etc. That single program can serve lots of requests at once. There are plenty of options for integration.

    http://php.net/manual/en/function.exec.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was thinking whether it is possible to bridge asp.net, php and java to
So I was thinking one way that you can bring method chaining into PHP
I've written this class that returns feed updates, but am thinking it can be
I'm thinking that the reason I can't do this is because it might be
Thinking about my other problem , i decided I can't even create a regular
How can I calculate the value of PI using C#? I was thinking it
I'm thinking of something smaller than a laptop that i can spend my hours
How can I convert PDF files to HTML with Python? I was thinking something
Can I specify interfaces when I declare a member? After thinking about this question
Can anyone explain what might be causing this error. Im thinking its the quotes.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.