Thread: Unable to Run a JAVA Command in Shell.

Results 1 to 4 of 4
  1. #1 Unable to Run a JAVA Command in Shell. 
    Registered Member
    Join Date
    Feb 2012
    Posts
    14
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    So I have my Shell Script laid out accordingly.

    Code:
    #!/bin/bash
    dirpath="/root/Desktop/Divinity-X/" 
    java -Xmx1024m -classpath bin:deps/jython.jar:deps/log4j-1.2.15.jar:deps/mina-core-1.1.7.jar:deps/slf4j-api-1.5.3.jar:deps/slf4j-log4j12-1.5.3.jar:deps/xpp3-1.1.4c.jar:deps/xstream-1.3.1-20081003.103259-2.jar:deps/xpp3-1.1.4c.jar com.rs2hd.Main
    It doesnt find the Main Class. But if i CD into the directory in terminal, and run that Java command manually, it works. Ive tried changing dirpath, to, CD, to no avail.

    The issue is, i cant run the server from a shell script.
    Im running CentOS 6.3
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Feb 2009
    Posts
    400
    Thanks given
    9
    Thanks received
    20
    Rep Power
    29
    semicolons not colons
    If you don't stand for something you will fall for anything.

    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Feb 2012
    Posts
    14
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    i get:

    Code:
    Usage: java [-options] class [args...]
               (to execute a class)
       or  java [-options] -jar jarfile [args...]
               (to execute a jar file)
    where options include:
        -d32	  use a 32-bit data model if available
        -d64	  use a 64-bit data model if available
        -server	  to select the "server" VM
                      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 with specified granularity
        -da[:<packagename>...|:<classname>]
        -disableassertions[:<packagename>...|:<classname>]
                      disable assertions with specified granularity
        -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
    See http://java.sun.com/javase/reference for more details.
    Jython 2.2.1 on java1.7.0_07
    >>>
    Reply With Quote  
     

  4. #4  
    Renown Programmer and Respected Member
    Maxi's Avatar
    Join Date
    Jun 2008
    Posts
    3,201
    Thanks given
    281
    Thanks received
    1,093
    Rep Power
    1366
    Something must be wrong with your path, just execute the shell from within the directory or fix your path.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Java Game Shell [Pokemon2D]
    By Emily in forum Application Development
    Replies: 10
    Last Post: 02-04-2012, 05:46 AM
  2. run shell for hyperion.
    By Lochieee in forum Help
    Replies: 0
    Last Post: 05-12-2010, 10:45 AM
  3. Shell command for compile
    By Huey in forum Requests
    Replies: 1
    Last Post: 09-11-2009, 05:31 PM
  4. Replies: 17
    Last Post: 08-14-2009, 09:38 PM
  5. Shell script run
    By revive in forum Configuration
    Replies: 9
    Last Post: 07-25-2009, 09:16 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •