Calling Java program from C#

Calling Jaba program from C#

Author Date of Submission User Level
Maheswara Rao 07/18/2001 Intermediate

  
Source Code SunMSMSRao.zip 7 KB

Hi sharpers
This is Mahesh again after some break. In this article I am going to show how to call java program using C#.  

According Microsoft definition of C#: -
揅# is a simple, Modern. Object Oriented language and combine the high productivity of VB and the raw power of C++?/font>

According Mahesh definition of C#: -
揅# is Simple, Modern, Object Oriented beautiful language and daughter (SHE-SHARP) of Java and Microsoft ?/font>

What I want to say SUN (sun) and MS (moon) both are very Important to IT WORLD (world) but both are now enemies now a days they are making languages to dominate each other.  This is sure without sun and moon there is no world like that with out SUN and MS there is no IT WORLD. I pry to god to make both are good friends they should work for IT PEOPLE.   

This application has 4 files

shesharp.cs
javasharp.java
comp.bat  //for compel
j.bat  
In this application I used Inner class for developing panel.

using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Diagnostics;
using System;

厖?

厖?.

//for mixed background
public void format(object s,PaintEventArgs a)
    {
      Graphics g=CreateGraphics();
      Rectangle rect=new Rectangle(0,0,300,300);
      Color nyc=Color.FromArgb(200,50,5,200);
      LinearGradientBrush b=new       LinearGradientBrush(rect,Color.DarkOrange,nyc,LinearGradientMode.Vertical);
      g.FillRectangle(b,rect);
    }

//for calling java program
private void calljava(object ob,EventArgs arg)
    {
        Process.Start("j.bat");
    }

//using Inner class for panel
public class pp:Panel
    {
     int x;
     int y;
     Timer t=new Timer();
     String s="Hi...\nyou Know?\nWe are good Friends\nI can call Java ...";
     String mail="mail me..\nmallm_uma@rediffmail.com\nmahe_proj@rediffmail.com";
     private Label l=null;
     private Label maill=null;
     Color nyc;
//Constructor
     public pp()
       {
       x=10;
       y=200;
     this.Location=new Point(0,10);
     nyc=Color.FromArgb(200,10,5,225);
     this.Size=new Size(300,230);
     maill=new Label();
     l=new Label();
     l.Text=s;
     l.Size=new Size(250,100);
     l.ForeColor=nyc;
     l.BackColor=Color.Transparent;
     l.Font=new Font("verdana",15,FontStyle.Bold);
     l.TextAlign=ContentAlignment.MiddleCenter;
     maill.Text=mail;
     maill.Size=new Size(160,40);
     maill.Location=new Point(10,192);
     maill.Font=new Font("verdana",7,FontStyle.Bold);
     maill.ForeColor=Color.Yellow;
     maill.BackColor=Color.Transparent;
     this.Controls.Add(l);
     this.Controls.Add(maill);
     t.Interval=50;
     t.Tick+=new EventHandler(draw);
     t.Enabled=true;
      }

   protected override void OnPaint(PaintEventArgs a)
     {
      Graphics g=a.Graphics;
      Rectangle rect=new Rectangle(0,0,300,230);
      LinearGradientBrush b=new LinearGradientBrush(rect,Color.DarkOrange,nyc,LinearGradientMode.Vertical);
      g.FillRectangle(b,rect);
      Font ff=new Font("Arial",14,FontStyle.Bold);
      SolidBrush bb=new SolidBrush(nyc);
      StringFormat df=new StringFormat();
     }

//for animation

     void draw(object ob,EventArgs a)
     {
     l.Location=new Point(x,y);
      --y;
      if(y==-100)y=230;
        }
    }

    public static void Main()
    {
    Application.Run(new shesharp());
厖?

厖?

  

Remarks: OS: Win2000 and 98 with CLR and JAVA

This application is dedicated to SUN and MS.  

Mail me:

mallm_uma@rediffmail.com

mahe_proj@rediffmail.com

时间: 2024-10-29 04:35:56

Calling Java program from C#的相关文章

Java学习笔记

笔记 本笔记是在看浙大翁恺老师的视频教学时所做,希望对Java初学者有帮助! 一.Java基础1.正确认识Java(1)Java是一种有生产力的OOP语言,C++能做的Java都能做(2)Java与网络关系不大,更不是用来做网页的(3)Java是UNIX世界的产物,具有UNIX的思想(4)Java在国外广泛的被用来做各种应用2.Java历史(1)Brithday:May 23,1995(2)1991:Set-Top box:Jame Gosling(3)1994:OAK and FirstPer

Java Secure Socket Extension (JSSE) Reference Guide

Skip to Content Oracle Technology Network Software Downloads Documentation Search Java Secure Socket Extension (JSSE) Reference Guide This guide covers the following topics: Skip Navigation Links Introduction Features and Benefits JSSE Standard API S

如何在 Java 中正确使用 wait, notify 和 notifyAll – 以生产者消费者模型为例

wait, notify 和 notifyAll,这些在多线程中被经常用到的保留关键字,在实际开发的时候很多时候却并没有被大家重视.本文对这些关键字的使用进行了描述. 在 Java 中可以用 wait.notify 和 notifyAll 来实现线程间的通信..举个例子,如果你的Java程序中有两个线程--即生产者和消费者,那么生产者可以通知消费者,让消费者开始消耗数据,因为队列缓冲区中有内容待消费(不为空).相应的,消费者可以通知生产者可以开始生成更多的数据,因为当它消耗掉某些数据后缓冲区不再

一个塑料期货交易程序分析图程序(PHP+JAVA)

程序 PHP+JAVA的程序 ..................... Java Program: /*以下程序为余姚塑料城期货交易数据的定时追踪分析程序是对数据的初步分析,绘图分析则交给进一步的php程序来完成本程序完成策划于2005-5-17(友谊日)本程序可以作为K线图原始数据库*/import java.net.*;import java.io.*;import java.nio.*;import java.text.*;import java.util.*;import java.u

Java中的反射机制

反射,reflection,听其名就像照镜子一样,可以看见自己也可以看见别人的每一部分.在java语言中这 是一个很重要的特性.下面是来自sun公司官网关于反射的介绍: Reflection is a feature in the Java programming language. It allows an executing Java program to examine or "introspect" upon itself, and manipulate internal pr

在Java中使用VC++组件

介绍JNI是我喜欢的java编程框架:它让你你自由的使用本地编写的代码.例如,如果你想要在你的java程序中使用Windows API(不如说dll),那么你就要用JNI. Java最受欢迎的特性就是它的平台无关性.但是,有时候这一特性也会使你将Java程序与本地平台整合变得困难. 例如,在我们的工程中,将消息添加到数据库之前,我们使用MSM Q(Microsoft Messaging Que)的队列机制来维护消息(为了避免消息丢失).Microsoft提供了MSM Q API,它是Window

44个JAVA代码质量管理工具(转)

  1. CodePro AnalytixIt's a great tool (Eclipse plugin) for improving software quality. It has the next key features: Code Analysis, JUnit Test Generation, JUnit Test Editor, Similar Code Analysis, Metrics, Code Coverage and Dependency Analysis.2. PM

Programming Cljr – working with Java

Working with Java In this chapter, you will see how Clojure access to Java is convenient, elegant, and fast:  • Calling Java is simple and direct.    Clojure provides syntax extensions for accessing anything you could reach from Java code: classes, i

How to decompile class file in Java and Eclipse - Javap command example(转)

  Ability to decompile a Java class file is quite helpful for any Java developer who wants to look into the source of any open source or propriety library used in project. Though I always prefer to attach source in Eclipse of most common libraries li