How do I thead a java aplication?

How would i multithread this?
i creadted a gui in netbeans to run my antivirus for mac, its coded in version 6 of java, (windows and linux), how would i thread it to output finds and after it scans every 100 files scanned?
The full files are avalable at www.saveourmacs.com
* JavaAntivirusView.java
package saveourmacs;
import java.net.*;
import java.io.*;
import java.util.*;
import java.text.DecimalFormat;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;
* The application's main frame.
public class JavaAntivirusView extends FrameView {
    public Signatures sig;
    public boolean virusFound;
    public int count = 1;
    public long before, after, total = 0;
    public DecimalFormat cur;
    public JavaAntivirusView(SingleFrameApplication app) {
        super(app);
        initComponents();
        sig = new Signatures("C:\\Documents and Settings\\Ryan\\Desktop\\MAIN\\main.db", this.textoutput);
        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);
        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String)(evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer)(evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = JavaAntivirusApp.getApplication().getMainFrame();
            aboutBox = new JavaAntivirusAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        JavaAntivirusApp.getApplication().show(aboutBox);
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        mainPanel = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        textoutput = new javax.swing.JTextArea();
        SelectDirectory = new javax.swing.JButton();
        UpdateDefinitions = new javax.swing.JButton();
        Scan = new javax.swing.JButton();
        Exit = new javax.swing.JButton();
        dirselect = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();
        mainPanel.setName("mainPanel"); // NOI18N
        jScrollPane1.setName("jScrollPane1"); // NOI18N
        textoutput.setColumns(20);
        textoutput.setRows(5);
        textoutput.setName("textoutput"); // NOI18N
        textoutput.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentShown(java.awt.event.ComponentEvent evt) {
                textoutputComponentShown(evt);
        jScrollPane1.setViewportView(textoutput);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(saveourmacs.JavaAntivirusApp.class).getContext().getResourceMap(JavaAntivirusView.class);
        SelectDirectory.setText(resourceMap.getString("SelectDirectory.text")); // NOI18N
        SelectDirectory.setName("SelectDirectory"); // NOI18N
        SelectDirectory.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                SelectDirectoryMousePressed(evt);
        UpdateDefinitions.setText(resourceMap.getString("UpdateDefinitions.text")); // NOI18N
        UpdateDefinitions.setName("UpdateDefinitions"); // NOI18N
        UpdateDefinitions.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                UpdateDefinitionsMousePressed(evt);
        Scan.setText(resourceMap.getString("Scan.text")); // NOI18N
        Scan.setName("Scan"); // NOI18N
        Scan.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                ScanMousePressed(evt);
        Exit.setText(resourceMap.getString("Exit.text")); // NOI18N
        Exit.setName("Exit"); // NOI18N
        Exit.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                ExitMousePressed(evt);
        dirselect.setText(resourceMap.getString("dirselect.text")); // NOI18N
        dirselect.setName("dirselect"); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N
        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 381, Short.MAX_VALUE)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addComponent(SelectDirectory)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(UpdateDefinitions)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(Scan)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(Exit))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(dirselect, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel2)))
                .addContainerGap())
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(dirselect, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(SelectDirectory)
                    .addComponent(UpdateDefinitions)
                    .addComponent(Scan)
                    .addComponent(Exit))
                .addContainerGap())
        menuBar.setName("menuBar"); // NOI18N
        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N
        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(saveourmacs.JavaAntivirusApp.class).getContext().getActionMap(JavaAntivirusView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);
        menuBar.add(fileMenu);
        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N
        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);
        menuBar.add(helpMenu);
        statusPanel.setName("statusPanel"); // NOI18N
        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N
        statusMessageLabel.setName("statusMessageLabel"); // NOI18N
        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N
        progressBar.setName("progressBar"); // NOI18N
        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 401, Short.MAX_VALUE)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 231, Short.MAX_VALUE)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3))
        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
    }// </editor-fold>//GEN-END:initComponents
private void ExitMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ExitMousePressed
// TODO add your handling code here:
System.exit(0);//GEN-LAST:event_ExitMousePressed
private void SelectDirectoryMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_SelectDirectoryMousePressed
// TODO add your handling code here:
  /*  textoutput.setText(" Initializing...");
    String filename = File.separator+"tmp";
    JFileChooser fc = new JFileChooser(new File(filename));
    // Show open dialog; this method does not return until the dialog is closed
    fc.showOpenDialog(frame);
    File selFile = fc.getSelectedFile();
    // Show save dialog; this method does not return until the dialog is closed
    fc.showSaveDialog(frame);
    selFile = fc.getSelectedFile();
    /*if (aboutBox == null) {
            JFrame mainFrame = JavaAntivirusApp.getApplication().getMainFrame();
            aboutBox = new JavaAntivirusAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        JavaAntivirusApp.getApplication().show(aboutBox); */
    if (aboutBox == null) {
            JFrame mainFrame = JavaAntivirusApp.getApplication().getMainFrame();
            aboutBox = new JavaAntivirusAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        JavaAntivirusApp.getApplication().show(aboutBox);
}//GEN-LAST:event_SelectDirectoryMousePressed
private void UpdateDefinitionsMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_UpdateDefinitionsMousePressed
// TODO add your handling code here:
/*FTPClient ftpClient = new FTPClient();
ftpClient.connect("ftp.foo.com", "user01", "pass1234");
ftpClient.download("C:\\Temp\\", "README.txt");
// Eventually other operations here ...
ftpClient.disconnect();*/
}//GEN-LAST:event_UpdateDefinitionsMousePressed
private void ScanMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ScanMousePressed
// TODO add your handling code here:
    String directorychoose "";
    directorychoose = dirselect.getText();
    if(directroychoose.equals(""))
      directorychoose = "."; 
    cur =  new DecimalFormat(".00");
    File startingDirectory = new File(directorychoose);
    //File startingDirectory = new File(".");
    textoutput.append("Scanning Files.");
    scanDirectory(startingDirectory);
}//GEN-LAST:event_ScanMousePressed
private void textoutputComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_textoutputComponentShown
  // TODO add your handling code here:
}//GEN-LAST:event_textoutputComponentShown
* This program demonstrates how to traverse a directory.
* @version 1.0
* @author  Jeffrey M. Hunter  ([email protected])
* @author  http://www.idevelopment.info
    public void scanDirectory(File dir) {
          if (count % 100 == 0)
               if ( (total / 1000) < 60 )
                    textoutput.append(count + " files scanned in " + cur.format((double)(total) / 1000) + " seconds.");
               else
                    textoutput.append(count + " files scanned in " + cur.format((double)(total) / 60000) + " minutes." );               
        if (dir.isDirectory()) {
            String[] children = dir.list();
            for (int i=0; i<children.length; i++) {
                    scanFile(dir.getAbsolutePath() + "\\" +children);
scanDirectory(new File(dir, children[i]));
     public void scanFile(String fileName)
          before = System.currentTimeMillis();
          File f = new File(fileName);
          virusFound = false;
          count++;
          if ((int)f.length() > Integer.MAX_VALUE) {
               textoutput.append("Not enough memory to read file.");
               System.exit(-1);
          //System.out.print ("Scanning " + f + " - ");
          byte[] bytes = new byte[(int)f.length()]; // assume < 2gb
          RandomAccessFile raf = null;
          try
               raf = new RandomAccessFile(f,"r");
               raf.readFully(bytes);
               raf.close();
          catch (Exception e)
               textoutput.setText(e.toString());
               //System.exit(-1);
          String fileBytes = new String(bytes);
          for (int i = 0; i < sig.numSigs(); i++)
               if (fileBytes.indexOf(sig.getSignature(i).getPattern()) > 0 )
                    textoutput.append(sig.getSignature(i).getName() + " Virus Found!");
          after = System.currentTimeMillis();
          total = total + (after - before);
          if (!virusFound)
               System.out.println("Clean");
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton Exit;
private javax.swing.JButton Scan;
private javax.swing.JButton SelectDirectory;
private javax.swing.JButton UpdateDefinitions;
private javax.swing.JTextField dirselect;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JPanel mainPanel;
private javax.swing.JMenuBar menuBar;
private javax.swing.JProgressBar progressBar;
private javax.swing.JLabel statusAnimationLabel;
private javax.swing.JLabel statusMessageLabel;
private javax.swing.JPanel statusPanel;
private javax.swing.JTextArea textoutput;
// End of variables declaration//GEN-END:variables
private final Timer messageTimer;
private final Timer busyIconTimer;
private final Icon idleIcon;
private final Icon[] busyIcons = new Icon[15];
private int busyIconIndex = 0;
private JDialog aboutBox;
public static void download(String address) {
          int lastSlashIndex = address.lastIndexOf('/');
          if (lastSlashIndex >= 0 &&
          lastSlashIndex < address.length() - 1) {
               //download(address, address.substring(lastSlashIndex + 1));
          } else {
               System.err.println("Could not figure out local file name for " +
                    address);
public static void download(String address, String localFileName) {
          OutputStream out = null;
          URLConnection conn = null;
          InputStream in = null;
          try {
               URL url = new URL(address);
               out = new BufferedOutputStream(
                    new FileOutputStream(localFileName));
               conn = url.openConnection();
               in = conn.getInputStream();
               byte[] buffer = new byte[1024];
               int numRead;
               long numWritten = 0;
               while ((numRead = in.read(buffer)) != -1) {
                    out.write(buffer, 0, numRead);
                    numWritten += numRead;
               System.out.println(localFileName + "\t" + numWritten);
          } catch (Exception exception) {
               exception.printStackTrace();
          } finally {
               try {
                    if (in != null) {
                         in.close();
                    if (out != null) {
                         out.close();
               } catch (IOException ioe) {
public static void main(String[] args) {
          for (int i = 0; i < args.length; i++) {
               download(args[i]);
Edited by: kingryanj on Jun 19, 2008 10:49 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

{color:red}{size:16px}CROSS POSTED{size}{color}
[http://forum.java.sun.com/thread.jspa?threadID=5306819]
Cross posting is rude.
db

Similar Messages

  • How can i open my Java aplication...

    Hi everybody!
    I was wondering how can i open my Java Picture Viewer by presing an picture.
    When i am running the program with an argument like this
    --> java JPic <path to picture> its ok.
    But i want to press the image and automaticly open my Java Program.
    How can i do that?
    I have to use a native method?
    The source of my program is here:
    http://aetos.it.teithe.gr/~athoik/myprograms/jpic/jpic.html
    Every help IS ACCEPTABLE AND NECESSARY.

    I find it how it works. Al you need to do is make a script. So by presing a picture with your
    mouse or on shell the program run with the specific picture as input :)
    Cool!!
    ##### For Windos Script .bat ######
    @cd C:\
    @cd "C:\path to program\"
    @java -jar JPic.jar %1
    @pause
    ###### For Linux Script ########
    @cd /where the program is
    @java -jar JPic.jar $1

  • How I can create a XML file from java Aplication

    How I can create a XML file from java Aplication
    whith have a the following structure
    <users>
    <user>
    <login>anyName</login>     
    <password>xxxx</password>
    </user>
    </users>
    the password label must be encripted
    accept any suggestion

    Let us assume you have all the data from the jsp form in an java bean object..
    Now you want a xml file. This can be acheived in 2 ways
    1. Write it into a file using java.io classes. Say you have a class with name
    write("<name>"+obj.getName+</name>);
    bingo you have a flat file with the xml
    2. Use data binding to do the trick
    will recommend JiBx and Castor for the 2nd option
    Regards,
    Rajagopal

  • Using more than 1mb size java aplication on my nok...

    i want to use 1.2MB size java aplication on my nokia 6300 phone.but my phone support only softwares smaller than 1 MB.so how i use this aplication on my phone?
    If i update my nokia 6300 phone software,will it solve this problem?

    No.
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • Java Aplications with Oracle XE

    ok, I need to conect a java aplication with a oracle db XE, so I was researching how could do that. them I downloaded a file JDBC14.jar but I don`t understand how continue? but you have another form to conect this, I will be thanks with you in advance.

    Pl try the XE forum - Oracle Database Express Edition (XE)
    HTH
    Srini

  • How do I include a JAVA file in my website  using DreamweaverCC ?

    Hi.  I searched the forums and it seems that all questions relating to JAVA and Dreamweaver elicit zero replies.
    I hope that someone has some direction.  Thanks again.
    I have a JAVA file that I want to include or have run within one of my pages in my WebSite.
    file > new > create > and there is not an option for JAVA but there is one for PHP etc. etc.
    How do I incorporate a java script into my Web Site ?
    I thought that I could just copy the code into the file here - at least to begin with  - but JAVA  runs in the background.
    I am lost
    conceptually
    and I do not know how to go about this task
    structurally.
    Thanks again,
    Regina

    JQuery is a core JavaScript library used by millions of web sites.  It's the "do more & write less code framework."  If you're into re-inventing the wheel every time you need an advanced feature (plugin), feel free to manually code it yourself with JavaScript.  However, you'll need to test & debug your scripts in every conceivable browser and OS before you can be sure it's viable for use on a production site.
    On the other hand, you could use a plugin and be up & running in 5 minutes or less. See the code below.
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>HTML5, with Fancybox2 Viewer</title>
    <!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <!--LATEST JQUERY CORE LIBRARY-->
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    <!--FANCYBOX plugins-->
    <link href="http://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.css" rel="stylesheet" media="screen">
    <script src="http://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.pack.js"></script>
    <style>
    body {
        background: silver;
        font-family:Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, sans-serif;
    #wrapper {
        width: 1000px; margin:0 auto;
        background:#FFF;
    /**this styles image container**/
    #thumbs p {
        float: left;
        width: 180px;
        height: 12.5em;
        margin: 10px 22px 0 22px; /**space between containers**/
        padding: 10px; /**space around containers**/
        border: 1px solid silver;
        /**rounded borders**/
        -moz-border-radius: 20px;
        -webkit-border-radius: 20px;
        border-radius: 20px;
        /**this styles caption text**/
        font: italic 14px/1.5 Geneva, Arial, Helvetica, sans-serif;
        color: #666;
        text-align: center;
    /**recommend using same size images**/
    #thumbs img {
        width: 160px; /**adjust width to thumbnail**/
        height: 120px; /**adjust height to thumbnail**/
        margin-bottom: 1.5em;
        opacity: 0.75;
    #thumbs img:hover { opacity: 1.0 }
    /**float clearing**/
    #thumbs:after {
        content: ".";
        clear: left;
        font-size: 0px;
        line-height: 0;
        display: block;
        visibility: hidden;
    </style>
    </head>
    <body>
    <div id="wrapper">
    <h1><a href="http://fancyapps.com/fancybox/">Fancybox2</a> Viewer with images</h1>
    <!--insert thumbnails with links to full size images below-->
    <div id="thumbs">
    <p><a class="fancybox" data-fancybox-group="gallery" href="http://placehold.it/400x320.jpg" title="optional captions"><img src="http://placehold.it/160x120.jpg" alt="Thumbnail 1" /></a> <br />
    Caption 1 </p>
    <p><a class="fancybox" data-fancybox-group="gallery" href="http://placehold.it/400x320.jpg" title="optional captions"><img src="http://placehold.it/160x120.jpg" alt="Thumbnail 2" /></a> <br />
    Caption 2 </p>
    <p><a class="fancybox" data-fancybox-group="gallery" href="http://placehold.it/400x320.jpg" title="optional captions"><img src="http://placehold.it/160x120.jpg" alt="Thumbnail 3" /></a> <br />
    Caption 3 </p>
    <p><a class="fancybox" data-fancybox-group="gallery" href="http://placehold.it/400x320.jpg" title="optional captions"><img src="http://placehold.it/160x120.jpg" alt="Thumbnail 4" /></a> <br />
    Caption 4 </p>
    <!--end thumbs--></div>
    <!--end wrapper--></div>
    <!--FancyBox function code-->
    <script>
    $(document).ready(function() {
        $('.fancybox').fancybox();
    </script>
    </body>
    </html>
    Nancy O.

  • Fedora 13: After upgrading from FF3.6 to FF6.0.2 I no longer have a Java plugin. How do I configure the Java Plugin for FF 6 ? There is no Java Plugin at the site

    I am Fedora 13x64 bit. I just installed FF v6.0.2 from the FF download site. I backed up the existing FF 3.6 as firefox_old
    I need to have a Java plugin to access company site, how do I configure the Java Plugin ?
    At the Plugin area in FF6 there is no Java Plugin available, even after a search.
    I have Java 1.6.0 installed in the OS at:
    /usr/lib/jvm/java-1.6.0/jre/lib/amd64/libnpjp2.so
    I googled how to configure Java Plugin for FF 6 for Fedora 13 and the trick was to create a soft link from /home/<userID>/.mozilla/plugins to the above libnpjp2.so

    AVtech wrote:
    . . . If a person can't get an answer here I don't know where else to turn since Sun certainly wouldn't offer tech support for a free product . . .These forums are user forums, and only occasionally visited by Sun employees. Sun does provide Java technical support options, although (of course) at a charge.
    See:
    http://developers.sun.com/services/
    . . . I guess we'll just use JRE 5 until it's unsupported, whenever that will be. I'm still waiting for an answer on that question, too. See:
    http://java.sun.com/products/archive/eol.policy.html
    http://www.sun.com/service/eosl/
    This document (part IV and Appendix) has some debugging and troubleshooting information that may allow someone involved in the problem to resolve the cause:
    See:
    http://java.sun.com/javase/6/docs/technotes/guides/plugin/developer_guide/contents.htm
    Any steps that you can take to isolate the problem to specific Java versions, browsers, applets, web sites, operating systems (and versions), etc, would enhance the possibility of getting help.
    You can try the applets at this Sun location and see if any of them are "slow".
    See:
    http://java.sun.com/javase/6/docs/technotes/samples/demos.html

  • How can I use Seeburger java functions on SAP XI's user defined functions?

    Hi All,
    As my title implies; how can I use Seeburger java functions on SAP XI's user defined functions?  I've tried searching over the net in tutorials regarding this topic but I failed to find one; can someone provide me information regarding my question? thanks very much.
    best regards,
    Mike

    Hi Mike !
    You should check your documentation about which java classes you need to reference in the "import" section of your UDF. And also deploy the java classes into the java stack or include them as a imported archive in integration repository...it should be stated in the seeburger documentation.
    What kind of functions are you trying to use?
    Regards,
    Matias.

  • How can I share a *.java source file across multiple projects in NetBeans?

    I'm sure this simple and a pretty common operation but how can I share a *.java source file across multiple projects in NetBeans? Right now I keep cut, coping and pasting the same source file between multiple projects to re-use the same code. But I could I make this source file a library file or something like that so that I could access it from any project. I assume this would be a generic operation but I mentioned NetBeans for clarity. Thanks.

    fiebigc wrote:
    I know I mentioned NetBeans but I'm most interested in the generic method for creating a library of source files that I can call into whatever program I am developing. I've done such a thing in C using header files and such but I'm trying to get a direction on how this is accomplished in Java. I'm sorry if I could edit the title I would. If anyone wants to be specific about NetBeans I welcome that too.
    Edited by: fiebigc on Jun 20, 2008 5:57 PM
    >I know I mentioned NetBeans but I'm most interested in the generic method for creating a library of source files that I can call into whatever program I am developing. I've done such a thing in C using header files and such but I'm trying to get a direction on how this is accomplished in Java. I'm sorry if I could edit the title I would. If anyone wants to be specific about NetBeans I welcome that too.
    Edited by: fiebigc on Jun 20, 2008 5:57 PM
    Create a class library.
    Write your code, compile it to .class files, put those class files in a .jar file and include the jar file in the classpath whenever you want to compile a project against it.

  • How can I create a java.awt.Image from ...

    Hi all,
    How can I create a java.awt.Image from a drawing on a JPanel?
    Thanks.

    JPanel p;
    BufferedImage image =
        new BufferedImage(p.getWidth(), p.getHeight, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = image.createGraphics();
    p.paint(g);
    g.dispose();

  • How to print "Text" in JAVA(TM)....

    Does anyone know how to print "text" using Java?
    - Here's an example output...
    NOTE: # == 'empty spaces'
    --------------------------- <- Paper
    |###################|
    |####Welcome#########|
    |###################|
    |########to##########|
    |###########JAVA(TM)##|
    |###################|
    |#######Programming####|
    |###################|
    Please post a complete << SAMPLE CODE >> for printing the "text" (Welcome to JAVA(TM) Programming. Including the indentions. So it will not be like this...
    -------------------- <- Paper
    |Welcome |
    |to |
    |JAVA(TM) |
    |Programming |
    | |
    | |
    | |
    | |
    Thanks.

    Please read How To Ask Questions The Smart Way

  • How can I run a java-application on starting of Windows 2000

    How can I run a java-application without any user on starting of Windows 2000?
    For example, if the computer is restarted and nobody enter into it yet, my java-application should run anyway.
    How can I do that?

    Hi, you have to put it in a Windows service.
    To do this you have a program, Srvany.exe that allow to insert a .exe or .bat program in a Windows service.
    For example, i develop a program, TomcatGuardian and i put it in a service because i need to run it in a server without Administrator logged in.
    Regards,
    Ivan.

  • How can I call a java class from within my program?

    I was wondering if there's a platform independent way to call a java class from my program.

    Here's my scenario. I'm working on a platform independent, feature rich, object-oriented command prompt program. The way I'm designing it is that users can drop classes they write into my bin directory and gain access to the class through my program. For example, they drop a class named Network.class in the bin directory. They would type Network network at my command prompt and gain access to all the methods available in that class. They can then type system.echo network.ipaddress() at my prompt and get the system's ip address. I have it designed that there's a server running in the background and the clients connect to my port. Once connected the end-user can enter their user name and password and gain access to the system. When they type a command they actually call another java program which connects to my server using a seperate thread. They can then communicate back and forth. I have it set that everything has a process id and it's used to keep track of who called what program. Once the program is done it disconnects and closes. Rather than getting into the nitty gritty (I didn't want to get into heavy detail, I know how everything will work) I'm really interested in finding out how I can call a java program from my program. I don't want it to be part of the app in any way.

  • How to invoke A CORBA-Java Client Application, from Oracle???

    Hi,
    I have a CORBA-Java Client Application, which takes the input parameters from a Oracle table and calls the CORBA Server, passes these parameters to the C++ Server Application and gets the results back thorugh CORBA.
    My problem is, this java application needs to be invoked, when ever there is a new record in the Oracle table.
    I am not sure if i can use Java Stored Procedures in Oracle in this case, because my app is in Sun JVM and i am using BEA WebLogic Enterprise 5.1 for the CORBA.
    Is there any other way by which i can invoke this app, when a new record is updated in the Oracle table?
    Currently, i have just put a TIMER in my java App, to check the oracle table in every few seconds, to see if there is a new reocrd. If it finds a new record it invokes the corresponding class(corba class), or else just keep sending a messsage that no new record is available.
    The problems i am facing in this method are as follows;
    1. Unnecessarily, the application has to keep on running if there is no request coming frequently.
    2. When there is a new record found, the Corba Class is called and the whole process (till it gets the result back from the server) takes about 20 - 30 secs. But within this period, if there is another record coming into Oracle table, my timer class doesnt invoke another corba class....(though i am using multithreading by using the RemidTask method in the timer.schedule.
    (timer.schedule(new RemindTask(),10,5*1000);)
    3. Also, if during the first call, there is some error, then the whole process exits, instead of another process running parallely (when a second new record is found).
    So how does this timer class act like a multithreading process?
    Well, i hope i am not confusing....Please let me know if anyone wants bit more elaboration on this.
    It would be really helpful if someone can suggest some answer to my problem.
    Thanks in advance.

    Thank you very much Keith.
    Though i am really getting a hope of solving this problem, from you answer, i am actually not 100% sure if i understood your reply properly.
    First of all, about
    1. "use the update stored procedure to place the updated record (or unique index) onto an Oracle Application Queue."
    -- Why do i need to put the record in the AQ. (Frankly speaking, at this moment i dont have much idea about AQ, probably i can learn more about it from oracle technet site? Or would u suggest anything else?)
    Then,
    2."Your app then waits on this queue and for each new message, consumes it, gets the data required from the AQ load (e.g the index and or record), and fires off the CORBA class"
    -- How does my application stay in the queue? and gets the data from the queue?
    Of course, as far as i understand, i am going through the same principle...keeping on running a timer class, which keeps on checking the table for a new record, and when it finds, it calls the CORBA class.
    Of course, i feel there should be a difference in running the timer continuosly and staying in queue. However i am totally unaware, how can i make my java app to wait in the queue and waits for a new record?
    Can you please elaborate your answer a bit more, because i dont know about the AQ, that you have mentioned.
    Thank you very much in advance for your time. But please know that it will be of great help to me and hence will be higly appreciated.
    Regards,
    Subhasree.

  • How do i run a java program an another directory?

    How do I run a java program that's in a different directory?
    I have been doing this in the command line:
    java "C:\Document and Settings\freeOn\Desktop\Java\Test\test"
    and I get
    Exception in thread "main" java.lang.NoClassDefFoundError:
    C:\Document and Settings\freeOn\Desktop\Java\Test\test
    I just thought there might be a quick way to do this and not
    have to cd to the following dir evertime i want to run an app in
    console.
    The test.java file is this:
    import java.io.*;
    public class test {
        public static void main(String args[]) {
          System.out.println("Testing.....");

    Ok I looked in the java help and found the classpath, this makes it alittle easier.
    java -cp C:\DOCUME~1\freeOn\Desktop\Java\Test\ test
    At least i can run this in the run dialog which makes it easier thanks for you help kota balaji

Maybe you are looking for