Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Closed Thread
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-13-2012, 04:01 PM   PM User | #1
TestingPHP
New Coder

 
Join Date: Jun 2012
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
TestingPHP is an unknown quantity at this point
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?
TestingPHP is offline  
Old 06-13-2012, 05:42 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
Fou-Lu is offline  
Old 06-13-2012, 05:43 PM   PM User | #3
TestingPHP
New Coder

 
Join Date: Jun 2012
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
TestingPHP is an unknown quantity at this point
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?
TestingPHP is offline  
Old 06-13-2012, 05:45 PM   PM User | #4
TestingPHP
New Coder

 
Join Date: Jun 2012
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
TestingPHP is an unknown quantity at this point
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....?
TestingPHP is offline  
Old 06-13-2012, 06:18 PM   PM User | #5
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
Fou-Lu is offline  
Old 06-13-2012, 06:29 PM   PM User | #6
TestingPHP
New Coder

 
Join Date: Jun 2012
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
TestingPHP is an unknown quantity at this point
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..
TestingPHP is offline  
Old 06-13-2012, 06:49 PM   PM User | #7
TestingPHP
New Coder

 
Join Date: Jun 2012
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
TestingPHP is an unknown quantity at this point
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
TestingPHP is offline  
Old 06-13-2012, 07:08 PM   PM User | #8
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
This is a redundant thread, and there is no reason to leave it open. Continue any discussion in your other thread.
Fou-Lu is offline  
Closed Thread

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:32 PM.


Advertisement
Log in to turn off these ads.