CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2000
    Location
    A.P , India
    Posts
    1

    avoid DOS window

    When we develop any application using AWT or Swing API, we have to run it from DOS editor. But once the application is developed fully , I don't want to use dos editor to run application.Is there any way to hide dos window. Or can we make an executable file from Class file? how to get ride off from DOS windos?


  2. #2
    Join Date
    Mar 2000
    Location
    Kaysville, UT
    Posts
    228

    Re: avoid DOS window

    If you jar all the class files up and set the manifest file for the jar correctly, you should be able to create an "executable jar" file, one that you can double-click on and the application will run.

    Take a look at:
    http://java.sun.com/docs/books/tutor...ics/index.html

    "There's nothing more dangerous than a resourceful idiot." ---Dilbert
    BWAHAHAHAHAHAHA! ---Murray

  3. #3
    Join Date
    May 1999
    Location
    Pune, MH, India.
    Posts
    453

    Re: avoid DOS window

    If you don't want DOS window when you run your application, use 'javaw.exe' for JDK1.2 or 'jre.exe' for JDK1.1

    Hope this is what you want.

    - UnicMan
    http://members.tripod.com/unicman

  4. #4
    Join Date
    Feb 2001
    Posts
    4

    Re: avoid DOS window

    hi ..
    or have a look ....

    A Simple Way to Make An Executable Jar File
    Put all classes and resource directories (images/audios/input files) in the same directory.
    Your classes must get their resources via getClass().getResource("resource_dir/resourceFile").
    For example:
    Image myImage = Toolkit.getDefaultToolkit().getImage(getClass().getResource("images/mypic.jpg"));
    Don't use "image//mypic.jpg"; it won't work with the jar file you are going to make.
    The return type of getClass().getResource("resource_dir/resourceFile") is URL.
    Create a text file containing the following line:
    Main-Class: yourMainClass
    For example, if you normally start your application by java runApplication, then your file must contain
    Main-Class: runApplication
    Save the text file within the same directory as your classes'. This text file is called a Jar file's manifest.
    Suppose your manifest is named mainClass. Then within that directory, issue the command:
    jar cmf mainClass OutputJarFile.jar *
    Your OutputJarFile.jar is now a stand-alone executable jar file. (Of course, you can move it out of the directory and put it wherever you want.) You can either run it by double click on the file or issue the command
    java -jar OutputJarFile.jar



  5. #5
    Join Date
    Feb 2001
    Posts
    4

    Re: avoid DOS window

    This is right for almost, but what if I want my application (in the executable jar) to run with arguments, as if I typed "java MyApplication argument1 argument2" ?
    I have been told that an application which needs the command line is not 100% pure java. What can we do then?

    In my case I would like to execute my java application from a VB form : for the moment I write "java MyApplication argument1 argument2" in a BATCH file and execute that batch, but it's not very java...

    (Plus : Do you have resources about what is a 100% pure java program?)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured