Calling Java program from C#
2008-05-01 04:10
302 查看
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
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
![](http://blog.csdn.net/upimg/20061210/11AJ4544530552P.jpg)
相关文章推荐
- Calling C Library Routines from Java
- Thinking in Java(4)-Calling constructor from constructors
- Calling C++ Unmanaged Class from C#
- Considerations when calling Java from PeopleCode
- Problem in calling C++ dll from C# Code
- What you may need to know while calling Application Module methods from Java EE components such as E
- Calling C# Methods From C++
- Calling C++ code from C# z
- Simplest Sample Class for Calling R from Java
- Calling a Web API From a .NET Client (C#)
- Ruby: Calling Ruby's ActiveRecord from Java Using the Bean Scripting Framework
- [20160701]DevideByZeroWithoutNoException——from 《Java How To Program (Early Objects), 10th》
- (转载)c# from a Java developer's perspective
- calling SQLLDR from C# (ASP.NET) - Oracle Server
- Calling Oracle 10g Stored Proc with Assoc Array from C# VS 2008
- Calling C From Java Is Easy
- [转]Calling an OData Service From a .NET Client (C#)
- Calling Java Classes Directly From .Net
- Calling Lua function from C#
- Calling Pro*C program from a package", version 8.0.5