Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Jun 2012
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HELP - Running a java project on Centos!! (VPS)

    here's my current run code
    PHP Code:
    java -Xmx800m -cp bin;deps/poi.jar;deps/mysql.jar;deps/mina.jar;deps/slf4j.jar;deps/slf4j-nop.jar;deps/jython.jar;log4j-1.2.15.jarserver.Server 
    Why isn't it working?

    I'm getting

    PHP Code:
    [root@V-4836 Source]# java -Xmx800m -cp bin;deps/poi.jar;deps/mysql.jar;deps/mina.jar;deps/slf4j.jar;deps/slf4j-nop.jar;deps/jython.jar;log4j-1.2.15.jar; server.Server
    Usagejava [-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>
                      
    separated list of directoriesJAR 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 agentsee java.lang.instrument
        
    -splash:<imagepath>
                      
    show splash screen with specified image
    See http
    ://java.sun.com/javase/reference for more details.
    invalid file (bad magic number): Exec format error
    Error occurred during initialization of VM
    java
    /lang/NoClassDefFoundErrorjava/lang/Object
    invalid file 
    (bad magic number): Exec format error
    invalid file 
    (bad magic number): Exec format error
    invalid file 
    (bad magic number): Exec format error
    Error occurred during initialization of VM
    java
    /lang/NoClassDefFoundErrorjava/lang/Object
    -bashlog4j-1.2.15.jarcommand not found
    -bashserver.Servercommand not found 
    Could anyone please reply with a working run code?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Has the Server class been compiled?
    Showing usage generally indicates that its incorrect usage and not a failed run. On linux, these classpaths are separated by a colon not a semi-colon.

  • #3
    New Coder
    Join Date
    Jun 2012
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    Has the Server class been compiled?
    Showing usage generally indicates that its incorrect usage and not a failed run. On linux, these classpaths are separated by a colon not a semi-colon.
    Everything has been compiled, can you please fix the code for me?

    and reply with the correct code?

  • #4
    New Coder
    Join Date
    Jun 2012
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    Has the Server class been compiled?
    Showing usage generally indicates that its incorrect usage and not a failed run. On linux, these classpaths are separated by a colon not a semi-colon.
    I tried
    PHP Code:
    java -Xmx800m -cp bin:deps/poi.jar:deps/mysql.jar:deps/mina.jar:deps/slf4j.jar:deps/slf4j-nop.jar:deps/jython.jar:log4j-1.2.15.jarserver.Server 
    and got...

    PHP Code:


    [root@V-4836 Source]# java -Xmx800m -cp bin:deps/poi.jar:deps/mysql.jar:deps/mina.jar:deps/slf4j.jar:deps/slf4j-nop.jar:deps/jython.jar:log4j-1.2.15.jar: server.Server
    Exception in thread "main" java.lang.UnsupportedClassVersionErrorserver/Server Unsupported major.minor version 51.0
            at java
    .lang.ClassLoader.defineClass1(Native Method)
            
    at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
            
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
            
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
            
    at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
            
    at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
            
    at java.security.AccessController.doPrivileged(Native Method)
            
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
            
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
            
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
            
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    Could not find the main class: server.ServerProgram will exit. 
    help....?

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    The directory you are in, does it have a subdirectory of /server/Server.class from it?

    CLI java is such a pain.

    Edit:
    Wait. This error is an incompatible Java version. Your class was compiled with a greater version of JDK than your JRE.
    Update your JRE to at least Java 5.

  • #6
    New Coder
    Join Date
    Jun 2012
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    The directory you are in, does it have a subdirectory of /server/Server.class from it?

    CLI java is such a pain.

    Edit:
    Wait. This error is an incompatible Java version. Your class was compiled with a greater version of JDK than your JRE.
    Update your JRE to at least Java 5.
    my jre is 6 & my jdk is 14, i'm updating my jre to 7 then will it work?
    Last edited by TestingPHP; 06-13-2012 at 06:33 PM.

  • #7
    New Coder
    Join Date
    Jun 2012
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok On my VPS i have this version of Java JDK: java-1.6.0-openjdk-1.6.0.0-1.25.1.10.6.el5_8.x86_64

    Someone add me on msn & help me update please.

    peanuthitz@hotmail.co.uk

  • #8
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    This is a redundant thread, and there is no reason to leave it open. Continue any discussion in your other 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
    •