Results 1 to 6 of 6
  1. #1
    major is offline Member
    Join Date
    Jun 2011
    Posts
    12
    Rep Power
    0

    Default jre version in command line

    My application is packed into 1 jar file and run by this command: "java -jar myapp.jar".
    I config all the class paths in the manifest.mf file

    How to tell in the command line (or other place) what JRE version to use?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,771
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by major View Post
    My application is packed into 1 jar file and run by this command: "java -jar myapp.jar".
    I config all the class paths in the manifest.mf file

    How to tell in the command line (or other place) what JRE version to use?
    Use the absolute path for the java command.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    major is offline Member
    Join Date
    Jun 2011
    Posts
    12
    Rep Power
    0

    Default

    thanks Jos, but I didn't understand what you mean.
    I need to know what to change in this command "java -jar myapp.jar" in order to run myapp.jar with jre version 6.
    Since I have jre 1.4.2 and jre 6 installed in my computer.

  4. #4
    Toll's Avatar
    Toll is offline Senior Member
    Join Date
    May 2011
    Location
    Sweden
    Posts
    393
    Rep Power
    4

    Default

    Java Code:
    Usage: java [-options] class [args...]
               (to execute a class)
       or  java [-options] -jar jarfile [args...]
               (to execute a jar file)
    
    where options include:
        -server       to select the "server" VM
        -hotspot      is a synonym for the "server" VM  [deprecated]
                      The default VM is server.
    
        -cp <class search path of directories and zip/jar files>
        -classpath <class search path of directories and zip/jar files>
                      A ; separated list of directories, JAR archives,
                      and ZIP archives to search for class files.
        -D<name>=<value>
                      set a system property
        -verbose[:class|gc|jni]
                      enable verbose output
        -version      print product version and exit
        -version:<value>
                      require the specified version to run
        -showversion  print product version and continue
        -jre-restrict-search | -jre-no-restrict-search
                      include/exclude user private JREs in the version search
        -? -help      print this help message
        -X            print help on non-standard options
        -ea[:<packagename>...|:<classname>]
        -enableassertions[:<packagename>...|:<classname>]
                      enable assertions
        -da[:<packagename>...|:<classname>]
        -disableassertions[:<packagename>...|:<classname>]
                      disable assertions
        -esa | -enablesystemassertions
                      enable system assertions
        -dsa | -disablesystemassertions
                      disable system assertions
        -agentlib:<libname>[=<options>]
                      load native agent library <libname>, e.g. -agentlib:hprof
                        see also, -agentlib:jdwp=help and -agentlib:hprof=help
        -agentpath:<pathname>[=<options>]
                      load native agent library by full pathname
        -javaagent:<jarpath>[=<options>]
                      load Java programming language agent, see java.lang.instrument
    
        -splash:<imagepath>
                      show splash screen with specified image
    Have you tried using -version:<value>?

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,883
    Rep Power
    25

    Default

    I have jre 1.4.2 and jre 6 installed in my computer
    Use the absolute path for the java command.
    D:\java\jre1.4.2\bin\java.exe -jar jarfile.jar

  6. #6
    major is offline Member
    Join Date
    Jun 2011
    Posts
    12
    Rep Power
    0

Similar Threads

  1. Read from command line
    By sehudson in forum New To Java
    Replies: 12
    Last Post: 02-23-2011, 05:44 AM
  2. Replies: 13
    Last Post: 12-31-2010, 02:36 AM
  3. can i run line by line command in netbean?
    By choconlongxu in forum NetBeans
    Replies: 1
    Last Post: 07-19-2010, 09:41 PM
  4. Replies: 2
    Last Post: 07-02-2010, 03:20 PM
  5. Unable to execute command line command in java
    By LordSM in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 01:23 AM

Tags for this Thread

Posting Permissions

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