Jump to content

  • Log In with Google      Sign In   
  • Create Account


[java] Swig in Windows applications?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
21 replies to this topic

#21 SteveMeister   Members   -  Reputation: 122

Like
Likes
Like

Posted 05 July 2000 - 11:10 AM

No, no, javaw is exactly the same command as java, but it doesn''t output anything to the command line. It''s like running the java application in the background.

Sponsor:

#22 ManaSink   Members   -  Reputation: 122

Like
Likes
Like

Posted 06 July 2000 - 07:10 AM

Archigamer, extending Applet or JApplet is only required to run as an applet in a browser. Any compiled java class that implements the main method can be executed as an application using java.exe or javaw.exe, the two runtime virtual machines provided by Sun. java.exe uses the command window(DOS prompt) it is run from for input and output, it also creates a new one if it is run from a shortcut, registry entry, etc... javaw.exe does not use a command window at all, so it appears to run ''in the background''. These can be run from a command line, or from a batch file, registry entry, etc... I am assuming you are using a Windows environment. Unix is a little different, and I''ll give you Unix specifics if you want.

Try compiling this class:


import javax.swing.*;
public class MyApp extends Object{
public static void main(String args[]){
System.out.println("Before");
JFrame jf = new JFrame("My Window");
jf.addWindowListener (new java.awt.event.WindowAdapter () {
public void windowClosing (java.awt.event.WindowEvent evt) {
System.exit(0);
}
});
jf.show();
System.out.println("After");
}
}


Create two windows shortcuts that set the working directory to where this compiled class is. Then set each to use a different command line:

One should use this:
java -cp . MyApp

The other:
javaw -cp . MyApp

you may have to modify these to use full path names, (IE "C:\jdk1.2\bin\java -cp . MyApp") if your jdk/bin directory is not listed in your PATH environment variable.

Both start up a VM and run the class as an application. java.exe will create a command window, javaw.exe will not.
You should notice that this class has nothing to do with applets or a browser. This is run as an application, much the way Forte is run.

SteveMeister did read the post and is giving you good advice, there seems to be an impedence mismatch. I think this code snippet should straighten everything out.

ManaSink




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS