Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-04-2007, 09:30 AM
Member
 
Join Date: Dec 2007
Posts: 5
Zahari is on a distinguished road
call executable jar from html/jsp
hello friends,
i have a problem to call executable jar using html/jsp.

i use the same code in applet. but be nothing.
help me.

if can send to my email, putraikim_n9@yahoo.com

thanks.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-04-2007, 06:10 PM
Senior Member
 
Join Date: Jun 2007
Location: Bali, ID
Posts: 102
wsaryada is on a distinguished road
Can you post your code so we know what you really want to do in your JSP page.
__________________
Website:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Blog:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-05-2007, 02:03 AM
Member
 
Join Date: Dec 2007
Posts: 5
Zahari is on a distinguished road
call executable jar from html/jsp
i have executable jar file example calculator.jar
i want to run it by called using jsp/html
i'm not using applet in my source code.

i try to use this code, but error occur "loaded applet failed"

<applet code=calculator.class
archive="calculator.jar"
width=640 height=480>
</applet>

actually in jsp/html, when the page has loaded, the executable jar must be run first.

Last edited by Zahari : 12-05-2007 at 02:05 AM.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 12-05-2007, 04:14 AM
Senior Member
 
Join Date: Jun 2007
Location: Bali, ID
Posts: 102
wsaryada is on a distinguished road
So your calculator class is not a Java applet? That means you cannot use the applet tag to run your calculator class. Can you post your calculator class definition?
__________________
Website:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Blog:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 12-05-2007, 04:38 AM
Member
 
Join Date: Dec 2007
Posts: 5
Zahari is on a distinguished road
class calculator
{
public static void main(String[]args)
{
new calculator();
}

public calculator()
{
//GUI code
}
}

then i convert into executable jar.(calculator.jar)
when manually doubleclick it run but
i want to call it from html/jsp.
thanks.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 12-05-2007, 06:03 PM
Senior Member
 
Join Date: Jun 2007
Location: Bali, ID
Posts: 102
wsaryada is on a distinguished road
Well, I believe i cannot be done this way. You need to create an applet that you embed on your page or you can create a swing application and then use java webstart to distribute your application.
__________________
Website:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Blog:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 12-06-2007, 02:00 AM
Member
 
Join Date: Dec 2007
Posts: 5
Zahari is on a distinguished road
what is java webstart? i use java swing application to write the program.
if i used java applet how can i convert it to executable jar file?

myCalculator.java

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class myCalculator extends JFrame implements ActionListener
{
JLabel jlbNo1 = new JLabel("Nombor Pertama : ");
JLabel jlbNo2 = new JLabel("Nombor Kedua : ");
JLabel jlbResult = new JLabel("Keputusan : ");

JTextField jtfNo1 = new JTextField(20);
JTextField jtfNo2= new JTextField(20);
JTextField jtfResult = new JTextField(20);

JButton jbtTambah = new JButton();
JButton jbtTolak = new JButton();
JButton jbtDarab = new JButton();
JButton jbtBahagi = new JButton();

JMenu jmnFail = new JMenu("Fail");
JMenu jmnOps = new JMenu("Operasi");

JMenuItem jmiKeluar = new JMenuItem("Keluar");
JMenuItem jmiTambah = new JMenuItem("Tambah");
JMenuItem jmiTolak = new JMenuItem("Tolak");
JMenuItem jmiDarab = new JMenuItem("Darab");
JMenuItem jmiBahagi = new JMenuItem("Bahagi");


myCalculator()
{
Container bekas = getContentPane();
bekas.setLayout(new BorderLayout(5,10));
bekas.setBackground(Color.blue);

JMenuBar jmb = new JMenuBar();
setJMenuBar(jmb);

jmb.add(jmnFail);
jmb.add(jmnOps);

jmnFail.add(jmiKeluar);
jmnOps.add(jmiTambah);
jmnOps.add(jmiTolak);
jmnOps.addSeparator();
jmnOps.add(jmiDarab);
jmnOps.add(jmiBahagi);
jmiKeluar.setIcon(new ImageIcon("C:/gambar/keluar.gif"));

jmnFail.setMnemonic('F');
jmnOps.setMnemonic('O');
jmiKeluar.setMnemonic('K');
jmiTambah.setMnemonic('M');
jmiTolak.setMnemonic('T');
jmiDarab.setMnemonic('D');
jmiBahagi.setMnemonic('B');

jbtTambah.setToolTipText("Adding Number");
jbtTolak.setToolTipText("Substracting Number");
jbtDarab.setToolTipText("Multiplying Number");
jbtBahagi.setToolTipText("Dividing Number");

JPanel jplInput = new JPanel();
jplInput.setLayout(new GridLayout(2,2));
jplInput.add(jlbNo1);
jplInput.add(jtfNo1);
jplInput.add(jlbNo2);
jplInput.add(jtfNo2);
jplInput.setBackground(Color.pink);
jlbNo1.setForeground(Color.white);
jlbNo2.setForeground(Color.white);
jlbNo1.setFont(new Font("Arial",Font.BOLD,20));
jlbNo2.setFont(new Font("Arial",Font.BOLD,20));
jlbResult.setFont(new Font("Arial",Font.BOLD,20));

JPanel jplButang = new JPanel();
jplButang.setLayout(new GridLayout(1,4,20,20));
jplButang.add(jbtTambah);
jplButang.add(jbtTolak);
jplButang.add(jbtDarab);
jplButang.add(jbtBahagi);
jbtTambah.setIcon(new ImageIcon("C:/gambar/tambah.gif"));
jbtTolak.setIcon(new ImageIcon("C:/gambar/tolak.gif"));
jbtDarab.setIcon(new ImageIcon("C:/gambar/darab.gif"));
jbtBahagi.setIcon(new ImageIcon("C:/gambar/bahagi.gif"));
jbtTambah.setBackground(Color.yellow);
jbtTolak.setBackground(Color.pink);
jbtDarab.setBackground(Color.cyan);
jbtBahagi.setBackground(Color.magenta);

JPanel jplResult = new JPanel();
jplResult.setLayout(new BorderLayout());
jplResult.add(jlbResult,BorderLayout.WEST);
jplResult.add(jtfResult,BorderLayout.CENTER);
//jplResult.add(jtaOutput,BorderLayout.SOUTH);

bekas.add(jplInput, BorderLayout.NORTH);
bekas.add(jplButang, BorderLayout.CENTER);
bekas.add(jplResult, BorderLayout.SOUTH);


//Register
jtfNo1.addActionListener(this);
jtfNo2.addActionListener(this);
jtfResult.addActionListener(this);

jbtTambah.addActionListener(this);
jbtTolak.addActionListener(this);
jbtDarab.addActionListener(this);
jbtBahagi.addActionListener(this);

jmiKeluar.addActionListener(this);
jmiTambah.addActionListener(this);
jmiTolak.addActionListener(this);
jmiDarab.addActionListener(this);
jmiBahagi.addActionListener(this);
}

public void actionPerformed(ActionEvent e)
{
int n1,n2,hasil=0;

if(e.getSource()==jbtTambah || e.getSource()==jmiTambah)
{
n1=Integer.parseInt(jtfNo1.getText().trim());
n2=Integer.parseInt(jtfNo2.getText().trim());
hasil=n1+n2;
jtfResult.setText(new Integer(hasil).toString());
}

if(e.getSource()==jbtTolak || e.getSource()==jmiTolak)
{
n1=Integer.parseInt(jtfNo1.getText().trim());
n2=Integer.parseInt(jtfNo2.getText().trim());
hasil=n1-n2;
jtfResult.setText(new Integer(hasil).toString());
}

if(e.getSource()==jbtDarab || e.getSource()==jmiDarab)
{
n1=Integer.parseInt(jtfNo1.getText().trim());
n2=Integer.parseInt(jtfNo2.getText().trim());
hasil=n1*n2;
jtfResult.setText(new Integer(hasil).toString());
}

if(e.getSource()==jbtBahagi || e.getSource()==jmiBahagi)
{
n1=Integer.parseInt(jtfNo1.getText().trim());
n2=Integer.parseInt(jtfNo2.getText().trim());
hasil=n1/n2;
jtfResult.setText(new Integer(hasil).toString());
}

if(e.getSource()==jmiKeluar)
System.exit(0);

}


public static void main(String args[])
{
myCalculator bingkai = new myCalculator();
bingkai.setTitle("KALKULATOR SAYA");
bingkai.setSize(500,400);
bingkai.setVisible(true);
bingkai.setDefaultCloseOperation(bingkai.EXIT_ON_C LOSE);

}
}

then i change it to executable jar. i want to run it by calling from html/jsp.

Last edited by Zahari : 12-06-2007 at 02:07 AM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
executable smooth New To Java 4 06-14-2008 07:12 PM
Executable Java eva New To Java 3 12-31-2007 01:38 AM
Executable JAR bugger New To Java 4 12-05-2007 07:41 PM
how to call a JAR FILE from HTML leonard Java Applets 1 08-05-2007 08:06 AM
Executable Application, use JCreator baltimore New To Java 1 07-31-2007 08:03 PM


All times are GMT +3. The time now is 04:01 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org