Force jar to run through java.exe not javaw.exe

Hi,I am programming using eclipse 3.5.1 when i try to export my project as a single jar file it always runs through javaw.exe
even if its a console app the problem is that sometimes i want it to run through java.exe without having to write the annoying batch file (java -jar "appname.jar") which will only probably run under windows, is there a way around this that would force the jar file to run automatically in console mode?

803038 wrote:
Hi,I am programming using eclipse 3.5.1 when i try to export my project as a single jar file it always runs through javaw.exe
even if its a console app the problem is that sometimes i want it to run through java.exe without having to write the annoying batch file (java -jar "appname.jar") which will only probably run under windows, is there a way around this that would force the jar file to run automatically in console mode?Windows, not java, has file associations which specify what happens to certain files when someone double clicks on it.
You have one extension which you want to run two different ways. That of course isn't possible.
You could write a wrapper that spawns a console via Runtime.exec. Then your console apps would be wrapped in that.

Similar Messages

  • Please let me know if Java.exe and Javaw.exe is embedded in Oracle.

    What versions of Java.exe or Javaw.exe is embedded in Oracle. If java executables are embedded, then please inform what versions of Oracle have Java executables embedded.

    >
    What versions of Java.exe or Javaw.exe is embedded in Oracle. If java executables are embedded, then please inform what versions of Oracle have Java executables embedded.
    >
    Oracle 11.1+ includes AND REQUIRES Java 1.5.
    Oracle 11g requires version 1.5 and you CANNOT update the version. Any attempt to do so can possibly corrupt your Oracle version and will prevent Oracle from working properly.
    Note that also means you cannot load Java source or class files into Oracle that use functionality from Java 1.6+.
    See the Java Developer's Guide
    http://docs.oracle.com/cd/E11882_01/java.112/e10588/chone.htm
    >
    Feature List of Oracle JVM
    Table 1-1 lists the features of Oracle JVM and the versions in which they were first supported.
    Table 1-1 Feature List of Oracle JVM
    Feature Supported Since Oracle JVM Release
    JDK 1.5 support
    11.1

  • Detecting launcher (java.exe vs javaw.exe)?

    I found myself wondering this morning if one could and how if one could one would detect if the launcher of a particular main(...) were java.exe or javaw.exe programatically. Or by extension could one detect if Swing interfaces were supported.
    Consider that one had an application that could be launched from a command line or could be launched as a Swing windowed application. If there was a problem during startup the launcher (or if Swing was supported at the moment) might just be a relevant question when trying to give meaning full information back to the user. Trying to display information in (for example) a JOptionPane would be useless if the current environment didn't support it, and likewise if the launcher was javaw.exe sending the output to System.out or System.err would never be visible to the user.
    Spitting out the System.properties yielded some interesting and useful information, but nothing that just screamed at me, "Use me to determine where to send the output."
    Thoughts comments or suggestions?
    Thanks in advance,
    PS.

    I thought headless was supposed to handle this?
    http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/
    When your app was run in javaw or java on Windows,
    either way your app IS allowed to open a graphical window.
    So you cannot tell which way it is.
    But if your app is run from the server, or via some nongraphical connection
    to a UNIX machine, then supposedly headless would be true.
    And you can test for that.

  • How to make jar files run using java.exe and not javaw.exe

    Hi ,
    I am developing a project in which there is an GUI which inturn will call a console . I have made it into an jar file now.
    Here comes the problem. When i run the jar files , i don't get a console. While going through this forum, i came to know that jar runs using javaw.exe and this stops it from bring the console up.
    Please suggest me a way of running the jar file through java.exe or any other method by which i can get an new console poping up.
    PS : i cannot start the application itself in a system console , because the Console mode is an added feature and it is not to be displayed every time but only when the user intends to.

    Thanks for the reply pbrockway2. But i think, i was not able to convey my problem properly.
    I am supposed to start my application in a GUI mode ( No console are should be present at this point of time). Within the GUI , i have a option for working in the console ( i.e if console is choosen, then i start giving my output and take inputs from the console. I am trying to do this by just calling the "System.out "and "System.in" methods. )
    Here is the problem. As i have started it through " jar " it would not have a associated console with it.
    PS: i cannot have launching .bat file because that would result in my application having a console displayed at the very start of the application. I want the console to be displayed only when the user wants to start in console mode.
    Please suggest me some ways of doing this. Can i create a console from my java program and then exit it.

  • How can i execute a .jar or .jad through  java?

    I want to execute a .jar like i do in SE using the class RunTime in ME does anybody know how can i do it? There is no method exec in MIDP Runtime API

    I have a MIDlet that receives a jar file from another PDA using DatragramConection and FileConnection. It's working well. When i'm running my application i'll send the jar file to another aplication and this application should receive, execute and return the result. For example, if i have a simple program that prints Hello World. I'll send the program the other PDA will execute and then return a String. I have to call the jr file through java because my MIDlet wil be already running.
    Could you understand my problem?

  • Accessing RUN through java programming

    Sir,
    i need to develop a java application t access "run" in start menu.How can i access the run menu through java programming.?I want to run the program in the run command when we input command through the java program..please help me..if you have the code palese send it tio me please..........

    But I cant access the drives for eg: I wrote c:\programfiles as input but i got an exception like this
    error=3
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
    at java.lang.ProcessImpl.start(ProcessImpl.java:30)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
    at java.lang.Runtime.exec(Runtime.java:591)
    at java.lang.Runtime.exec(Runtime.java:429)
    at java.lang.Runtime.exec(Runtime.java:326)
    at ex.main(ex.java:10)
    how can correct this error...

  • Determining the name of the jar file running from JAVA

    Hi everyone,
    This is probably a silly question, but how do you determine the name of the jar file running from within the jar file.
    E.g. If I'm running the jar file "Test.jar", then how can I get the String value "Test.jar" from within my program?
    Any help would be appreciated! Thanks:)

    I think that you can use the solution above to get the jar file resources associated with a particular jar file, and then use the JarFile class to get a manifest of whats in there, and then find your class?
    This is only off of the top of my head, and I haven't tested it. Let me know if it works

  • Difference between java.exe and javaw.exe

    i just help for the difference
    thanks

    javaw.exe doesn't run in a command line window and anything that's written to System.out while running with javaw.exe will silently be discarded.

  • Mail.jar javabeans runs in beans but not in browser

    I have added the mail.jar to java beans and have written a program to access smtp mail
    The program compiles and runs ok in the beans development client but when i try to run it outside of beans in a web browser it wont run.
    If I then remove the Mail part from the program it will run outside of beans.
    I have added the mail.jer to the library within beans
    The exception im getting points to the Mail.jar being missing.
    Is there any other way to register the mail.jar with java beans or even with the javac compiler.
    Thanks in advance

    I include the full code im trying to get to work outside of the design environment. I tried adding the path of the mail.jar to the html path but it did absolutely nothing. I cannot find any reason why this code works in the designer and not outside of it. Works great in and out of the designer without the mail.jar library. Once the mail.jar library is there it will only work in the designer. I would have thought during the packaging process the designer would pass over all of the relative files and settings ready for deployment as it does with running in the designer but apparently not.
    package request;
    import java.awt.*;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    public class request extends java.applet.Applet{
         Button sendrequest,clear;
         TextField tex1,tex2,tex3,tex4,tex5;
    @Override
         public void init(){
              setLayout(new GridLayout(6,2,2,5));
              add(new Label("Customer Name"));
              tex1=new TextField(22);
              add(tex1);
              tex2=new TextField(22);
              add(new Label("Account Number"));
              add(tex2);
              tex3=new TextField(22);
              add(new Label("Viewing Card Number"));
              add(tex3);
              tex4=new TextField(22);
              add(new Label("Request Type"));
              add(tex4);
              tex5=new TextField(22);
              add(new Label("Request Reason"));
              add(tex5);
              sendrequest = new Button("Send Request");
              add(sendrequest);
              clear=new Button("Clear");
              add(clear);
    @Override
         public boolean action(Event evt,Object arg){
              if(evt.target instanceof Button){
    try {
    makechoice((Button) evt.target);
    } catch (Exception ex) {
    Logger.getLogger(request.class.getName()).log(Level.SEVERE, null, ex);
                   return true;
              } else return false;
         void makechoice(Button b) throws Exception{
              if (b==sendrequest){
                   String mess=null;
                   Date date;
                   date=new Date();
                   mess=date.toString() + "\r\n";
                   mess=mess + "Customer Name: "+ tex1.getText() + "\r\n";
                   mess=mess + "Account Number: "+ tex2.getText() + "\r\n";
                   mess=mess + "Card Number: "+ tex3.getText() + "\r\n";
                   mess=mess + "Request Type: "+ tex4.getText() + "\r\n";
                   mess=mess + "Request Reason: "+ tex5.getText() + "\r\n";
    postmail(mess);
    }else {
                   tex1.setText("");
                   tex2.setText("");
                   tex3.setText("");
                   tex4.setText("");
                   tex5.setText("");
    void postmail(String mess) throws MessagingException
    boolean debug = false;
    String recipient="YOUR EMAIL ADDRESS HERE";
    String subject="change request";
    String from="YOUR EMAIL ADDRESS HERE";
    //Set the host smtp address
    Properties props = new Properties();
    props.put("mail.smtp.host", "YOUR SMTP SERVER ADDRESS HERE");
    // create some properties and get the default Session
    Session session = Session.getDefaultInstance(props, null);
    session.setDebug(debug);
    // create a message
    Message msg = new MimeMessage(session);
    // set the from and to address
    InternetAddress addressFrom = new InternetAddress(from);
    msg.setFrom(addressFrom);
    InternetAddress addressTo = new InternetAddress(recipient);
    msg.setRecipient(Message.RecipientType.TO, addressTo);
    // Setting the Subject and Content Type
    msg.setSubject(subject);
    msg.setContent(mess, "text/plain");
    Transport.send(msg);
    }

  • Select from  Berkeley DB through java code not working

    Hi,
    I have developed an application using Jdeveloper 11g where in the Database Navigator I have created a new connection say Conn1 ,selected Generic Jdbc as the connection type and org.sqlite.Jdbc as the Driver Class.The JDBC URL is for example jdbc:sqlite:C:\Temp\ABC\abc.db .I have created a table say zipcodes. Now,I developed an ADF Fusion Web App in Jdev and selected View Obj in the model part.In the subsequent steps I selected the Berkley DB Connection as Conn1 and thus created the App Module and View Object.I then created a java class in the model part with code as
    package abc;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Properties;
    public class MainClass {
    public static void main(String[] args)
    try {
    String driver = "org.apache.derby.jdbc.EmbeddedDriver";
    Class.forName(driver).newInstance();
    Connection conn = null;
    conn = DriverManager.getConnection("jdbc:derby:C:\Temp\ABC\abc.db");
    Statement s = conn.createStatement();
    ResultSet rs = s.executeQuery("SELECT city, state, zipcode FROM zipcodes");
    while(rs.next()) {
    System.out.println("City : "+ rs.getString(1));
    System.out.println("State : "+ rs.getString(2));
    System.out.println();
    rs.close();
    s.close();
    conn.close();
    } catch(Exception e) {
    System.out.println("Exception: "+ e);
    e.printStackTrace();
    I imported db.jar, dbexample.jar, sqlite.jar ,derby.jar. and in the view part selected a jsf page and drag and dropped an attribute from the view control...Now when I run the application the error is that: Application module not connected to a database...
    What can be the possible problem?????How do I resolve it
    Thank you.

    Hello,
    What is the OS platform and version of Berkeley DB being used?
    abc.db is the Berkeley DB database right?
    Thanks,
    Sandra

  • Need to track windows processes running through java

    Hi All,
    Can any one please tell me a way to find out whether a process (exe file) is running in the system. I want to find out whether a file (wrun.exe) is running.
    Thanks,
    Ramesh

    Shorter: You can't
    Longer: WIN32API may have that functionality, so you should do some win32.c -code and use that via JNI...
    Maybe someone has already implemented the latter "WIN32API for Java"

  • After Yosemite install Symantec AV LiveUpdate won't run citing Java RTE not found error even after install of Java 8 Update 25

    I just installed Yosemite.  When I attempted to run Symantec Anti-Virus LiveUpdate (which worked fine under Mavericks) I got an error message stating "LiveUpdate was cancelled because Java Runtime was not found. Please run LiveUpdate once Java has been installed. For your convenience we will try to install Java using Apple Software Update."  Accordingly, I went to the Java website, downloaded and installed Java 8 Update 25.  However, I keep getting the same error message when I attempt to run LiveUpdate.  What must I do to get this AV software to work with Yosemite?

    Get rid of Symantec. You don't need it, or Java for that matter, which comprises a potential vulnerability of its own. Get rid of it too.
    One or more of the following support documents may be applicable:
    Uninstall Norton Internet Security for Mac
    Removing Symantec programs for Macintosh by using the RemoveSymantecMacFiles removal utility
    RemoveSymantecMacFiles

  • Connection refused with java, but not javaw

    I have a ServerSocket based program...listening on a port. It is really a very simple program. And I can run it with javaw. Then I can use another problem, for example, telnet to connect to that port, just to prove I can connect to that port. Everything is fine.
    Now if I run the exactly the same ServerSocket program with java, then I got the connection refused error.
    It is weird.
    Do you know why? Do you know a good socket troubleshooting tool on Windows? I am afraid of the viruses, so I haven't downloaded any free tools yet.

    You're right.
    The Norton personal firewall does not handle localhost to localhost correctly. I do all the tests on the same machine. The netstat -an shows the port is listening in either case. But now I know the firewall blocks one of them silently. No rule prompt was triggered. Worse, no logging produced for that particular access.
    Thanks. You've been very helpful.

  • To EXE Not To EXE: that's NOT the question

    Hi folks.
    My problem is very simply: I don`t want my application to be an open source code. My solution to a problem
    doesn`t have to be open to everyone. So how can i "encrypt" my bytecodes without having to write a class loader. Can anybody help me?
    Many thanks in advance.
    Marla.-

    Hmm,
    Well sounds like your going to be writing a GUI client that connects to an application server or a database
    server.
    The first question is will there be any possibility of your application running without a connection to the
    server?
    If the answer is yes, then of course you will need a GUI app. If the answer is no, then you can consider
    having all code on the server with a thin client.
    If your going the thin client direction, then you will either choose a Web Browser and JSP (or some such) or
    a Java GUI thin client that connects to the server for data and screen info (eg. xml parsed from server to
    client that tells the client what the menus are, what the browses are, what the fields in the browse is, etc).
    If you go the thin client, then extensive use of reflection would be best. This would make it hard to
    obuscate. Of course if you stream the code via sockets to the client then you could use obuscation, but
    the code passed from the server could not be obuscated. Then you would only have the issue of the
    server code.
    If your writing a fat gui client then you can avoid reflection. Of course reflection makes writing an advanced
    gui app so much easier, but you don't realy need it. In that case then you could obuscate.
    The bottom line is that you do need some form of registration and license management, even if you do
    obuscate. The reason being that people can still copy your programs, they will just find it hard to delve
    into your code. A determined person will be able to get past obuscated code though.
    Traditional forms of license management is via a server that registers connections. You know how many
    concurrent seats the client is licensed for and you only allow that many concurrent connections. Use of
    the system registry with some hash keys or encrypted (or obscure) encoding of such data is the best
    direction. Normaly a hash key that contains the license and number of seats is entered when you
    install. This is stored on the server and used for license management. Personaly I have never had to
    worry about it, but I understand the concepts and it's a good method to prevent casual copying and
    license breaches. A determined person is almost impossible to stop though.
    James.

  • Windows refuses to run the java.exe in my path.

    Hi all -
    I'm having some problems managing Java in Windows. All my experience with Java is primarily from a Unix environment, so I'm really having a tough time solving this issue.
    Windows is obsessed with using java from c:\program files\Java\jre1.5.0. That directory isn't in my path anywhere, and I don't have the problem from within Eclipse because you can specify your environment, but if I type 'java' from a command line, it invokes a version from that directory. I only noticed when trying to debug an RMI problem related to this and I started my project with "java -server" and it gave me the error:
    "Error: no `server' JVM at `C:\Program Files\Java\jre1.5.0\bin\server\jvm.dll'."
    Of course if I type in the full path to the java.exe I want to use, its fine.
    I've tried just removing the directory in the hopes that it would then take a look at my path variable and find the correct version, but then I just get the error:
    "Error: could not open `C:\Program Files\Java\jre1.5.0\lib\i386\jvm.cfg'"
    It's driving me mad! What do I have to do to tell Windows to give up on this directory? I've looked at the registry and it is in there about 30 times. That seems a little crazy to me, but I'm just not a Windows guy.
    Thanks
    Jason

    To allow "naked" java commands, Sun places a copy of java.exe and javaw.exe in a Windows directory that's on the execution path. In 2000/XP they're in WINDOWS\system32 (along with a copy of the Web Start program javaws.exe.)
    Either remove them, or place the directory that contains the wanted java.exe in the path before the WINDOWS\system32 entry - the first copy found will be used.

Maybe you are looking for

  • All of a sudden... creative suite does't want to open, and rejects my serial

    So I been having trouble opening photoshop and and any of the adobe creative suite product lately. Last night, I updated my Mac and so now today - Photoshop will not open. When I attempt to put my serial number in it's rejected. I am a very unhappy a

  • How do i delete contacts in my mail address book

    how do i delete contacts in my mail address book

  • ID CS3 : the 101 buttons bug - PDF file turning into a form

    Hi there, I'm just mentionning this issue with a clear title (I had mentioned it in another thread but with a wrong topic name, since I hadn't found out the bug). When working in inDesign CS3, there's a slight but annoying issue with interactive PDF

  • Dynamic Page / Oracle Tags/ Javascript

    I'm attempting to insert values from an Oracle database into javascript code that creates a scrolling text area. I'm assuming I need to use <oracle></oracle> tags to do so, but I'm not sure exactly how to populate what I need in the code. Any ideas?

  • Beginner date frustration

    I'm new to Java and am just going through some basic exercises with the Date object. Consider the following method of an invoice object: public Date getDueDate()           long current = invoiceDate.getTime();           Date date =  new Date(current